✨ Added ability for fzf to go ..
This commit is contained in:
parent
6c3ac0b4f3
commit
e81f3457e3
2 changed files with 20 additions and 7 deletions
|
|
@ -25,7 +25,7 @@ require'nvim-treesitter.configs'.setup{
|
|||
|
||||
-- Disable folds
|
||||
vim.g.nofoldenable = true
|
||||
--
|
||||
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
|
|
@ -346,6 +346,22 @@ vim.cmd[[function TrimWhiteSpace()
|
|||
''
|
||||
endfunction]]
|
||||
|
||||
-- Search pattern across repository files
|
||||
vim.cmd[[
|
||||
function! FzfExplore(...)
|
||||
let inpath = substitute(a:1, "'", '', 'g')
|
||||
if inpath == "" || matchend(inpath, '/') == strlen(inpath)
|
||||
execute "cd" getcwd() . '/' . inpath
|
||||
let cwpath = getcwd() . '/'
|
||||
call fzf#run(fzf#wrap(fzf#vim#with_preview({'source': 'ls -1ap', 'dir': cwpath, 'sink': 'FZFExplore', 'options': ['--prompt', cwpath]})))
|
||||
else
|
||||
let file = getcwd() . '/' . inpath
|
||||
execute "e" file
|
||||
endif
|
||||
endfunction]]
|
||||
|
||||
vim.cmd[[command! -nargs=* FZFExplore call FzfExplore(shellescape(<q-args>))]]
|
||||
|
||||
--Removes trailing spaces on save
|
||||
vim.cmd[[autocmd FileWritePre * call TrimWhiteSpace()]]
|
||||
vim.cmd[[autocmd FileAppendPre * call TrimWhiteSpace()]]
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ vim.g.mapleader = ","
|
|||
keymap('n', '<c-b>', '<c-w>:NvimTreeToggle<CR>', {})
|
||||
|
||||
-- Tab Shortcuts
|
||||
keymap('n', '<c-t>', '<c-w>:tabnew<CR>', {})
|
||||
keymap('n', '<s-tab>', '<c-w>:tabprevious<CR>', {})
|
||||
keymap('n', '<a-tab>', '<c-w>:tabnext<CR>', {})
|
||||
keymap('n', '<c-t>', '<c-w>:tabnew<CR>', {}) keymap('n', '<s-tab>', '<c-w>:tabprevious<CR>', {}) keymap('n', '<a-tab>', '<c-w>:tabnext<CR>', {})
|
||||
keymap('n', '<a-left>', '<c-w>:tabprevious<CR>', {})
|
||||
keymap('n', '<a-right>', '<c-w>:tabnext<CR>', {})
|
||||
|
||||
|
|
@ -16,8 +14,8 @@ keymap('n', '<a-right>', '<c-w>:tabnext<CR>', {})
|
|||
keymap('n', '<c-h>', '<c-w>:wincmd h<CR>', {}) keymap('n', '<c-l>', '<c-w>:wincmd l<CR>', {})
|
||||
|
||||
-- open fzf
|
||||
vim.cmd[[nnoremap fzf :silent :Files]]
|
||||
keymap('n', '<c-p>', '<c-w>:Files<CR>', {})
|
||||
vim.cmd[[nnoremap fzf :silent :FZFExplore]]
|
||||
keymap('n', '<c-p>', '<c-w>:FZFExplore<CR>', {})
|
||||
|
||||
-- open ripgrep
|
||||
vim.cmd[[nnoremap rg :silent :Rg]]
|
||||
|
|
@ -72,4 +70,3 @@ vim.cmd[[noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')]]
|
|||
-- Toggle English spellcheck with F11
|
||||
vim.cmd[[nnoremap <silent> <F11> :set spell!<cr>]]
|
||||
vim.cmd[[inoremap <silent> <F11> <C-O>:set spell!<cr>]]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue