15 ms·
Vim After 11 Years (2013)
- snarfy 12y agoThe author mentions a lack of good smart completion, but if you use C# there is omnisharp, which works quite well. https://github.com/OmniSharp/omnisharp-vim https://github.com/OmniSharp/omnisharp-vim
- shocks 12y agoWhy do you advocate using vim in a terminal? I prefer unite[1] to ctrl-p[2], it's much more flexible. 1: https://github.com/Shougo/unite.vim https://github.com/Shougo/unite.vim 2: https://github.com/kien/ctrlp.vim https://github.com/kien/ctrlp.vim
- wahnfrieden 12y agoI wanted to like unite, but couldn't get it to behave as I expected: when opening a file via unite, it doesn't respect the active window, it ignores the splits I have. IIRC it always opened the file in the top left window.
- shocks 12y agoThat's weird. Unite doesn't exhibit this behaviour for me. My config is here: https://github.com/wridgers/vimto/blob/master/rc/25-unite.vim https://github.com/wridgers/vimto/blob/master/rc/25-unite.vi...
- wahnfrieden 12y agoThanks, will give it another shot with your config.
- swartkrans 12y agoI also prefer cntrlp, it's much more performant in my experience.
- sooheon 12y agoThis is true (something like junegunn's fzf is even faster than either), but I think the tradeoff is between performance and consistency of interface. Unite can provide the same interactions for recent files, buffers, file navigation, grep results, etc.
- tomjakubowski 12y agoYou can do this with ctrlp too. The standard sources are files, buffer, and MRU files, but it comes with extensions for things like the quickfix list (grep results), tags, and scripts in the runtime path. You can also write your own: https://github.com/kien/ctrlp.vim/tree/extensions https://github.com/kien/ctrlp.vim/tree/extensions
- shocks 12y agoReally? With unite you can use vimproc to fork out the searching process. Much quicker. Using unite and ctrlp with a 30k file source base, ctrlp was far to slow for me.
- to3m 12y agoApropos of nothing in particular: a good way of spotting vim hipsters is that they don't know what ; does, because they never used t or f. They do however very carefully use hjkl to move around, because the cursor keys are for squares ;)
- gfodor 12y agoEh, I've been using vim for 15 years and find it incredibly rare to repeat t or f's. Usually they're one-offs.
- yen223 12y agoExactly. The gain from remapping ':' to ';' far outweighs the losses from not being able to repeat finds
- fensipens 12y agoEh, I've been using vi{,m} for 15 years too and I `ftFT;,' things on a daily basis. Remove two `a' characters of the current line: fax;. Note: no mode change necessary Also, line editing in /bin/{,k,ba}sh -o vi without `ftFT;,' is a pain.
- function_seven 12y agoI remapped ; a long time ago (to ":", because I can't be bothered to hold down the shift key) because I rarely need to repeat a t/T/f/F motion. I typically already know how many times I need to invoke it (and use "3f)" for example), or I use a quick "/" followed by a couple of letters in the word I want to jump to.
- hrjet 12y agoThat's a great idea; never thought of it before. The only worry is that it is not going to work on remote systems out of the box, confusing my muscle memory.
- function_seven 12y ago
- pmoriarty 12y ago"It’s so useful that I’ve bound it to ; (and nobody remembers what ; does anyway)." The original binding of ; is super useful, and I would argue it should not be rebound. ; repeats the last f, t, F or T command. There's also , which is the same as ; but in the opposite direction.
- sooheon 12y agoI agree. I initially found many recommendations to bind "," as leader, and it was convenient, but after learning what ";" and "," do, I've changed my leader to <space>.
- pmoriarty 12y agoSPACE is good as leader, and also as : But I've found it to be most useful as page-down (with BACKSPACE as page-up).
- deckiedan 12y agoI'm also using <space> as my leader. In case anyone else wants to try it, and struggles to make it work, I had to do the following to make it work: map <space> <leader> rather than simply setting mapleader to space directly. If someone else knows why, I'd be interested to know!
- lucb1e 12y agoWhat's a leader? Googling some, it seems to mean a backslash in the vimrc... but I don't really understand what you mean.
- tsm 12y agoIt's a way of namespacing commands—if you install NERDCommenter, for example, <leader>cc comments out the current line (whereas cc by itself changes the current line). It's traditionally bound to backspace, which is actually-free, but many people bind it to keys that are free but never used personally.
- lucb1e 12y ago
- btipling 12y agoI'd add to that to try and start using neovim. I've switched to it on Mac without a hitch and we (Floobits) have already moved our vim plugin to use the new neovim python-client plugin for much better async behavior. Making an async plugin for NeoVim is pretty trivial, here's a clock in your status bar: https://gist.github.com/btipling/0d6faa80b24ccee5caea https://gist.github.com/btipling/0d6faa80b24ccee5caea Note this requires +python, :he nvim-python for how to get that (involves pip install neovim) You can't do something like this clock in vim without the feed keys cursorhold hack that breaks using leader keys. Otherwise I'm still using vundle and have made 0 changes in my .vimrc other than move it all to .nvim and .nvimrc. All my plugins and vundle worked out of the box.
- sooheon 12y agoI had put neovim out of mind and settled for emacs/evil, but seeing an actual use case for the new plugin system makes me hopeful for it's fast growth and adoption.
- tuhdo 12y agoImagine that one day you want to use 10 plugins and have to setup all 10 language environments to use those plugins, and you have to set the whole thing on Windows...
- sooheon 12y agoYou make a good point, and maybe nvim's decision to open up plugin languages will come back to bite it in the ass. It is a form of fragmentation in a sense, but I'm hoping the benefits will outweigh the drawbacks.
- teacup50 12y agoRemember that floobits are the people that threw a tantrum when upstream vim wouldn't accept their patches, and have a vested ego interest in pushing a vim fork.
- 12y ago
- eridius 12y agoWhy is iTerm2 being suggested for OS X when the built-in Terminal.app also supports 256 colors? Also, I find MacVim to be a better experience than Vim in the terminal.
- swartkrans 12y agoI also prefer using the terminal, but I've switched to neovim anyway. I found macvim to be difficult to configure and I just prefer having tmux terminal splits next to my vim split and I can see stuff happening as I edit the file. I also prefer iTerm2 to Terminal.app but I think it's just personal preference. I know how to use the iTerm2 settings pretty well by now to get configurations I want.
- ChristianBundy 12y agoiTerm 2 has way more options than Terminal.app, my favorite being the ability to set your color scheme.
- yen223 12y agoThe killer feature for me is Hotkey Windows - I set it up so that pressing Ctrl+Space from anywhere will slide out a terminal. So convenient. http://apple.stackexchange.com/questions/48796/iterm-as-a-slide-out-terminal-from-the-top-of-the-screen http://apple.stackexchange.com/questions/48796/iterm-as-a-sl...
- klmr 12y agoTo be fair, you can do the same for iTerm (or any application, really) by using other tools. Quicksilver, for instance, allows you to define system-wide hotkeys.
- eridius 12y agoTerminal.app has had color schemes since forever.
- bwilliams 12y agoFor me it's definitely mouse reporting. If my hand is already on the mouse I really like clicking tmux panes. Sometimes it's also easier to just scroll with a trackpad too. iTerm lets you do this, but Terminal.app doesn't.
- TheDong 12y agoAnother person who recommends pathogen... There's multiple better plugin managers now including Neobundle and vundle... I find neobundle to be unquestionably superior and well worth using.
- krick 12y agoThey aren't "better" and most of pathogen users are well aware of them. I don't think they are bad enough to discourage anyone from using them if it woks for him, but when asked I'm always recommending pathogen as the only option, which I'm using myself. Why? Well, there could be multiple answers, but essentially there's one main reason: it's just dead simple, while vundle and other ruby-inspired ones are not. Pretty much for the same reason I like pathogen+git thousand times more than emacs' package manager. So even if it could be arguable that pathogen is better than vundle, there's completely no reason not to advise it.
- jqm 12y agoJust curiously, what do you find superior? pathogen loads the plugins which is all I need. Does Neobundle do something else?
- TheDong 12y agoHere's a vimrc that showcases some of its features: https://github.com/bling/dotvim/blob/master/vimrc#L324 https://github.com/bling/dotvim/blob/master/vimrc#L324 Pathogen loads plugins, but it doesn't manage them. Neobundle lets me list some plugins in my vimrc and it'll take care of installing them, updating them, and even only loading them on filetypes where they're useful. Pathogen does none of that and I find every one of those features useful. One of the big ones, honestly, is just the simplicity of listing a new bundle in my vimrc, syncing it to all computers, and having it deal with getting it. Much better than syncing large git repos across computers.
- 9diov 12y agoThere is a new one coming out recently called vim-plug: https://github.com/junegunn/vim-plug/ https://github.com/junegunn/vim-plug/ The major feature is that it can install plugins in parallel. I've switched from vundle to it and have been quite happy.
- agersant 12y agoI have a hard time understanding vim users. All the cool features listed in this article exist in any modern text editor. I personally use Notepad++, but I'm sure the same goes for Textmate, Sublime Text and many others. The only advantage I can see in Vim over a modern solution is that it runs in the terminal (which I guess is useful if you like to remotely modify files in your production environment?). Is it that after they have spent so many years learning the arcane controls, users feel obligated to stick with it in order to justify all the time they've already invested? I must say I've only spent ~2 months of my life using vim before giving up, which I think is already pretty long for an evaluation. I have never experienced or even witnessed the productivity gains you're supposed to get from mastering vim. All I've seen is very unintuitive shortcuts for Ctrl+Backspace advertised as unique features in the world of text editing. I would be very happy if someone could point out to me the elephant that I am not seeing here.
- Alupis 12y ago> I personally use Notepad++ Vim is a Linux/Unix text editor used via the terminal. Notepad++ is for the Windows GUI environment. Apples and Oranges. Why is a good terminal text editor important? When you are SSH'ed into your server and you need to adjust a configuration file, you require a good terminal text editor. It also is very good for C programming, and a lot of C programmers use it extensively. There are many other reasons. From a Windows GUI environment, you won't really be able to compare or relate, or understand why vim is so good.
- cageface 12y agoI know Vim well enough to use it for this kind of thing but, IMO, if you find yourself doing a lot of hot edits on live servers you're doing it wrong. Almost all of the editing I do is in a consistent environment on my development machine and I don't see the point of using a lowest-common-denominator tool when I don't have to. I'm sure with some work you can bend Vim into something approaching the power of an IDE but why would you bother? Text editing is a pretty small part of the work of development, after all.
- 12y ago
- krick 12y ago> backslash isn’t bound to anything by default Actually it is. That thing is called "leader" and is used exactly for the same purpose as author uses backslash. So better way to write :nmap \o :set paste!<CR> would be :nmap <leader>o :set paste!<CR> Reasons to use "leader" are discussed more than once, so I'll leave reading the docs/blogposts to you.
- krick 12y ago> Emacs has a useful mode which highlights hexidecimal colors in CSS and SASS There's plugin for it in vim. Even several of them, as always. I don't remember which one I used and if it was completely ok, but I can find https://github.com/skammer/vim-css-color https://github.com/skammer/vim-css-color right away.
- tuhdo 12y agoEmacs can highlight colors in ANY text buffer if you activate it.
- krick 12y agoThere're things I agree or disagree on with author (for example, I still have NerdTree installed, but find myself almost never using it, instead I use tree -f in separate terminal window) but probably only one thing I'm still not sure about: I don't use buffers explicitly at all, only tabs instead, like in any IDE. Sometimes vsplit. I even have custom mappings for ctags to open stuff in new tabs instead of buffers. I treat hidden buffers as legacy needed mostly for technical reasons. Yet I keep seeing other people using multiple buffers, switching between them. So, should I reconsider, maybe? And why?
- fsloth 12y agoI used tabs, but nowadays I don't seem to need them. One day I thought I could try if I could survive by just using buffers, and apparently I do. Might depend on the way you want to navigate the project and so on. For me personally the most common buffer switch is between two or three documents at a time and for those needs split windows are absolutely the best for me (which removes any needs for tabs, naturally).
- alanning 12y agoThe switch to tabs for me came after I started using vimperator/pentadactyl in my web browser, which I find glorious. (Sorry no links, on mobile) I used "lusty juggler" before but 'gt' is a very natural way for me to "go tab" now and I like it better. Macvim makes it trivial for me to arrange tabs in a consistent order, for example html file to the left of its js file. The tabs also give me a kind of quick view of what my current "project space" is. Two tab-y things that I find useful are: * alias "vi -p" (to open files in tabs) * "vi --remote-tab" (to add a file to an existing session in a new tab from the command line) Part of why I like tabs may be because I don't do split windows often in vim. When I want to have two files side-by-side I use my os window manager (CMD+right to move current window to right side of screen, etc).
- deleted 12y ago[deleted]
- virtualwhys 12y agoI've found split windows and buffers in vanilla vim to be somewhat lacking -- CtrlSpace [1] and GoldenView [2] plugins are truly awesome enhancements. The latter I wish I could have at the OS level, just incredibly efficient usage of screen real estate, and the former makes buffer management a breeze. [1] https://github.com/szw/vim-ctrlspace https://github.com/szw/vim-ctrlspace [2] https://github.com/zhaocai/GoldenView.Vim https://github.com/zhaocai/GoldenView.Vim
- e12e 12y agoNot familiar with goldenview - but it looks like something similar could be achieved with eg xmonad? Or are you not using Xorg and a tiling wm?
- virtualwhys 12y agoI do use a tiling WM, just not Xmonad ;-) With i3[1] you get split windows out of the box, but the splits are fixed by 1/2s (kind of a Russian Doll box model) that you can then incrementally resize via hotkey by some percentage of your choosing. That's different than GoldenView which automatically gives the focused window the lion's share of screen real estate, thus providing a kind of distraction free mode with the added ergonomic benefit of not having to crane one's neck to left and right when working with split windows on a 27" monitor. Maybe Xmonad, Awesome, and other highly programmable TWMs provide such functionality (or are trivial to pull off), although haven't heard mention of it (spent a couple of months with Awesome before switching to i3). [1] http://i3wm.org/screenshots/ http://i3wm.org/screenshots/
- e12e 12y agoRight. I generally just make do with fewer windows (typically Firefox with a gazillion tabs w/vimperator, and a terminal or two, each running screen with a few screens) -- so I rarely need to do much jockying around with windows. A little more shifting around on my laptop (14"), a little more on my desktop (20"@2048x1152). I can see the need for more windows on a 27" (or 30") though. Maybe xmonad with "Spiral" or "Spiral Golden Ratio" does something similar (although probably not quite the same)? https://www.haskell.org/haskellwiki/Xmonad/Screenshots https://www.haskell.org/haskellwiki/Xmonad/Screenshots Generally I just use a standard tiled layout, with 2/3 of the screen for the "main" window (vertical split, works best on a 16:9/16:10 display), and bring witch ever window I want there with alt+enter. But then, I find that things that change "automatically" end up being distracting (eg: relative line numbers in vim) -- so odds are we just have different preferences.
- Gonzih 12y agoIn my experience nerdtree is bad. You loose a lot of goodnes that splits can offer you. Netrw or netrw+vinegar is more vim friendly way to do file navigation.
- statico 12y agoThanks for reading! Don't forget to check out the follow-up to this article, "Everything I Missed in Vim After 11 Years" - http://statico.github.io/vim2.html http://statico.github.io/vim2.html