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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Anything fancy in your .vimrc?

2 点作者 gaving超过 12 年前
Anything particularly esoteric in your vimrc?<p>Couple I find invaluable:-<p><pre><code> " Yank block visual selection to space separated line vnoremap &#60;Leader&#62;y "+y:let @+ = join(map(split(@+, '\n'), 'substitute(v:val, "^\\s\\+", "", "")'), " ")&#60;CR&#62; " Yank block visual selection to comma separated line vnoremap &#60;Leader&#62;Y "+y:let @+ = join(map(split(@+, '\n'), 'substitute(v:val, "^\\s\\+\\\|\\s\\+$", "", "g")'), ",")&#60;CR&#62;</code></pre>

3 条评论

goldfeld超过 12 年前
I have too many. I have many ideas for plugins as I'm getting into vimscripting (and have since released one) and I use vimrc as a staging area for those ideas to grow on me.<p>Just last week I put this to have modified buffers in my statusline:<p><pre><code> set statusline+=%{GetModifiedBuffers()} function! GetModifiedBuffers() redir @b silent! buffers redir END return system('echo "'.@b.'"' . " | awk '$3 ~ /\+/ {printf ".'" " $4 "*"'."}'") endfunction </code></pre> I also have something I'm calling Streamline, which allows you to navigate relative lines while seeing absolute lines.<p>Also just yesterday I hacked something which allows me to block hjkl for more than one consecutive press, while binding their double presses to some other action. So pressing j once gets me down one line, pressing a second consecutive time activates Streamline which then, without a count, takes me to lines multiple of ten, so it's my way of scrolling when I don't know the outlook of the file (given a count of 4 while on line 37, Streamline would take you to line 44). This is still not on my online vimrc, but the rest is at github.com/goldfeld/dotfiles.
logn超过 12 年前
Working in data I often had tab delimited files. So you'd want your tabs to show up as real tabs when typed and not converted to spaces. Otherwise for code convention is almost always spaces. So I use this.<p><pre><code> syntax on filetype plugin indent on :set paste set shiftwidth=4 set tabstop=4 autocmd FileType ruby,eruby,yaml,java,clojure,html,css,xml \ setlocal shiftwidth=2 | \ setlocal tabstop=2 | \ setlocal expandtab</code></pre>
ryanaghdam超过 12 年前
Does Vundle &#60;<a href="https://github.com/gmarik/vundle&#62" rel="nofollow">https://github.com/gmarik/vundle&#62</a>; count as something fancy?