Vim: To Config or Not to Config?

Chris joins Joe to discuss Vim configuration. Do you customize? Do you change? Do you extend? Learn how most of Vim's power comes from Vi, and how you can embrace that power rather than fighting it to become a more efficient editor. Your problem...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/vim-to-config-or-not-to-config
1 Like

@christoomey, I still donā€™t use it because itā€™s terribly slow to run RSpec, but I have been fairly impressed by the vim-mode implementation in Githubā€™s Atom editor. I havenā€™t had trouble moving around and editing text the couple times I gave it a try.

Iā€™ll certainly agree that Vim emulation seems to be improving as the years go on. Recently Iā€™ve been very impressed by wasavi which is a ā€œVi editor for any web pageā€.

None the less, I still find that all emulations fall short at some point and thus I stick with Vim. Modal editing is hard thing to nail when itā€™s not the primary feature.

1 Like

Switching to vim took me months to learn it, and another few months to learn how to configure it well. Now, I canā€™t use any other editors. I would love to watch a live demo of how thoughtbot developers pair program with vim and tmux working on a project.

Please note that the link to Vim Dispatch from the Notes section of the video points elsewhere (actually goes to vim-rspec) so youā€™d maybe want to fix that.

Great video as always. I have a question regarding debugging. At the moment Iā€™m using pry with a abbreviation command to put a break point and then as Iā€™m using Vim-Conque for using an interactive shell then I can just go ahead and use the navigations commands in pry. The thing is that most of the time that script is a little bit buggy and normally I go to a terminal and do the debugging there. So I was wondering how do you setup vim to do such thing.

Thanks in advance,

Good to know, I have yet to switch to VIM at work, but only using it for my small projects and koans. I plan to completely switch during the holiday break. I feel like I can navigate single files well, just donā€™t know some of the key workflow shortcuts, like command p was new for me when I watch this video.

I am unfortunately the :e . people, but not anymore :smile:

Tim Popeā€™s vim-unimpaired and vim-vinegar are also really useful for jumping around files. You can use unimpairedā€™s [f and ]f to jump to adjacent files in the same folder (useful if youā€™re trying to move sequentially through a folder.

vinegar maps the minus key to jump out to a file view of the folder of the file youā€™re currently looking at which can be useful if youā€™re source-diving and want to get the lay of the land.

1 Like

Oh great I didnā€™t realise there were those [f and ]f mappings! Guess I should read the documentation.

I never found movement in vim overly difficult. I wonder if my initial comfort came from being a pc gamer (mostly shooters) where a lot of movement is done with the ā€œwasdā€ keys on the keyboad?

1 Like

The docs on Tim Popeā€™s plugins are generally very good. I had the keystroke guide from vim-unimpaired as a cheat sheet above my desk for three months. There are some other great ones like jumping through merge conflicts that I also love to use.

I am 2 weeks into now and find myself always adding new things to my .vimrc to improve my workflow. What are some other plugins people are using that they canā€™t live without?

@brianllamar, a few Iā€™ve started using recently that I really like:

  • bogado/file-line lets you append a line number to the end of a file to open directly to there. Nice if you run a spec or analysis tool and want to jump right to the problem.
  • jgdavey/vim-blockle easy toggling of Ruby { } and do end blocks, it moves from single-line to multiline really nicely. I have this mapped to a leader.
  • gorodinskiy/vim-coloresque highlights CSS colors in your files so you can see them easily. Results may vary
  • kristijanhusak/vim-multiple-cursors This plugin is a fork of a popular plugin that has not been maintained recently, it seems to work a bit better. Lets you select multiple places in ways that would be hard in visual mode and then edit them in place using normal/insert mode rather than the command line substitution
  • othree/eregex.vim has a handle command and toggle to switch between using Vim-style and Ruby/Perl-style regular expressions for search in a way that doesnā€™t seem to break other plugins and macros. One of my things to work on is to do more substitution rather than editing more than one thing, and using Ruby-ish regex helps me just worry about learning one thing rather than struggling with Vimā€™s odd regex and thinking about how to phrase my substitution.

Hope this helps! Interested in what plugins other folks are using. I just did a winter cleaning and culled the plugins I had that werenā€™t getting much use.

2 Likes

I love dash.vim paired with dash app. I have it configured to look up documentation for the method under my cursor. Itā€™s great for keeping me from context switching. Ultisnips is great for text expansion and I use vundle to install all my plugins.

Check out the sites usevim.com and vimawesome.com.