Settings

Theme

Ask HN: How to improve vim productivity and workflow?

8 points by shincert 9 years ago · 6 comments · 1 min read


I only need my .bashrc and .vimrc with me on a UNIX machine to get around. It makes me feel all warm and fuzzy inside because it's so minimal and portable. I love it.

But I have not mastered vim yet. In particular, going back and forth between files and directories is really cumbersome in larger, more complex projects. When time is critical in a project I just install Atom or something with a sidebar (it makes a huge difference to me) and move on with my life.

I want to improve. Specifically, how can I productively edit multiple files simultaneously in a larger codebase? Should I use tmux panes and windows? Or vim split views? Should I use a sidebar plugin for vim? Any other workflow tips?

Should I even use vim at all? Why bother?

yefim 9 years ago

Different strokes for different folks but I really love vim split views. I have Ctrl-h, Ctrl-j, Ctrl-k, and Ctrl-l mapped to navigate between my splits with ease as well as using the vim plugin Golden Ratio[1] to make the current focused split larger than the rest. If you really need the tree view, I've heard great things about NERD Tree[2]. Feel free to check out my .vimrc[3] for other neat tricks and plugins :)

[1] https://github.com/roman/golden-ratio

[2] https://github.com/scrooloose/nerdtree

[3] https://github.com/yefim/dotfiles/blob/master/.vimrc

vanboxel 9 years ago

I really enjoy vim tabs for multiple files. Especially if I don't need to see all of them at once, but just quickly switch between them. `:tabnew foo.txt` to open another file, then `gt` to go to the next tab and `gT` to go back.

If you work interactively with data, you might also enjoy Slimux (https://github.com/epeli/slimux), a vim plugin that allows you to send lines from vim to an arbitrary tmux pane. I usually have IPython running in such a pane so I never have to copy+paste. I've got an ebook I've been kicking around describing this workflow in more detail here (http://dvbuntu.github.io/compute/posts/2050/01/01/workflow.h...).

jneumann004 9 years ago

Use the editor that works best for you. I have used Vim every day for almost the last two years and I have learned to work very quickly inside of it.

As far as plugins, if one sounds interesting or useful to you, install it. If it doesn't work out, then you can delete it later. Over the years I have tried all of the popular plugins, but I have managed to whittle it down to 4 plus a couple of language specific plugins

Here are a couple of handy youtube videos Vim Navigation Commands https://www.youtube.com/watch?v=Qem8cpbJeYc How to Do 90% of What Plugins Do (With Just Vim) https://www.youtube.com/watch?v=XA2WjJbmmoM&t=3477s

vkdir 9 years ago

Vrapper (http://vrapper.sourceforge.net/documentation/) lets you use Vim inside of the Eclipse IDE.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection