~gpanders/dotfiles

ref: c8e63bac959db19c138dcc3198a56514f0b444ff dotfiles/.vim/autoload/cmdline.vim -rw-r--r-- 474 bytes
c8e63bacGreg Anders Manage dotfiles directly in home directory 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let s:expandable = '\v^([%#$]|<(cfile|cword|cWORD|cexpr)>)'

function! s:expand(cmdline) abort
    let tokens = split(a:cmdline)
    let tokens[-1] = expand(tokens[-1])
    return join(tokens)
endfunction

function! cmdline#expand(trigger) abort
    let cmdline = getcmdline()[0:getcmdpos()-1]
    if getcmdtype() ==# ':' && split(cmdline)[-1] =~# s:expandable
        return "\<C-\>e'" . s:expand(cmdline) . "'\<CR>"
    else
        return a:trigger
    endif
endfunction