Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stoeffel/dfd86fd956b38ef35e69 to your computer and use it in GitHub Desktop.
Save stoeffel/dfd86fd956b38ef35e69 to your computer and use it in GitHub Desktop.
javascript function text-object for vim
function! TextObjectFunction()
normal! ]}%
execute "normal ?function\<CR>"
normal! vf{%
endfunction
vnoremap af :<C-U>silent! :call TextObjectFunction()<CR>
omap af :normal vaf<CR>
@motiko
Copy link

motiko commented May 10, 2018

Hanged vim with following in status
:<C-U>silent! :call TextObjectFunction()<CR>
with following error in console:
2018-05-10 23:10:15.190 Vim[27120:3865526] *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection is invalid
Vim 8
MacVim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment