Skip to content

Instantly share code, notes, and snippets.

@dahu
Last active August 29, 2015 14:24
Show Gist options
  • Save dahu/2019325d14871dbc3a23 to your computer and use it in GitHub Desktop.
Save dahu/2019325d14871dbc3a23 to your computer and use it in GitHub Desktop.
Echo Bash Alias beneath cursor
" 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