Skip to content

Instantly share code, notes, and snippets.

@kawarimidoll
Created September 11, 2022 06:50
Show Gist options
  • Save kawarimidoll/5d5663f23f8ebfaecbedb61e47884ef3 to your computer and use it in GitHub Desktop.
Save kawarimidoll/5d5663f23f8ebfaecbedb61e47884ef3 to your computer and use it in GitHub Desktop.
get function call or property under current cursor position that chained by dots
let col = getcurpos('.')[2]
let line = getline('.')
let pre = substitute(line[:col-1], '^.*[^0-9A-Za-z_.]', '', '')
let post = substitute(line[col:], '[^0-9A-Za-z_.].*$', '', '')
echo pre .. post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment