TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Coming Home to Vim

204 pointsby PopaLalmost 13 years ago

22 comments

genbattlealmost 13 years ago
I took the dive into Vim about a year ago. I was at the stage where I'd become proficient with some command-line tools in Linux, but I didn't yet have an editor I could use fluently from the command line. I tried out both Vim and Emacs, and found Vim to be slightly easier to grok, plus my pinkie got kind of sore from holding down the Ctrl key in Emacs.<p>I changed my default editor at work to be Vim, and started doing all my dev work at home through Vim. I started off just using the arrow keys to move and just using insert mode to edit text the normal way. Each day I tried to add one new command to my repertoire; I learned about how to structure vim commands (c-change i-in w-word, etc.) and move using hjkl and the higher order movement commands like w and b. Now I can maneuver my way around vim quite confidently, and although when I started off I was much slower in Vim than other editors, I now find that Vim is just as fast or faster for most tasks, particularly where I can make use of Macros.<p>At the moment I still have to get my head around markers and a few other concepts, but I've definitely become proficient enough for it to be worth the effort and time invested so far.<p>My tips for anyone learning to use vim for everyday development would be some common tab commands: :tabnew &#60;path&#62; to open a file in a new tab, :tab sball to show all currently open buffers in separate tabs, gt and gT to jump to the next/previous tabs.
评论 #4220673 未加载
zaptheimpaleralmost 13 years ago
Wow, the bit about seeing vim commands as sentences composed of nouns, verbs and adjectives blew my mind. I thought about learning vim, but I didn't know about this, so vim commands seemed like some arcane language that I would have to gradually get proficient at over months.. this might make the transition a lot easier.
评论 #4219581 未加载
评论 #4219162 未加载
评论 #4219331 未加载
borplkalmost 13 years ago
I'm a hardcore nerd and I spend many hours with a text editor during the day. Yet I find vim beyond my nerd level. I just can't be bothered with fiddling with config files and installing little bundles and packages for every functionality.<p>On top of that the whole "language of editing" and combining noun,verb,adjective commands, etc... doesn't really appeal to me because I'm too visual when I'm editing code. I can't stop to think about the right semantics about what I want to do, I just do it visually.
评论 #4219268 未加载
评论 #4219682 未加载
评论 #4219495 未加载
评论 #4219654 未加载
评论 #4219846 未加载
评论 #4220163 未加载
tolosalmost 13 years ago
I'm skeptical that Ack is "far, far better than grep." Different? Ok. Better? Maybe, based on what you're doing. Far, far better? Probably not. Omitting correct results because a file extension isn't white-listed sounds like a pain.<p><a href="http://superuser.com/questions/39384/best-grep-like-tool/342803#342803" rel="nofollow">http://superuser.com/questions/39384/best-grep-like-tool/342...</a>
评论 #4219475 未加载
评论 #4221915 未加载
评论 #4223445 未加载
mattkirmanalmost 13 years ago
Original discussion from a couple of years ago can be found here <a href="http://news.ycombinator.com/item?id=1710702" rel="nofollow">http://news.ycombinator.com/item?id=1710702</a>.
评论 #4219151 未加载
losvediralmost 13 years ago
Sigh, I keep seeing this article, and ones like it, and keep thinking maybe I should go back to vim. I'm happy with Sublime, though I like the idea of vim.<p>I've used vim a great deal in the past and it really is exceptional for editing a given file. The thing that really tipped me to ST2, though, was its management of multiple files in a project. The sidebar and Goto Anything are indispensable. I know vim has command-t, but I just haven't been able to browse a family of related folders as easily. How do others do it?<p>Also, I just can't get used to the line-by-line scrolling of vim and emacs vs. the pixel scrolling of Sublime, or TextMate, or even TextEdit.
评论 #4219865 未加载
评论 #4219924 未加载
评论 #4219642 未加载
评论 #4219867 未加载
HarrietTubgirlalmost 13 years ago
I've come and gone with various vim config changes, but this is the one non-standard one I've stuck with:<p>au! BufRead,BufNewFile * lcd %:p:h<p>This makes it so that when you open a buffer, you cd to the current directory (only for that window), so you can quickly open files in that directory.<p>[% is the current file relative to pwd, :p converts to a full path, :h takes off a path component, lcd does a cd but only for the current window]<p>Another tip is that when your internet connection sucks enough for SSH lag (tethered, free wifi, whatever), you can edit a file locally and have vim do the SCP back when you write:<p>:e scp://you@somewhere/path<p>Boom!
评论 #4220701 未加载
评论 #4220321 未加载
chimeracoderalmost 13 years ago
Slightly tangential, but the author mentions remapping Caps_Lock, as I do (I've mapped it to Escape, as Esc used to be where Tab is on modern keyboards anyway). The moment I first did this, I realized how amazing vim really is, and why people always say that you can navigate the entire file without moving your hands from the home row.<p>However, both methods I know for doing this only work inside an X server - does anybody know a good way to remap keys without X?
评论 #4219936 未加载
评论 #4220199 未加载
评论 #4219794 未加载
评论 #4219776 未加载
barbsalmost 13 years ago
I'm a bit torn. I love the controls in vim, the way you navigate and manipulate text is a brilliant system. It makes it more efficient and more "fun".<p>However, I really don't like the configuration system for vim. Reading the article above, I lost interest when he started talking about his .vimrc file and the plugins he used. It seems arcane to have to have these cryptic settings, whose functions aren't immediately obvious, and write them to a file. I understand that part of the VIM philosophy is that it's almost like a language, or that it's like programming your text, but configuration is just something that you (ideally) set once, and then forget about. Even if I do learn what "nnoremap &#60;leader&#62;ft Vatzf", if I need to set up my environment again, I'll likely forget what it is and why I needed it in the first place. And even if I configure VIM to have the things I want (for example, NERDtree for project navigation), it'll never look or feel as intuitive as having a graphical interface.<p>So it seems when people talk about VIM, it seems that they're really talking about two things: the control scheme (keybindings) and the editor itself (the environment).<p>Being an android developer, I use eclipse. I use the "Vrapper" plugin, which gives me vim keybindings in the eclipse editor. I love it. It gives me the vim navigation that I know and love, but the environment and tools provided by Eclipse. I think this is how it should be - the environment of the editor is best handled separately, and although you can add a ton of plugins and configure the crap out of VIM to turn it into an IDE, it'll never really be a proper IDE.<p>This is why I'm still looking for an ideal lightweight text editor/IDE. My ideal for linux would be Geany, but with Vim keybindings. I discovered Vico yesterday, which looks interesting, but is OSX only at the moment. Might be what I'm looking for, but we'll see.
评论 #4222851 未加载
评论 #4221407 未加载
Derbastialmost 13 years ago
I started off with Textmate, then Emacs, then Vim, then back to Textmate, then Vim (for real that time), then Emacs (for real, that time).<p>I am tempted by Sublime Text and Vim, but can't live without a few Emacs features these day. But sometimes I miss the fluidity of Vim.<p>That said, I found the most important influence on my productivity is <i>fun</i>. I am most productive when I enjoy what I am doing. And this is very directly influenced by the way I do the clickety-clack thing with my keyboard.<p>In fact, I sincerely think that Vim is <i>the</i> most efficient text editor out there. Nothing else comes close. The thing is, me personally, I am having more fun elsewhere, for reasons that have little to do with text editing performance.<p>Mind you, this is not critique against Vim. But I would like to discuss text editing productivity in terms of fun instead of keypress efficiency. Whenever anyone argues about the relative merits of EditorX against EditorY in terms of key presses I feel like he is missing the point.<p>What do you think about this idea/argument?
评论 #4222688 未加载
评论 #4222908 未加载
评论 #4222842 未加载
评论 #4222324 未加载
评论 #4222778 未加载
pashalmost 13 years ago
This blog post recently helped persuade me to switch to Vim (from TextMate). The two things that most helped me <i>learn</i> Vim, beyond the very basics, were Drew Neil's excellent Vimcasts [0] and Steve's own <i>Learn Vimscript the Hard Way</i> [1] (a work in progress). Learn the basic movement commands and text objects, then spend ten minutes every day watching a Vimcast or doing a chapter of <i>LVHW</i> and you'll quickly be past the steep part of the learning curve.<p>0. <a href="http://vimcasts.org/episodes/archive" rel="nofollow">http://vimcasts.org/episodes/archive</a><p>1. <a href="http://learnvimscriptthehardway.stevelosh.com/" rel="nofollow">http://learnvimscriptthehardway.stevelosh.com/</a>
评论 #4219554 未加载
dedwardalmost 13 years ago
It goes without saying..... check out vimgolf if you haven't - whether novice or expert, competing or just reading, you learn new stuff.<p>Don't become too plugin dependent too early, but a quick browse through some other's dotfile repositories (yadr is worth looking at, especially if you are on a mac - not necessarily to use, but definitely to see what's possible). Things like EasyMotion really make you think. As do things like persistent undo files. (gundo and other stuff)<p>At some point you should be buildilng up your own set of dotfiles from scratch.... not just relying on someone elses (some day some bug hits you and you have no idea where to start otherwise)
Andrew-Dufresnealmost 13 years ago
After using Vim for couple of years, I recently made a switch to Emacs. Sometimes I regret it. I definitely miss Vim modal design and keybindings. Compare Vim's J (join lines) with Emacs go to the lower line and press ^ to join it with the upper one.<p>To copy a line in Vim you just have to press 'yy' but there is no copy line command in Emacs out of the box. What you can do is C-k, C-y, i.e cut a line into clipboard and paste it back to have copy line effect.<p>But trying and learning different tools is obviously useful. Emacs introduced me to ido-mode and org-mode. Now that I know of the possibilities, I can search for and use similar plugins in Vim.
评论 #4221240 未加载
norswapalmost 13 years ago
&#62; "If switching to a different editor can increase my efficiency by even 10% it would save a good chunk of my time and let me get back to making cool things."<p>&#62; "I don’t buy the “you’re thinking 90% of the time and only typing 10% of the time, so your editor doesn’t really matter” argument. Even if the premise is true, the conclusion is wrong."<p>Interestingly to me, people never (or rarely) attempt to improve their thought process, which would probably result in a much higher increase in productivity than editor proficiency.
z92almost 13 years ago
&#62; nnoremap ; : &#62; I don’t remap : back to ; because it seems to break a bunch of plugins.<p>That sounds like another good trick. But then how do you jump to your next f,F,t? I find myself frequently typeing "f=" to find "=" and then hitting ";" to jump through all the "=" in that line and reach the one I want.
评论 #4219689 未加载
评论 #4219708 未加载
comatose_kidalmost 13 years ago
" If switching to a different editor can increase my efficiency by even 10% it would save a good chunk of my time and let me get back to making cool things."<p>Instead of taking us on a long biographical journey of how you found the One True Editor (this week), why not familiarize yourself with Amdahl's Law?
评论 #4221656 未加载
评论 #4221649 未加载
teaneedzalmost 13 years ago
Even though I really enjoy pecking away in BBEdit, I find Vim to be so wickedly fast. Manipulating text in Vim is nicely handled without having to stretch the fingers very far. By the time I go to the trackpad in another IDE, I could have accomplished so much more within Vim.
fromhetalmost 13 years ago
Is there anyone on HN not using textmate and sublime no Mac OSX?
评论 #4219635 未加载
评论 #4219836 未加载
评论 #4219979 未加载
评论 #4219970 未加载
评论 #4219632 未加载
jasondaviesalmost 13 years ago
Great tip for using Perl/Python-compatible regex syntax:<p><pre><code> nnoremap / /\v vnoremap / /\v </code></pre> This will save me a <i>lot</i> of time. Thanks, Steve!
Lapsaalmost 13 years ago
One thing I can't understand - why people remap leader to comma? How they use fFtT without it?
评论 #4221310 未加载
patrickodalmost 13 years ago
Does anyone know what the author is using to display carriage returns at the end of each line?
评论 #4220039 未加载
评论 #4220091 未加载
geoffcalmost 13 years ago
mid eighties till 1992 on Qedit, Emacs till 2002 then VIM to the present, no desire to switch for the next decade of coding :-)