Adjust key map settings
This commit is contained in:
parent
b135ce095b
commit
12437b5bcd
2 changed files with 17 additions and 2 deletions
3
init.lua
3
init.lua
|
@ -20,6 +20,7 @@ end
|
||||||
-- set up a line number on the current line but relative above and below to
|
-- set up a line number on the current line but relative above and below to
|
||||||
-- help with motion commands
|
-- help with motion commands
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
|
vim.opt.numberwidth = 2
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
-- even with the nice space/tab autodetect, prefer 4 for tab stops but let file
|
-- even with the nice space/tab autodetect, prefer 4 for tab stops but let file
|
||||||
|
@ -54,7 +55,7 @@ vim.opt.expandtab = true
|
||||||
vim.opt.hidden = true
|
vim.opt.hidden = true
|
||||||
|
|
||||||
-- look for vimrc in the current directory as well as $MYVIMRC
|
-- look for vimrc in the current directory as well as $MYVIMRC
|
||||||
-- e.g. place .nvim.lua at the root of a project directory for project specific settings
|
-- e.g. place .init.lua at the root of a project directory for project specific settings
|
||||||
vim.opt.exrc = true
|
vim.opt.exrc = true
|
||||||
-- make looking for local changes secure
|
-- make looking for local changes secure
|
||||||
vim.opt.secure = true
|
vim.opt.secure = true
|
||||||
|
|
16
mapping.lua
16
mapping.lua
|
@ -1,3 +1,17 @@
|
||||||
|
-- from: https://sharksforarms.dev/posts/neovim-rust/
|
||||||
|
-- Set completeopt to have a better completion experience
|
||||||
|
-- :help completeopt
|
||||||
|
-- menuone: popup even when there's only one match
|
||||||
|
-- noinsert: Do not insert text until a selection is made
|
||||||
|
-- noselect: Do not select, force user to select one from the menu
|
||||||
|
vim.opt.completeopt = "menuone,noinsert,noselect"
|
||||||
|
|
||||||
|
-- Avoid showing extra messages when using completion
|
||||||
|
vim.opt.shortmess:append('c')
|
||||||
|
|
||||||
|
-- extend timeout to allow time for three character shortcuts
|
||||||
|
vim.opt.timeoutlen = 1400
|
||||||
|
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local opts = { buffer = bufnr, noremap = true, silent = true }
|
local opts = { buffer = bufnr, noremap = true, silent = true }
|
||||||
|
|
||||||
|
@ -23,7 +37,7 @@ vim.keymap.set('n', '<space>wl', function()
|
||||||
end, opts)
|
end, opts)
|
||||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, opts)
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
|
Loading…
Reference in a new issue