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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Vim: Spacebar as leader key, CapsLock as Esc

39 点作者 normalocity超过 11 年前

20 条评论

kps超过 11 年前
<i>Perhaps I have spent so much time on Mac that pressing the Ctrl key for things feels unnatural vs. the Command key</i><p>Argh. OS X is the last significant platform that gets this right by not trying to use Control for menu shortcuts out of the box. When I&#x27;m in a terminal, or editor, or browser text box, it&#x27;s perfectly common and reasonable to want to distinguish Control-V (literal) from Command-V (paste), Control-Z (suspend) from Command-Z (undo), and so on.<p>Pre-Linux X Window software typically managed this, using Meta or some other keysym for GUI operations, but current ‘desktops’ seem dead set on imitating MS Windows. Damn kids get off my screen.
评论 #6917079 未加载
karmajunkie超过 11 年前
I basically do this, but I use &quot;,&quot; (comma) as my leader, and I make capslock do double duty as ctrl and esc using KeyRemap4MacBook (<a href="https://pqrs.org/macosx/keyremap4macbook/" rel="nofollow">https:&#x2F;&#x2F;pqrs.org&#x2F;macosx&#x2F;keyremap4macbook&#x2F;</a>). The trick is first remap capslock to Ctrl in keyboard system preferences, then use KR4MB to remap Control_L (the left control key, which is to say, what capslock now signals) to Control_L, but if you type ONLY Ctrl_L it sends esc. so when i need escape, it sends that. when i want to use it for Ctrl-modified combos, it does that. Works fantastically for Vim, i&#x27;ve been doing this for a couple years now. Also nice for emacs keyboard shortcuts in other apps that respond to them.
评论 #6917343 未加载
评论 #6917838 未加载
评论 #6917066 未加载
rc4algorithm超过 11 年前
To the many of you using Macbooks: be aware the that the caps lock key is deadened&#x2F;delayed in order to prevent mistaken pressing, and that this is a hardware feature that can&#x27;t be changed. This may be the case for Mac keyboards and other new systems as well.
q_revert超过 11 年前
I use &lt;space&gt; as my Easymotion leader..<p><a href="https://github.com/Lokaltog/vim-easymotion" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Lokaltog&#x2F;vim-easymotion</a><p>it&#x27;s well worth a look, gives you super quick fine grained movement<p>similarly<p><pre><code> inoremap jj &lt;ESC&gt; </code></pre> to take you from INSERT mode to NORMAL mode is nice
评论 #6916951 未加载
评论 #6917128 未加载
评论 #6916868 未加载
SmileyKeith超过 11 年前
I use CapsLock as escape but had I not gotten so used to that by now I would probably have used it for control instead and mapped escape to jk or something. I, like many people, use `,` for my &lt;leader&gt; and with Clever-F[0] I don&#x27;t lose the original functionality which is just remapped to consecutive presses of &#x27;f&#x27;.<p>[0]: <a href="https://github.com/rhysd/clever-f.vim" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rhysd&#x2F;clever-f.vim</a>
jfft超过 11 年前
Love spacebar as the leader key, but not a fan of CapsLock as Esc. CapsLock as Ctrl is better. For one, you never have to stretch for the real Ctrl, and two, you <i>can</i> use it for escape as well: Ctrl-[
评论 #6919161 未加载
评论 #6917045 未加载
评论 #6917249 未加载
jdonaldson超过 11 年前
I broke things down by priority. I notice that I jump around in documents by searching through them, rather than by navigation keys. Spacebar is the biggest key on the keyboard, so, spacebar is mapped to &quot;?&quot; in normal mode. I also find that I need to search through a project regularly, so ctrl-spacebar is mapped to the ack&#x2F;ag command.<p>Control is mapped to caps lock at the os level for me. There are also too many useful commands in vim that use control (visual block mode is huge). I tried mapping jj to escape as well, but ctrl-c is just as easy.<p>Leader is mapped to comma. Most of my leader commands are comma + &quot;some letter I can type with my left hand&quot;.
评论 #6918106 未加载
glynch超过 11 年前
I prefer remapping capslock to control for easier use of commands like &lt;C-f&gt;, &lt;C-b&gt;, &lt;C-e&gt;, &lt;C-h&gt;, and &lt;C-l&gt; (all of which were absent in the example vimrc posted). Using the leader key makes total sense for dealing with splits and buffers or plugins you might want to look into some of the other Control based commands that Vim supports.
评论 #6917344 未加载
munger超过 11 年前
Thanks for the easy-to-understand take on the leader key. Not using the leader key is one of my known vim weaknesses I&#x27;ve been meaning to fix. I found your explanation and usage a great push into actually putting it in my .vimrc
CGamesPlay超过 11 年前
I end up using Ctrl for a bunch in vim: visual block, ctrlp (and &lt;C-b&gt; for buffer mode), window nav, and most importantly, imported emacs keybindings. The emacs line motion commands (specifically &lt;C-a&gt;, &lt;C-e&gt;, and &lt;C-d&gt;) are extremely useful because they work in every app on my mac, so not having to lose flow when I&#x27;m in vim or a browser is nice.<p><a href="https://github.com/CGamesPlay/dotfiles/blob/master/files/vimrc#L152" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CGamesPlay&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;files&#x2F;vim...</a>
Theodores超过 11 年前
If I am going to have to relearn where some of the keys are in vim then I might as well go the whole hog and get a Dvorak keyboard whilst I am at it!
评论 #6916852 未加载
sethish超过 11 年前
I&#x27;ve been using this since [~2010](<a href="https://github.com/sethwoodworth/dotfiles/commit/801f4a7163db017c0be7edaee2e358b7f3d4bf50#diff-4e12c6a37ff2cbb2c93d1b33324a6051R77" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sethwoodworth&#x2F;dotfiles&#x2F;commit&#x2F;801f4a7163d...</a>). I highly recommend leader as space.
svermeulen超过 11 年前
Why not map caps lock key to both escape AND control? I&#x27;ve been doing this successfully for a long time and couldn&#x27;t live without it. You can use Autohotkey on windows and similar tools on other systems to interpret caps lock pressed by itself as escape, and caps lock pressed + another key as control.
97-109-107超过 11 年前
The is a way of minimizing the frequency of having to reach esc (be it at esc or caps lock) &quot; jj For Quicker Escaping between normal and editing mode. inoremap jj &lt;ESC&gt;
jagger27超过 11 年前
What is a leader key? How much typing class did I miss?!
评论 #6916543 未加载
评论 #6916548 未加载
评论 #6916547 未加载
etanazir超过 11 年前
I use &#x27;,&#x27; and my leader; but have been considering remapping &#x27;esc&#x27; ... any suggestions other than CapsLock?
评论 #6917332 未加载
ryan-thompson超过 11 年前
I love this idea, I never thought of using the spacebar as anything other than a space.
erikb超过 11 年前
Nobody said it yet, so I have to do it: Happy Hacking Keyboard
harryovers超过 11 年前
i have capslock as my backspace key. where do i put escape now?
knodi超过 11 年前
i use my caps as control key.