4 ms·
It's not vim, but many terminal-based keyboard shortcuts are already available across OS X without installing anything. For example: - ctrl+p - move cursor
by simplify 9y ago
It's not vim, but many terminal-based keyboard shortcuts are already available across OS X without installing anything. For example:
- ctrl+p - move cursor up one line
- ctrl+n - move cursor down one line
- ctrl+f - move cursor forward one character
- ctrl+b - move cursor back one character
- ctrl+a - move cursor to beginning of line
- ctrl+e - move cursor to end of line
- ctrl+k - delete all characters from cursor to end of line
There are a few missing useful ones (such as move by word), but you can fill them in by creating this file[1] in a specific place on your machine.
[1] https://gist.github.com/gilbert/10fdd692799fc7269b50abbcfb2ea410 https://gist.github.com/gilbert/10fdd692799fc7269b50abbcfb2e...
- egwynn 9y ago1. I think this is for the people who want more than just a couple vi-like motion keys. 2. Five of your seven shortcuts are for emacs[0], not vim. [0]: https://www.gnu.org/software/bash/manual/html_node/Command-Line-Editing.html#Command-Line-Editing https://www.gnu.org/software/bash/manual/html_node/Command-L...
- simplify 9y agoRight, I just thought it was interesting enough to point out how there are many navigation shortcuts that are built into OS X. Useful even when you're using someone else's computer.
- omaranto 9y agoAll seven are default keybindings in Emacs. Which two did you believe weren't?
- thomastjeffery 9y agoThose are emacs-based shortcuts. They are also the default in most shells (bash/zsh), which also have optional vi-based bindings.
- caymanjim 9y agoThese are Emacs shortcuts, not Vim. They're available in bash (the default MacOS shell) because bash uses the readline library. You can also put readline into Vi mode and use Vi/Vim shortcuts, but none of this has anything to do with editing files.
- simplify 9y ago> but none of this has anything to do with editing files. Why not? You can use these shortcuts across OS X. That includes your web browser and any other GUI you have on your machine (I use them heavily in notational velocity).
- deleted 9y ago[deleted]
- fimdomeio 9y agofish shell has a vim mode for anyone interested
- hnzix 9y agoBash and zsh also have vim mode. The bash mode is more like vi though.
- egwynn 9y agoIndeed, it’s in fact called “vi mode” in the bash/readline docs.
- xelxebar 9y agoThis is actually a readline thing, so you can edit your $HOME/.inputrc with set editing-mode vi and get the vi bindings in everything that supports readline, e.g. the Python shell etc. There's tons more that can be customized here. You can even have it put the current vi mode in your prompt and stuff like that. https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File.html https://www.gnu.org/software/bash/manual/html_node/Readline-...
- 9y ago
- omaranto 9y agoThose OS X keybindings come from Emacs! I bet some vimmers would refuse to use them just on principle. :)
- jaequery 9y agonow that’s funny
- sodapopcan 9y agoI'm a vimmer and always use readline bindings in "insert" mode context. I find using vim bindings on the commandline to be infuriating. On macOS, you need to add the following to $HOME/Library/KeyBindings/DefaultKeyBinding.dict to get ctrl-w and ctrl-u to work everywhere in macOS. { "^w" = "deleteWordBackward:"; "^u" = "deleteToBeginningOfLine:"; }
- omaranto 9y agoOh, if you like those bindings in insert mode, you are probably already aware of Tim Pope's vim-rsi [1] plugin. If not, check it out, it might have some interesting bindings you aren't using yet. [1] https://github.com/tpope/vim-rsi https://github.com/tpope/vim-rsi
- sodapopcan 9y agoI'm absolutely aware of it and was gonna mention it but figured I'd said enough :) When I said "insert" I meant like, "insert mode" everywhere else but vim :) But yes, RSI is a great plugin (as are most of tpope's plugins)
- sodapopcan 9y agoAlso, you mentioning it made me realize I never starred the repo, so thanks, haha!
- eadmund 9y ago> I find using vim bindings on the commandline to be infuriating. Some folks find vim bindings to be just as bad to edit text grin I don't actually agree: I think that vim's text-editing language is actually nicer than emacs's is. But I use emacs — with its bindings, not vim's — because after almost thirty years it's what I'm used to.
- girvo 9y agoDoesn’t Option-(Arrow Left|Arrow Right) move around per word?
- simplify 9y agoYou're right, but option+(f/b) is handier when combined with ctrl+(f/b)