From 4a463a81fb7906bc7a2fab9067c4ce03c49060a4 Mon Sep 17 00:00:00 2001 From: Paul Schulze Date: Thu, 28 Mar 2024 15:34:06 +0100 Subject: [PATCH] add rooter, more shortcuts --- init.lua | 12 +++++++++++ nvpunk.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins.lua | 3 ++- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 nvpunk.patch diff --git a/init.lua b/init.lua index 898a123..df5c317 100644 --- a/init.lua +++ b/init.lua @@ -33,6 +33,7 @@ vim.api.nvim_set_keymap('n', 'd', ':FzfLua diagnostics_document', { vim.api.nvim_set_keymap('n', ']g', ':Gitsigns next_hunk', { noremap = true }) vim.api.nvim_set_keymap('n', '[g', ':Gitsigns prev_hunk', { noremap = true }) vim.api.nvim_set_keymap('n', 'gs', ':Gitsigns preview_hunk_inline', { noremap = true }) +vim.api.nvim_set_keymap('n', 'gu', ':Gitsigns reset_hunk', { noremap = true }) vim.api.nvim_set_keymap('n', 'DD', ':DiffviewOpen', { noremap = true }) vim.api.nvim_set_keymap('n', 'DF', ':DiffviewFileHistory', { noremap = true }) @@ -120,6 +121,17 @@ vim.api.nvim_set_keymap('v', ',t', ':tab drop', { noremap = true }) vim.api.nvim_set_keymap('n', 'q', ':tabclose', { noremap = true }) +vim.cmd [[ +set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< +]] + +vim.cmd [[ +let g:rooter_manual_only = 0 +let g:rooter_silent_chdir = 1 +let g:rooter_patterns = ['.git'] +let g:rooter_change_directory_for_non_project_files = 'current' +]] + -- vim.opt.shada = "/100,'10,\"100,:20,%" -- vim.opt.shadafile = "/home/pfs/.config/nvpunk/lua/user/nviminfo" -- autocmd BufWinLeave * if expand("%") != "" | silent! mkview | endif diff --git a/nvpunk.patch b/nvpunk.patch new file mode 100644 index 0000000..e53e8c4 --- /dev/null +++ b/nvpunk.patch @@ -0,0 +1,60 @@ +diff --git a/lua/nvpunk/keymaps.lua b/lua/nvpunk/keymaps.lua +index d4a0339..8eccb86 100644 +--- a/lua/nvpunk/keymaps.lua ++++ b/lua/nvpunk/keymaps.lua +@@ -16,20 +16,20 @@ M.set_keymaps = function() + km.vkeymap('>', '>gv') + + -- move selection +- km.vkeymap('', ":m '<-2gv=gv") +- km.vkeymap('', ":m '>+1gv=gv") ++ -- km.vkeymap('', ":m '<-2gv=gv") ++ -- km.vkeymap('', ":m '>+1gv=gv") + + -- pasting in visual mode doesn't overwrite the clipboard content +- km.vkeymap('p', '"_dP') ++ -- km.vkeymap('p', '"_dP') + + -- pressing esc twice goes to normal mode in terminal windows +- km.tkeymap('', '') ++ -- km.tkeymap('', '') + + -- wrapped text movement +- km.nkeymap('', 'gj') +- km.nkeymap('', 'gk') +- km.nkeymap('', 'gj') +- km.nkeymap('', 'gk') ++ -- km.nkeymap('', 'gj') ++ -- km.nkeymap('', 'gk') ++ -- km.nkeymap('', 'gj') ++ -- km.nkeymap('', 'gk') + + -- Terminal splitter + km.nkeymap('/s', 'vsterminal', +diff --git a/lua/nvpunk/lsp/base_conf.lua b/lua/nvpunk/lsp/base_conf.lua +index 46dc71f..72314fb 100644 +--- a/lua/nvpunk/lsp/base_conf.lua ++++ b/lua/nvpunk/lsp/base_conf.lua +@@ -37,6 +37,7 @@ vim.g.rustaceanvim = { + ['rust-analyzer'] = { + telemetry = { enable = false }, + offset_encoding = 'utf-8', ++ check = { command = 'clippy' }, + } + } + }, +diff --git a/lua/nvpunk/lsp/keymaps.lua b/lua/nvpunk/lsp/keymaps.lua +index 01af280..4915b00 100644 +--- a/lua/nvpunk/lsp/keymaps.lua ++++ b/lua/nvpunk/lsp/keymaps.lua +@@ -63,8 +63,8 @@ M.set_lsp_keymaps = function(client, bufnr, extra_keymaps) + 'List folders' + ) + -- bm.nkeymap('D', 'lua vim.lsp.buf.type_definition()', 'Open definition') +- bm.nkeymap('rn', vim.lsp.buf.rename, 'Rename') +- bm.nkeymap('gr', vim.lsp.buf.references, 'References') ++ --bm.nkeymap('rn', vim.lsp.buf.rename, 'Rename') ++ --bm.nkeymap('gr', vim.lsp.buf.references, 'References') + bm.nkeymap('e', vim.diagnostic.open_float, 'Show diagnostics') + bm.nkeymap('[d', vim.diagnostic.goto_prev, 'Prev diagnostic') + bm.nkeymap(']d', vim.diagnostic.goto_next, 'Next diagnostic') diff --git a/plugins.lua b/plugins.lua index 107c1be..2371c47 100644 --- a/plugins.lua +++ b/plugins.lua @@ -1,4 +1,5 @@ return { { 'tpope/vim-fugitive' }, - { 'ibhagwan/fzf-lua' } + { 'ibhagwan/fzf-lua' }, + { 'airblade/vim-rooter' }, }