-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathccr.vim
19 lines (18 loc) · 1.01 KB
/
ccr.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
" Author: romainl on #vim
cnoremap <expr> <CR> <SID>CCR()
function! s:CCR()
command! -bar Z silent set more|delcommand Z
if getcmdtype() == ":"
let cmdline = getcmdline()
if cmdline =~ '\v\C^(dli|il)' | return "\<CR>:" . cmdline[0] . "jump " . split(cmdline, " ")[1] . "\<S-Left>\<Left>\<Left>"
elseif cmdline =~ '\v\C^(cli|lli)' | return "\<CR>:silent " . repeat(cmdline[0], 2) . "\<Space>"
elseif cmdline =~ '\C^changes' | set nomore | return "\<CR>:Z|norm! g;\<S-Left>"
elseif cmdline =~ '\C^ju' | set nomore | return "\<CR>:Z|norm! \<C-o>\<S-Left>"
elseif cmdline =~ '\v\C(#|nu|num|numb|numbe|number)$' | return "\<CR>:"
elseif cmdline =~ '\C^ol' | set nomore | return "\<CR>:Z|e #<"
elseif cmdline =~ '\v\C^(ls|files|buffers)' | return "\<CR>:b"
elseif cmdline =~ '\C^marks' | return "\<CR>:norm! `"
elseif cmdline =~ '\C^undol' | return "\<CR>:u "
else | return "\<CR>" | endif
else | return "\<CR>" | endif
endfunction