From 97dfc2aa6a4aab4ae3fb08401fdce9e3bea6f43b Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 3 Jul 2023 06:21:05 +0200 Subject: [PATCH] improve key mappings a bit and add spellcheck --- init.lua | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 55f054a..1dab1e3 100644 --- a/init.lua +++ b/init.lua @@ -26,15 +26,12 @@ vim.opt.pastetoggle = '' vim.opt.shiftwidth = 4 vim.opt.softtabstop = 4 vim.opt.tabstop = 4 -vim.opt.textwidth = 125 +vim.opt.textwidth = 79 vim.opt.undofile = true -- Enable vimrc files per project and disable unsafe commands in project vimrc vim.opt.exrc = true vim.opt.secure = true -vim.cmd 'noremap :bn' -vim.cmd 'noremap :bp' - -- Toggles on different plugins/modes vim.cmd 'nmap :set nonumber!' vim.cmd 'nmap :NvimTreeToggle' @@ -54,13 +51,22 @@ vim.cmd 'highlight Pmenu ctermbg=253 guibg=253' vim.cmd 'highlight Pmenu ctermfg=232 guifg=232' vim.cmd 'let g:airline_theme=\'papercolor\'' --- Find files using Telescope command-line sugar. -vim.cmd 'nnoremap ff Telescope find_files' -vim.cmd 'nnoremap fg Telescope live_grep' -vim.cmd 'nnoremap fb Telescope buffers' -vim.cmd 'nnoremap fh Telescope help_tags' -vim.cmd 'nnoremap fl Telescope git_files' +local keymap = vim.api.nvim_set_keymap +local default_opts = { noremap = true, silent = true } +-- Use tab and shift+tab to cycle buffers +keymap("n", "", "bn", default_opts) +keymap("n", "", "bp", default_opts) + +-- Find files, buffers, grep in folder using Telescope command-line sugar. +keymap("n", "ff", "Telescope find_files", default_opts) +keymap("n", "fg", "Telescope live_grep", default_opts) +keymap("n", "fb", "Telescope buffers", default_opts) +keymap("n", "fh", "Telescope help_tags", default_opts) +keymap("n", "fl", "Telescope git_files", default_opts) + +-- Turn spellchecker on +keymap("n", "s", "setlocal spell spelllang=en_us", default_opts) -- Install plugins require('plugins')