diff --git a/.vim/nvim.lua b/.vim/nvim.lua index ea785c8..ff6ad32 100644 --- a/.vim/nvim.lua +++ b/.vim/nvim.lua @@ -168,9 +168,16 @@ local dropdown = require'telescope.themes'.get_dropdown({ --winblend = 10 }) -git_grep_word = function(conf) +git_live_grep = function(conf) local opt = dropdown opt.cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1] for k,v in pairs(conf) do opt[k] = v end builtin.live_grep(opt) end + +git_grep_word = function(conf) + local opt = dropdown + opt.cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + for k,v in pairs(conf) do opt[k] = v end + builtin.grep_string(opt) +end diff --git a/.vimrc b/.vimrc index 24672be..8204cee 100644 --- a/.vimrc +++ b/.vimrc @@ -308,6 +308,7 @@ autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({show_header = " Autoformat on save autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000) autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000) +autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000) " Goto previous/next diagnostic warning/error nnoremap g[ lua vim.lsp.diagnostic.goto_prev() @@ -885,7 +886,7 @@ endfunction "nmap gt :NERDTreeToggle "nmap gt :VimFilerExplorer -winwidth=40 -toggle -direction=rightbelow -parent -status -force-hide "nmap gt :VimFiler -status -auto-cd -parent -force-quit -nmap gt :Defx -columns=icons:indent:filename:type +nmap gt :Defx `escape(expand('%:p:h'), ' :')` -search=`expand('%:p')` -columns=icons:indent:filename:type ""nnoremap gt :NvimTreeToggle " The same for the TagList, useful for large C files. "nmap gb :TlistToggle @@ -1001,7 +1002,7 @@ nnoremap aa :RgRoot! "nnoremap :Files! `git rev-parse --show-toplevel` "nnoremap :GFiles nnoremap lua require('telescope.builtin').git_files() -nnoremap ag lua git_grep_word{ word_match = "-w", only_sort_text = true, search = ''} +nnoremap ag lua git_live_grep{ word_match = "-w", only_sort_text = true, search = ''} nnoremap aw lua git_grep_word{ word_match = "-w", only_sort_text = true } " For C++ -- A is a great plugin which allows you to jump from the c file to the