tv vim: use ctrlp
This commit is contained in:
parent
c6311d2187
commit
0add7e1a47
@ -14,6 +14,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [
|
extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [
|
||||||
|
pkgs.vimPlugins.ctrlp
|
||||||
pkgs.vimPlugins.undotree
|
pkgs.vimPlugins.undotree
|
||||||
(pkgs.vimUtils.buildVimPlugin {
|
(pkgs.vimUtils.buildVimPlugin {
|
||||||
name = "file-line-1.0";
|
name = "file-line-1.0";
|
||||||
@ -285,6 +286,9 @@ let
|
|||||||
vim = pkgs.writeDashBin "vim" ''
|
vim = pkgs.writeDashBin "vim" ''
|
||||||
set -efu
|
set -efu
|
||||||
(umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString mkdirs})
|
(umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString mkdirs})
|
||||||
|
if test $# = 0 && test -e "$PWD/.ctrlpignore"; then
|
||||||
|
set -- +CtrlP
|
||||||
|
fi
|
||||||
exec ${pkgs.vim}/bin/vim "$@"
|
exec ${pkgs.vim}/bin/vim "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -332,9 +336,6 @@ let
|
|||||||
|
|
||||||
au BufRead,BufNewFile /dev/shm/* set nobackup nowritebackup noswapfile
|
au BufRead,BufNewFile /dev/shm/* set nobackup nowritebackup noswapfile
|
||||||
|
|
||||||
nmap <esc>q :buffer
|
|
||||||
nmap <M-q> :buffer
|
|
||||||
|
|
||||||
cnoremap <C-A> <Home>
|
cnoremap <C-A> <Home>
|
||||||
|
|
||||||
noremap <C-c> :q<cr>
|
noremap <C-c> :q<cr>
|
||||||
@ -360,6 +361,41 @@ let
|
|||||||
noremap <esc>[c <nop> | noremap! <esc>[c <nop>
|
noremap <esc>[c <nop> | noremap! <esc>[c <nop>
|
||||||
noremap <esc>[d <nop> | noremap! <esc>[d <nop>
|
noremap <esc>[d <nop> | noremap! <esc>[d <nop>
|
||||||
vnoremap u <nop>
|
vnoremap u <nop>
|
||||||
|
|
||||||
|
"
|
||||||
|
" CtrlP-related configuration
|
||||||
|
"
|
||||||
|
hi CtrlPPrtCursor ctermbg=199
|
||||||
|
hi CtrlPMatch ctermfg=226
|
||||||
|
set showtabline=0
|
||||||
|
let g:ctrlp_cmd = 'CtrlPMixed'
|
||||||
|
let g:ctrlp_map = '<esc>q'
|
||||||
|
let g:ctrlp_working_path_mode = 'a'
|
||||||
|
" Cannot use autoignore extension because it fails to initialize properly:
|
||||||
|
" when started the first time, e.g. using `vim +CtrlP`, then it won't use
|
||||||
|
" patterns from .ctrlpignore until CtrlP gets reopened and F5 pressed...
|
||||||
|
fu s:gen_ctrlp_custom_ignore()
|
||||||
|
let l:prefix = getcwd()
|
||||||
|
let l:pats = readfile(l:prefix . "/.ctrlpignore")
|
||||||
|
let l:pats = filter(l:pats, 's:ctrlpignore_filter(v:val)')
|
||||||
|
let l:pats = map(l:pats, 's:ctrlpignore_rewrite(v:val)')
|
||||||
|
return l:prefix . "\\(" . join(l:pats, "\\|") . "\\)"
|
||||||
|
endfu
|
||||||
|
fu s:ctrlpignore_filter(s)
|
||||||
|
" filter comments and blank lines
|
||||||
|
return match(a:s, '^\s*\(#.*\)''$') == -1
|
||||||
|
endfu
|
||||||
|
fu s:ctrlpignore_rewrite(s)
|
||||||
|
if a:s[0:0] == "^"
|
||||||
|
return "/" . a:s[1:]
|
||||||
|
else
|
||||||
|
return "/.*" . a:s
|
||||||
|
endif
|
||||||
|
endfu
|
||||||
|
try
|
||||||
|
let g:ctrlp_custom_ignore = s:gen_ctrlp_custom_ignore()
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E484/
|
||||||
|
endtry
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
out
|
out
|
||||||
|
Loading…
Reference in New Issue
Block a user