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.

Automating the Vim Workplace (2020)

74 pointsby leonry3 months ago

7 comments

toprerules3 months ago
Can&#x27;t really say enough good things about Vim. I retired early as a staff software engineer because of the work I did using Vim. From hacking silly games in C in high school to now, I&#x27;ve always been able to use Vim and run circles around any &quot;modern&quot; text editor or IDE. I feel like I owe Vim as much public praise as I can give so others can reap the rewards like I did.<p>What really frustrates me is how little people seem to want to invest in their tools, or the outright lies they tell themselves about how much configuration they need to use Vim on a daily basis. My Vim config is 200 lines, and my last commit was 3 years ago. I&#x27;ve invested maybe a few days of my life into configuring Vim and I use it 8-16 hours a day.<p>Vim can do so much on its own. It has autocomplete, fuzzy finding, integration with build systems, file search, navigation using a directory browser, jump to symbol, parse compiler output to jump to bugs, support for gdb and breakpoints, a built in terminal, copy to and from the system clipboard, and with literally 8 lines of code you can get support for every linter, LSP, etc. known to man, fuzzy finding, and git integration that let&#x27;s you use native git commands with seamless editor integration.
评论 #43037246 未加载
评论 #43036701 未加载
porridgeraisin3 months ago
&gt; sorting and reversing over motion<p>Vim can run shell commands as filters over selections as well.<p>Although vim does provide its own `:sort`, you can also sort the current selection like<p><pre><code> v{motion}!sort </code></pre> Which uses the external sort command (coreutils)<p>For reversing,<p><pre><code> v{motion}!tac </code></pre> Which uses `tac` to reverse the order of the lines.<p>This general concept is quite useful in many other ways, since it is quite universal - selection goes to stdin of arbitrary program, stdout of that program replaces selection.<p>For example, if you want to quickly test a function that takes a json string, and you&#x27;re in a language where instantiating good mock objects and serialising it takes quite a bit of code, you can quickly make a mock by writing JS code within the string quotes and have the code console.log json and then `vi&#x27;!node` will replace it there.
评论 #43034616 未加载
评论 #43034043 未加载
评论 #43034046 未加载
rgomez3 months ago
The Vim configuration is something deeply personal, but I&#x27;d recommend as a wise choice always explore first the default settings because assuming those in your workflow gives an huge advantage using any new unconfigured vim environment eg to get out of any of the edit modes &lt;C-c&gt; works by default and is a great choice. To use CUA alike shortcuts there&#x27;s already: ``` source $VIMRUNTIME&#x2F;mswin.vim ``` And finally, is also a good idea to get used to use &lt;Leader&gt; as a prefix for your own shortcuts, in my case I use the space bar as &lt;Leader&gt;.
评论 #43034206 未加载
评论 #43035785 未加载
usrme3 months ago
I had no idea Vim had a terminal mode with &#x27;:ter|:terminal&#x27;! Definitely something I&#x27;ll look into to improve my own Vim + Git workflow. I&#x27;ve usually just moved Vim to the background with Ctrl+Z, done my committing, and then moved Vim back to the foreground with &#x27;fg&#x27;.
评论 #43035285 未加载
评论 #43034737 未加载
评论 #43037146 未加载
wruza3 months ago
<i>I often use the :wa command to save all my open buffers. But it has the nasty habit of throwing an error when it’s not able to save all buffers</i><p><pre><code> nmap &lt;F2&gt; :silent! wa&lt;CR&gt; </code></pre> <i>Copy to System Clipboard</i><p><pre><code> if has(&#x27;unix&#x27;) set clipboard=unnamedplus else set clipboard=unnamed endif </code></pre> Also, to type word under cursor into command line:<p><pre><code> cmap &lt;M-w&gt; &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt; </code></pre> Paste without replacing clipboard (for the lazy):<p><pre><code> vnoremap p P</code></pre>
评论 #43140529 未加载
jmux3 months ago
&gt; This articles looks an awful lot like a list of Vim tips<p>honestly, I like articles that are “a list of vim tips”. I can usually find some really good ideas that I didn’t consider. The tip about remapping copy to system clipboard to something easier than ‘“+y’ is genius, definitely using that.
iammrpayments3 months ago
The sort and reverse stuff is a bit overkill to me, maybe the guy writing tables?