diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-10-25 13:50:44 +0200 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2017-10-25 13:50:44 +0200 |
| commit | 99050fe8590e16fbb741bf118422af8ccb0aeb73 (patch) | |
| tree | 39479e42a528d0cf5373db6b3cec8699662578b6 /modules/examples | |
| parent | 164220fe13f30561eb62f2d2bfc458aff60cfa5a (diff) | |
lnl: add fzf-vim
Diffstat (limited to 'modules/examples')
| -rw-r--r-- | modules/examples/lnl.nix | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/modules/examples/lnl.nix b/modules/examples/lnl.nix index ef64c43..914c5f1 100644 --- a/modules/examples/lnl.nix +++ b/modules/examples/lnl.nix @@ -83,6 +83,7 @@ bind-key -n M-R run "tmux send-keys -t $(hostname -s | awk -F'-' '{print tolower($NF)}') C-l Up Enter" bind 0 set status + bind S choose-client bind-key -r "<" swap-window -t -1 bind-key -r ">" swap-window -t +1 @@ -98,7 +99,7 @@ { names = [ "ReplaceWithRegister" "vim-indent-object" "vim-sort-motion" ]; } { names = [ "ale" "vim-gitgutter" "vim-dispatch" ]; } { names = [ "commentary" "vim-eunuch" "repeat" "tabular" ]; } - { names = [ "fzfWrapper" "youcompleteme" ]; } + { names = [ "fzfWrapper" "fzf-vim" "youcompleteme" ]; } { names = [ "gist-vim" "webapi-vim" ]; } { names = [ "polyglot" "colors-solarized" ]; } { names = [ "python-mode" ]; } @@ -145,40 +146,21 @@ nnoremap <Leader>p :FZF<CR> nnoremap <silent> <Leader>e :exe 'FZF ' . expand('%:h')<CR> - function! s:ag_to_qf(line) - let parts = split(a:line, ':') - return {'filename': parts[0], 'lnum': parts[1], 'col': parts[2], - \ 'text': join(parts[3:], ':')} - endfunction - - function! s:ag_handler(lines) - if len(a:lines) < 2 | return | endif - - let cmd = get({'ctrl-x': 'split', - \ 'ctrl-v': 'vertical split', - \ 'ctrl-t': 'tabe'}, a:lines[0], 'e') - let list = map(a:lines[1:], 's:ag_to_qf(v:val)') - - let first = list[0] - execute cmd escape(first.filename, ' %#\') - execute first.lnum - execute 'normal!' first.col.'|zz' - - if len(list) > 1 - call setqflist(list) - copen - wincmd p - endif - endfunction - - command! -nargs=* Ag call fzf#run({ - \ 'source': printf('${pkgs.ag}/bin/ag --nogroup --column --color "%s"', - \ escape(empty(<q-args>) ? '^(?=.)' : <q-args>, '"\')), - \ 'sink*': function('<sid>ag_handler'), - \ 'options': '--ansi --expect=ctrl-t,ctrl-v,ctrl-x --delimiter : --nth 4.. '. - \ '--multi --bind ctrl-a:select-all,ctrl-d:deselect-all '. - \ '--color hl:68,hl+:110', - \ 'down': '50%' }) + nmap <leader><tab> <plug>(fzf-maps-n) + xmap <leader><tab> <plug>(fzf-maps-x) + omap <leader><tab> <plug>(fzf-maps-o) + imap <c-x><c-w> <plug>(fzf-complete-word) + + command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, + \ <bang>0 ? fzf#vim#with_preview('up:30%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ <bang>0) + + command! -bang -nargs=* Rg call fzf#vim#grep( + \ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1, + \ <bang>0 ? fzf#vim#with_preview('up:30%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ <bang>0) highlight clear SignColumn @@ -307,7 +289,6 @@ nixpkgs.config.allowUnfree = true; nixpkgs.config.packageOverrides = super: let self = super.pkgs; in { - ycmd = super.ycmd.override { gocode = null; godef = null; rustracerd = null; }; }; # TODO: add module for per-user config, etc, ... |
