Live data from Hacker News

Vim After 11 Years

statico.github.com

151–160 of 254 posts

Re: Vim After 11 Years

#151
post #120

Can vim do the following? I'm editing some project with 10000 C++ files. There is some C++ file I currently don't have open, say "palette.cpp" which is in a subdirectory "project/graphics/algorithms/color/". Now I want to open palette.cpp without ever having to type, not even with tab autocompletion, that path. IntelliJ (which I do use for C++ ;)) can do this easily: just press CTRL+R, then palette.cpp, ENTER, and th…

> IntelliJ (which I do use for C++ ;)) If I may ask, how do you use it? The C/C++ plugin was unusable, last time I tried it.

The C++ plugin is totally unusable and I uninstalled it immediately after trying.

But I just made a manual set of syntax highlighting rules for C++, and that's good enough for me.

The git integration and other IntelliJ features make up for the missing C++ navigation and refactoring features for me.

I do everything related to compiling, debugging, and stuff (as well as all git committing and stuff, the IntelliJ git integration is about showing changed lines) from a terminal.

Re: Vim After 11 Years

#152
I can recommend CtrlP (or Command-T). I can't imagine navigating in a project without them. They also have great buffer navigation. Personally I mapped t to CtrlP file search, and b to CtrlP buffer search (:CtrlPBuffer).

Re: Vim After 11 Years

#153
post #64

Earlier quoted context omitted.

Here are few things how I use it: - scrolling with a mouse wheel - selecting/resizing a split window - jumping to a specific place in the code - making a selection

All of that can be done much more efficiently without the mouse: - scrolling with a mouse wheel :h scroll.txt - selecting/resizing a split window :h window-resize :h window-move-cursor - jumping to a specific place in the code /foo or the myriad of cool things in :h motion.txt - making a selection v{motion}

>All of that can be done much more efficiently without the mouse

No. All this can be made with an extra cognitive overload provided by the use of keyboard shortcuts that makes you think you're doing something useful and/or faster than with the mouse.

Especially if you don't need to have your hand at the keyboard at all times (i.e you're just browsing code and not writing), scrolling with the mouse is way faster.

Re: Vim After 11 Years

#154
post #124

netrw comes by default. No need to install NERDTree.

One thing NERDTree does that netrw doesn't (IIRC, haven't looked very deeply into this) is open files you select in a different window than the one that contains the file listing. I happen to find that convenient, YMMV, of course.

o does that. :h netrw-browse-maps

Re: Vim After 11 Years

#155
post #80

My single greatest tip to make vim even more amazing is to run it in a tmux session: It makes it super easy to split panes and create new windows for related things you need to do (git stuff, compilation, running tests, running a REPL, etc.)

For anyone using tmux and vim, I recommend having a look at vimux (https://github.com/benmills/vimux). It lets you control your tmux pane from within vim.

I use two tmux windows, one of each of my screens. One is code and the other runs `make && ./test blah blah` whenever I hit F5 in vim. To get vimux to use windows (as opposed to just panes) there's a fork under pull requests (disclaimer: I wrote it).

Re: Vim After 11 Years

#156

Earlier quoted context omitted.

All of that can be done much more efficiently without the mouse: - scrolling with a mouse wheel :h scroll.txt - selecting/resizing a split window :h window-resize :h window-move-cursor - jumping to a specific place in the code /foo or the myriad of cool things in :h motion.txt - making a selection v{motion}

> All of that can be done much more efficiently without the mouse No. All this can be made with an extra cognitive overload provided by the use of keyboard shortcuts that makes you think you're doing something useful and/or faster than with the mouse. Especially if you don't need to have your hand at the keyboard at all times (i.e you're just browsing code and not writing), scrolling with the mouse is way faster.

Keyboard shortcuts give me precision and efficiency, not speed, and that cognitive overload you talk about is a small price to pay.

Re: Vim After 11 Years

#157
post #74
post #19

Earlier quoted context omitted.

I personally enjoy being able to split panes vertically with iTerm2

Indeed. iTerm2 has replaced tmux for me for local development.

Why not both? http://code.google.com/p/iterm2/wiki/TmuxIntegration

iTerm2 can intelligently communicate with tmux in order to present splits and windows are handled by iTerm2, rather than within the single terminal window.

Re: Vim After 11 Years

#158
post #79
post #9

Why do people keep suggesting iTerm2? The built-in terminal app on the Mac does Unicode and 256 colors just fine.

The "step back in time" feature is sort of gimmicky, but does mean you can rewind even Curses terminal applications. Rarely actually useful, but it has saved me a huge amount of hassle a few times.

Vim also has history via the undo-branches feature. e.g. ":earlier 15m" to go back 15 minutes.

Re: Vim After 11 Years

#159
post #39

The author mentioned CtrlP for fuzzy filename matching. Its great because it's in pure Vimscript, but in my experience it becomes unusably slow for moderately sized projects. A month or two ago, I switched back to CommandT (requires Vim to be compiled with Ruby support, engine written in C) and haven't thought twice about it since then.

I have a repo with 3000+ files and I can't notice any delay searching with CtrlP. I have the following custom file listing command in my vimrc: let g:ctrlp_user_command = { \ 'types': { \ 1: ['.git/', 'cd %s && git ls-files'], \ 2: ['.hg/', 'hg --cwd %s locate -I .'], \ }, \ 'fallback': 'find %s -type f' \ }

It's fine with many files, the only issue is when it indexes, which can't easily be automated. I just checked and it gets through about 2000 files a second on my MBP.

Re: Vim After 11 Years

#160

Can vim do the following? I'm editing some project with 10000 C++ files. There is some C++ file I currently don't have open, say "palette.cpp" which is in a subdirectory "project/graphics/algorithms/color/". Now I want to open palette.cpp without ever having to type, not even with tab autocompletion, that path. IntelliJ (which I do use for C++ ;)) can do this easily: just press CTRL+R, then palette.cpp, ENTER, and th…

I have vim as my EDITOR, then cscope does this and more.
Post reply on HN