Last active
August 29, 2015 14:24
-
-
Save dahu/2019325d14871dbc3a23 to your computer and use it in GitHub Desktop.
Echo Bash Alias beneath cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Echo Bash Alias beneath cursor | |
" Barry Arthur, July 2015 | |
let aliases = {} | |
for a in split(system('/bin/bash -ic alias'), '\n') | |
let [k,v] = matchlist(a, 'alias \(\S\+\)=\(.*\)')[1:2] | |
call extend(aliases, {k : v}) | |
endfor | |
function! EchoAlias() | |
let w = expand('<cword>') | |
if has_key(g:aliases, w) | |
echom 'alias ' . w . '=' . g:aliases[w] | |
endif | |
endfunction | |
augroup EchoAlias | |
au! | |
au CursorMoved,CursorHold * call EchoAlias() | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment