DEV Community

Aditya Varma
Aditya Varma

Posted on

1 2

Ctags mac Vim

Install ctags in vim using home brew
brew install ctags
I have set up this mapping in my vimrc file for the ctags

map <C-F12> :!ctags -R --exclude=.git --exclude=logs --exclude=doc . <CR>

I just press

ctrl + fn + f12

and voilla I can use

ctrl + ]

to go the definition of function in a rails project.

The above did not find do tagging for gem specific functions.
I had to add

bundle list --paths

to the above line as well.
So now I have a new mapping which is something like this

map <C-F12> :!ctags -R --exclude=.git --exclude=logs --exclude=doc . $(bundle list --paths)<CR>

Now I go to a gem specific function and type

ctrl + ]

and voila I have migrated to the gem file and now I can have a look at the gem source.

useful links: https://blog.sensible.io/2014/05/09/supercharge-your-vim-into-ide-with-ctags.html
https://andrew.stwrt.ca/posts/vim-ctags/

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay