fix grep and file explorer rel to file
This commit is contained in:
parent
aa7a192b0c
commit
ac8cca19b1
2 changed files with 11 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
5
.vimrc
5
.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 <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||
|
|
@ -885,7 +886,7 @@ endfunction
|
|||
"nmap gt :NERDTreeToggle<CR>
|
||||
"nmap <silent> gt :VimFilerExplorer -winwidth=40 -toggle -direction=rightbelow -parent -status -force-hide<CR>
|
||||
"nmap <silent> gt :VimFiler -status -auto-cd -parent -force-quit<CR>
|
||||
nmap <silent> gt :Defx -columns=icons:indent:filename:type<CR>
|
||||
nmap <silent> gt :Defx `escape(expand('%:p:h'), ' :')` -search=`expand('%:p')` -columns=icons:indent:filename:type<CR>
|
||||
""nnoremap <silent> gt :NvimTreeToggle<CR>
|
||||
" The same for the TagList, useful for large C files.
|
||||
"nmap gb :TlistToggle<CR>
|
||||
|
|
@ -1001,7 +1002,7 @@ nnoremap <silent> <Leader>aa :<C-u>RgRoot!<CR>
|
|||
"nnoremap <C-l> :<C-u>Files! `git rev-parse --show-toplevel`<CR>
|
||||
"nnoremap <C-k> :<C-u>GFiles<CR>
|
||||
nnoremap <C-k> <cmd>lua require('telescope.builtin').git_files()<cr>
|
||||
nnoremap <silent> <Leader>ag <cmd>lua git_grep_word{ word_match = "-w", only_sort_text = true, search = ''}<cr>
|
||||
nnoremap <silent> <Leader>ag <cmd>lua git_live_grep{ word_match = "-w", only_sort_text = true, search = ''}<cr>
|
||||
nnoremap <silent> <Leader>aw <cmd>lua git_grep_word{ word_match = "-w", only_sort_text = true }<cr>
|
||||
|
||||
" For C++ -- A is a great plugin which allows you to jump from the c file to the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue