I know that plugin that can do it almost certainly exists. Or maybe I could use something like LSP for this. But I want to make my simple command, that will go to file with definition of component / function / class in JS. It's not difficult, because in JS all imports are explicitly, so I wrote this command in my .vimrc
autocmd FileType javascript nnoremap gd gd/from<CR>:noh<CR>5lgf
gd = go to definition (first occurrence of symbol)
/from = find from in this string (because string will be like "import smth from 'filename'")
:noh = remove unnecessary highlighting
5l = skip from word to move to filename
gf = go file
This works good, it goes to required file but when I return to my old file, my cursor is obviously on line with import, but I want to remain in line for example(where I run gd command), but not in import ComponentName from './path/ComponentName'(for example). I heard about :keepjump but I don't understand how can I use it there. How can I do this ?
