13 ms·
One with Vim
- pge 16y ago"been around since 1991"?! while that's probably correct for vim proper, that ignores the much longer history of vi...
- fredoliveira 16y agoyou are absolutely right - fixing this now. Vi has been around since the 70s, but I used the date for vim on the post - which was dumb of me.
- ez77 16y agoPlease consider bch's comment [1]. Unless you want to write quite a bit more, I believe you should actually go back to '1991' in your text. While most think that vim is indeed 'vi improved', there is a fair consensus that vim is not vi. [1] http://news.ycombinator.com/item?id=2149367 http://news.ycombinator.com/item?id=2149367
- powdahound 16y agoThe Command-T plugin [1] was a big help in switching from TextMate to vim. I have no idea how anyone can be productive in vim without it (assuming you're working on a multi-file project). 1. https://wincent.com/products/command-t https://wincent.com/products/command-t
- wccrawford 16y ago:e . or :NERDTree
- HerberthAmaral 16y agoFuzzy Finder is also very useful http://www.vim.org/scripts/script.php?script_id=1984 http://www.vim.org/scripts/script.php?script_id=1984
- albemuth 16y agonot nearly as much as command-t as it will only look for files in the current folder instead of going recursively down all folders
- moe 16y agoNot true. FuzzyFinder does search recursively. It can, in fact, search pretty much anywhere in vim (from the docs): - buffers - files - directories - most recently used files - files around most recently used files - most recently used command-lines - bookmarked files - bookmarked directories - tags - files which are included in current tagfiles - jump list - change list - buffer lines - quickfix - help
- asb 16y ago:FufCoverageFile is what you're looking for.
- stevelosh 16y agoI use NERDTree and it's not even remotely close to Command-T (or PeepOpen, which is pretty much the same thing). NERDTree is great for browsing your project and managing your files, but for opening files (when you know their names) you really can't beat the speed of Command-T/PeepOpen. They're in another league. I don't know how people work without it.
- ecaradec 16y agoI use vim project. I load all my files in the side pane, and I search with / the file I want to open. http://www.vim.org/scripts/script.php?script_id=69 http://www.vim.org/scripts/script.php?script_id=69
- jmoiron 16y agoI've been using FuzzyFileFinderTextmate for a long time. I'm not sure it's still in active development, but it's worked just fine for me; is there a reason for me to switch to Command-T? I also stick to buffers rather than tabs (for terminal/gui consistency) and use buftabs, which I quite like.
- wahnfrieden 16y agoYou should instead consider switching to the mainline FuzzyFinder instead of the FFTextmate fork. FuzzyFinder is undergoing lots of activity. You can also try using tabs to represent views of several buffers at once -- for example, I use one tab per app when working on Django code. I have the views, models, templates etc. in split buffers inside one tab.
- albemuth 16y agohe's better off switching to command-t, FuzzyFinder is pretty limited in comparison
- moe 16y agoCare to elaborate? I just glanced over the Command-T docs and it seems to be a one-trick-pony ("search in path") whereas FuzzyFinder supports a wide range of scopes (path, buffers, tags, etc.).
- ezy 16y agoI use "ectags --file-tags ..." and the ordinary tag mechanism in vim (:ts filename.c).
- swah 16y agoVim is easier on the hands, but Emacs (with ido-mode) still feels better for working with multiple files: (length (remove-if (lambda (b) (not (buffer-file-name b))) (buffer-list))) 42
- gurraman 16y agoThere are multiple similar plugins for vim.
- wahnfrieden 16y agoFuzzyFinder is great. It's no ido-mode though
- swah 16y agoThere are multiple vim emulation packages for Emacs too, it just ain't the real thing.
- anon_d 16y agoAfter I swiched to vi, I stopped feeling the need to work with multiple files; Just pop in and out of the shell.
- VMG 16y agoVim is my primary editor but I think the only really good part of vim is the keyboard navigation. The rest could be much better. For example, to this day I haven't figured out an easy, built-in way to copy from one vim window to another. I'd love to have some features of other editors have but the key bindings always hold me back.
- Sikul 16y agoHave you tried using :split and :vsplit instead of opening new windows?
- wahnfrieden 16y agoYou're not really supposed to run vim in multiple windows. Use your system pasteboard if you need to copy between them. There's probably some plugin that would make it work with yank registers though.
- njharman 16y ago> You're not really supposed to run vim in multiple windows huh? I run in 3+ windows (terminal shells) all the time and have done so for 5+ years. To cut and paste between windows I use filesystems copy and paste (select and middle click in X) Vim is flexible and you are suppose to run it however works for you.
- wahnfrieden 16y agoSure, you can -- my only point was that, as far as I know, vim doesn't really provide any help for working across multiple instances of itself.
- freakwit 16y agoselfish question here: Does anybody know how to setup vim so that :! recognises aliases? something like... set shellcmdflag=-O\ expand_aliases\ -c
- cgs1019 16y agoYour aliases are generally sourced from your shell rc file (ie ~/.bashrc). Not sure how vim launches the shell to run ex shell commands but in the interest of portability it's probably just sh with no rc files loaded. This is probably configurable. Try :help shell or :help :! (I'm not at a terminal so not sure what you'll find)
- CamT 16y agoI believe that vim sources env files rather than rc. For example, any aliases placed in my zshenv are available in vim but those in zshrc are not. I would imagine that applies to other shells as well.
- graywh 16y agoZsh always source zshenv, regardless of login/interactive options. AFAIK, Bash has no equivalent.
- graywh 16y agoBy default, Bash, Zsh, and other shells don't source the shell config when started with -c (because it's considered a non-interactive session). For Bash & Zsh, you can force .bashrc/.zshrc to load by adding -i to 'shellcmdflag'.
- Nick_C 16y agoI always start vim from within xterm (bashrc has already run and aliases are already set up). It just works. I can use :!ll (or ctrl-z and 'll' in the sub-shell) and it just works. Not sure why it wouldn't for you.
- graywh 16y agoctrl-z doesn't start a sub-shell, it backgrouns vim and returns you to the parent shell. And maybe he's running gvim or from a login shell that hasn't sourced his bashrc.
- octopus 16y agoI've used Vim successfully on Windows/Mac/Linux and you can customized it as you wish. Interesting post so 1+. As a side note the font used for the article does not render well on my Chrome browser. What are you using ? :)
- fredoliveira 16y agoreally? Damn, it should. It's Meta Pro served by Typekit. Are you on a Mac?
- octopus 16y agoI've read your post on Windows, on Mac it looks OK.
- angrycoder 16y agoWhat is the closest you can get to emacs ido mode in vim?
- bch 16y agoI'm aware I may be too pedantic, but it bothers me when people seem to completely conflate vim with vi. For example, -vi- was released in 1976, and vim not until 1991, despite what the article claims. In the meantime, I'll keep happily using nvi, and keeping the kids off my lawn. edit: links... http://en.wikipedia.org/wiki/Nvi http://en.wikipedia.org/wiki/Nvi http://en.wikipedia.org/wiki/Vi http://en.wikipedia.org/wiki/Vi http://en.wikipedia.org/wiki/Vim_%28text_editor%29 http://en.wikipedia.org/wiki/Vim_%28text_editor%29
- watchdogtimer 16y agoAnd I thought I was the only person left who still uses nvi...
- bch 16y agoNetBSD ships w/ nvi in-base. I don't have any other *BSD systems available at the moment, but according to http://en.wikipedia.org/wiki/Nvi#Credits_and_distribution http://en.wikipedia.org/wiki/Nvi#Credits_and_distribution it's the default in at least the "big 3" BSD distros (Net, Free, and Open; I don't know about DragonFly). There are more than just two of us nvi users, and we're in good company :) edit: This suggests DragonFlyBSD is nvi too, which isn't really surprising: http://leaf.dragonflybsd.org/cgi/web-man?command=vi http://leaf.dragonflybsd.org/cgi/web-man?command=vi
- tygorius 16y agoI think you're going to have to lot further than that to be too pedantic for a discussion of programming editors. As a relative latecomer to vim, I think your distinction is worthy remembering. If you didn't start with vi, it's easy to assume that all the power and cool stuff is the result of improvements and not realize how much just plain old vi could/can do.
- bch 16y agoAbout being pedantic, "going a lot further" -- being a pedant is all a cultural construct, though, isn't it? We're in a time where the lack of distinction between vim/vi is displayed so often that it's not hard to imagine a group of people looking at my original comment and saying "to hell with you, you -are- pedantic, old-school, and vim -is- vi. But better." I'm really happy there are enough people who apparently appreciate (if not fully agree with) my comment to upvote it, though. I don't care about the karma, but happy to see signs of kindred spirits :)
- georgieporgie 16y agoAm I foolish for not believing the vi/vim hype? I understand that it's been around for as long as rocks, and that it's quite handy since it's available everywhere. I use it daily, in fact, but rarely for more than basic editing. I'll just come out and say it: my favorite editor is Visual Studio. Sure, it's slow to load and rather fat now, but I'm talking solely about the editing functionality. With vim, I have to climb an amazing learning curve, regularly practicing all sorts of commands to achieve basic productivity. With VS, any command I don't recall is readily available through the menus. As I access it in the menus, I'm reminded of the keyboard shortcut, so it seems like a much more natural leaning experience to me.
- oldpatricka 16y agoI think so long as you're satisfied with your tool, you should just keep using it. If you "don't believe the hype", then doesn't just that mean that the benefits that people describe from their experience with vim/emacs/whatever aren't that important to you? If when people describe how they like being able to delete 10 lines with 10dd, or use '.' to repeat the last thing they did, and that doesn't sound interesting to you, then don't worry about it. Personally, I love vim, and have been using it for years and years, and feel hobbled without it, but if you're satisfied with your tool, and don't long for something better, stick with it.
- mcknz 16y agoFor me, vi/m is like kale -- I know it's very healthy, and I've tried it several times, but it'll be a cold day in hell before I ever eat the damn thing again.
- cryptoz 16y agoWell, you better eat some kale then. It's just barely above freezing in Hell right now, actually. Might drop below 0 sometime over the weekend I think. http://www.yr.no/place/Norway/Nord-Tr%C3%B8ndelag/Stj%C3%B8rdal/Hell/ http://www.yr.no/place/Norway/Nord-Tr%C3%B8ndelag/Stj%C3%B8r...
- NickPollard 16y ago
- curiousyogurt 16y agoOne of the features that really got me into Vim was the macros feature. I actually ran into in accidentally several times when I was first learning the basics (and couldn't get out of recording mode). But macros, and especially the temporary nature of macros, have saved me (collectively) many hours: q <macrokey> <do some stuff>; then q to stop recording. Then @<macrokey> to kick off the macro. Splendid.
- David 16y agoAs a new vim user, I'm still trying to figure out what to do with them. What do you find yourself macroing, generally?
- alinajaf 16y agoFor me the most important thing was learning to add a 'j' at the end of each macro and running it multiple times. So lets say you want to crack open an array that looks like this: $address = array( 'name' => '', 'line1' => '', 'line2' => '', 'state' => '', 'country' => '', 'postcode' => '', ); That's a lot of commas and quotes etc. Nowadays I usually punch this into vim: name line1 line2 state country postcode Then I start on the first line and record a macro that wraps that word in quotes, then appends hashrocket, quotes, comma, and then moves to the next line. Run the macro 5 times with 5@<register> and the you get your array.
- burgerbrain 16y agoIf you're a heavy macro user, you might find `:noremap <Space> @q` to be handy. Just stick your temporary macro in q (the easiest one to stick it in :), then press the spacebar to run it whenever you want.
- alinajaf 16y agoI don't meet many other vim users who like macros but recently I've had call to use them daily. They completely remove any repetitive text editing actions, even relatively complex ones like "take these words, each on a new line and make them keys to an array, with the values initialized to ''" The only problem is that they take a lot of practice before you get them right first time. After a while though, you learn to record them fairly quickly and they streamline your workflow. They also melt the faces of anyone pairing with you. The best part is they get better with age. The more vim commands you know, the more opportunities you find for using them.
- TheRealGL 16y agoWhy does every article about Vim just recently seem to promote it on the Mac to be used via MacVim? Vim does work in the terminal, and apart from tabs I can't see what MacVim is bringing to the party?
- adimitrov 16y agoNative integration, mostly. I.e. clipboard stuff and a shiny interface. Also, colors. Me, I compiled vim over ports and use it via rxvt-unicode or as gvim in an XQuartz session. That, and I run XMonad in that same session. This way, my iMac at work almost feels like a Linux machine, and I can at least get work done here (if I'm not browsing HN.)
- rimantas 16y agoLet me share what I stumbled upon yesterday: https://github.com/carlhuda/janus https://github.com/carlhuda/janus
- husted 16y agoI've tried to use vim for a while but I've given up pretty quickly. Yes I'm aware that the learning curve for any new editor is steep but that's not why I've given up on vim. I do all my source code editing in a Windows environment and my choice of editor is Source Insight[1]. I haven't found any editor that allows me to navigate the source three so elegant and fast. I only do embedded development so I can't speak for it's abilities outside C. [1] http://www.sourceinsight.com http://www.sourceinsight.com
- zby 16y agoI am waiting for the retro-fashion to go back to ed (http://www.gnu.org/fun/jokes/ed.msg.html http://www.gnu.org/fun/jokes/ed.msg.html).