TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Vim Recipes

44 点作者 r11t大约 16 年前

7 条评论

slmbrhrt大约 16 年前
How very verbose. Isn't vim designed as a terse, efficient, no-nonsense text editor? <a href="http://vim.runpaint.org/basics/saving-a-file/" rel="nofollow">http://vim.runpaint.org/basics/saving-a-file/</a> for example, gives me several screens full of jabber, broken into Problem, Solution, and Discussion, plus the ubiquitous Needless Comment Form as on every page. All this fluff, and :w is mentioned only in a user-added comment.<p>I don't mean to say you can't learn anything from this document, just that you could do a lot better with ':help tutorial' and maybe a googled cheatsheet. The tutorial really only takes half an hour, just like it promises.
评论 #619281 未加载
评论 #618391 未加载
Dobbs大约 16 年前
Something I recently learned that is really cool:<p>:&#60;area&#62;!&#60;command&#62;<p>will export the &#60;area&#62; to &#60;comand&#62; and then replace &#60;area&#62; with the output of the &#60;command&#62;. So you can do:<p>:%!sort # Sort the entire file.<p>:.!awk '{ print $1 }' # Replace the current line with the first word/column.<p>So much power with this really simple set of commands. You can also highlight the an area using visual mode, and then just type ':!&#60;command&#62;' and it will autofill in the area for you.
visitor4rmindia大约 16 年前
Verbose and not worth the read IMHO. The best tip in this entire document was changing a sentence to title case.<p>&#62;Select the text you want to convert, hit :, then enter the regex:<p><pre><code> s/\&#60;\(\w\)\(\w*\)\&#62;/\u\1\L\2/g. </code></pre> And, even this is not completely correct. The expression will not work if you select part of a line. Your best bet would be to remap the following:<p><pre><code> nnoremap &#60;A-c&#62; :s/\&#60;\(\w\)\(\w*\)\&#62;/\u\1\L\2/g&#60;CR&#62; vnoremap &#60;A-c&#62; :s/\%V\(\w\)\(\w*\)\%V/\u\1\L\2/g&#60;CR&#62; </code></pre> To get key bindings that you like (I've defaulted to the EMacs <i>capitalize-word</i> binding).
评论 #619327 未加载
blackman大约 16 年前
I've posted this before, but i found the best way to learn some vim is by example. you soon get the idea.<p><a href="http://rayninfo.co.uk/vimtips.html" rel="nofollow">http://rayninfo.co.uk/vimtips.html</a><p>I've found it quite an efficient editor with MacVim+Ruby and Jamis Buck's FuzzyFinder TextMate.
DEinspanjer大约 16 年前
I'll concede it is verbose, but having a task oriented guide is much more useful in certain cases than the standard :help.<p>I was happy to see a nice visual explanation of undo branches. Something that I've known exists but never learned to use well.
eddiegroves大约 16 年前
Wow, looks solid. I've only been viming for a year, so no doubt theres plenty of knowledge gems for me here.
erlanger大约 16 年前
This is vapid. For instance: <a href="http://vim.runpaint.org/extending/creating-keyboard-shortcuts-with-key-mappings/" rel="nofollow">http://vim.runpaint.org/extending/creating-keyboard-shortcut...</a><p>No mention of inoremap, nnoremap, etc.<p>If you want to learn Vim well, do the following:<p>1. Ask "stupid" questions on #vim on freenode. Learn to use :help<p>2. Use :help<p>3. Ask the vim-use group any questions not obviously answered by :help
评论 #618171 未加载
评论 #619309 未加载
评论 #618176 未加载