Improved neovim config

This commit is contained in:
2023-08-21 19:19:37 +02:00
parent 2ad93d9338
commit ce110d730e
15 changed files with 169 additions and 76 deletions

View File

@ -3,10 +3,16 @@ local map = function(mode, lhs, rhs, info)
end
-- Basics
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
map("n", "<C-q>", "<cmd>qa<cr>", "Quit all")
map("n", ";", ":", "Command mode")
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
map("n", "U", "<cmd>redo<cr>", "Redo")
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
map("n", "<C-r>", ":%s/<C-R><C-W>//g<Left><Left>", "Replace word under cursor")
map("n", "<C-q>", "<cmd>qa<cr>", "Quit all")
map({"n", "v"}, "<C-b>", "^", "Beginning of line")
map("i", "<C-b>", "<esc>^i", "Beginning of line")
map({"i", "n", "v"}, "<C-e>", "<end>", "End of line")
-- Indenting
map("v", "<", "<gv")
@ -17,13 +23,6 @@ map("n", "gd", vim.lsp.buf.definition, "Go to definition")
map("n", "gr", vim.lsp.buf.references, "Go to references")
map("n", "<leader>cf", vim.lsp.buf.format, "Format")
-- Toggle comment
map("n", "<C-_>", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", "Toggle comment")
map("v", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", "Toggle comment")
-- Normal mode
map("n", "<C-b>", "<cmd>NvimTreeToggle<cr>", "Toggle tree")
-- Plugins
map("n", "<leader>t", "<cmd>NvimTreeToggle<cr>", "Toggle tree")
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
map("n", "<leader>f", "<cmd>Telescope find_files<cr>", "Find files")
map("n", "<leader>r", "<cmd>Telescope oldfiles<cr>", "Recent files")
map({ "n", "t" }, "<A-i>", "<cmd>lua require('nvterm.terminal').toggle('float')<cr>", "Toggle terminal")