1. 15

  2. 7

    I was bothered by “I still use Vim in 2015 as my primary text editor”, not because Vim is bad, but because it feels apologetic. Lots of developers still use Vim–prefer it, even, over everything else. Don’t ever apologize for a preference.

    As for the rest of the article, this is very neat. Automated, autoupdating tags is somethi g Ive always wanted in emacs.

    1. 1

      That was actually a kind of ironic/sarcastic. :) But anyway, I decided to remove it, thanks.

    2. 2

      Say you open a project within NERDtree. What’s the best way to search and find a function named “CABOOM”? I can use ctrl+p for filename search. But to find a function I need to “:%!grep pattern” … is there any other/better way?!

      1. 7

        The CtrlP plugin also supports searching for tags, with the :CtrlPTag command. There’s a faster way to access it than running that command, though. Just type <c-p> like usual, then type <c-f> and <c-b> to scroll through the available search scopes in the bottom left until “tag” is selected. If you don’t see it, you may need to enable it first – see :help ctrlp-extensions.

        If you don’t have tags set up for the current project, you can use what I usually use – the search program ag with a plugin and a custom mapping. It’s like your grep example, but faster to run and more convenient.

        First, install ag (“the silver searcher”) and the rking/ag.vim plugin. Then add the following custom mappings to your vimrc. The first, bound to <Leader>/, pre-fills the command area with “:Ag ''”, which lets you immediately start typing a regex to search for project-wide. The other two custom mappings do a project-wide search for the current word or the current visual selection.

        " search the whole project easily
        nnoremap <Leader>/ :Ag ''<Left>
        " search for the current word or selection in the whole project
        " (° is <A-*> on Mac; neither <A-*> nor <S-A-8> work for some reason)
        nnoremap °    :Ag '\b<C-R>=expand("<cword>")<CR>\b'<CR>
        xnoremap ° "sy:Ag '<C-R>s'<CR>
        1. 1

          Holy crap, mega +1 for the CtrlP tip.