K.Wanter
K.Wanter

Reputation: 1059

emacs map key to command like vim

I set my own map :map <C-j> :tab split<CR>:exec "tjump ".expand("<cword>")<CR> in ~/.vimrc file to make ctrl + j as a shortcut to navigate to the definition, with tjump, if there is multiple match of the fuction that the cursor is on, then vim prompts to choose from all the matches, but when moving to emacs, I don't know how to do this, I google it, but did not get useful suggestions, can some veterens share how to do this?

Upvotes: 0

Views: 229

Answers (1)

jpkotta
jpkotta

Reputation: 9417

I'm not familiar with vim, but it sounds like you're asking to bind C-j to a command that will jump to the definition of the function name the cursor is on.

(global-set-key (kbd "C-j") #'xref-find-definitions)

xref-find-definitions is bound to M-. by default.

Personally, I use GNU global, and the gxref package. gxref just adds another backend to xref, so that it works with global in addition to etags.

Upvotes: 1

Related Questions