I'm trying to create a keyboard shortcut to save my file in vim, so I would like to map control alt S to ESC, :, w, ENTER, a. Is there any easy way to do that?
Look at this :
http://vim.wikia.com/wiki/Map_Ctrl-S_to_save_current_or_new_files
Or this:
In vim how to map "save" to ctrl-s
Or this:
http://sigttou.com/vim-ctrl-s
Related
It would be nice if I could press Ctrl + S to save a Vim file like in Windows, rather than :wq. Is it possible to create shortcut keys in Vim?
Yes, it's absolutely possible. You just need to use
<C-yourKey> for map ctrl+yourKey key according to documentation vimdoc.sourceforge.net/htmldoc/intro.html#control
map <Alt>q <Esc>la
This line in my vimrc seems not working after the Esc key. It do exits the insert mode but doesn't enter insert mode again. I also tried
inoremap <Alt>q <Esc>la
map <Alt>q <Esc><Ctrl-A>
map <Alt>q <Esc><Ctrl>A
Basically I want to have something within the normal typing position to have the same effect as key. Say
(i>5[cursor])
->
(i>5)[cursor]
Solution:
I figured out the problem. Its cuz my terminal doesn't properly recognize alt as the alt, instead as a system level alt somehow. see
Alt key shortcuts not working on gnome terminal with Vim
As far as I can see there are two problems:
<Alt> isn't a thing. If you want to map Alt+q, that's <M-q>.
:map doesn't apply to insert mode.
You haven't explained what you're trying to do, so I can't tell you what to do instead.
so I would like to use the same keybinding for my terminal and for my vim editor.
Example open new tab: Ctrl-t
is there a way to use a key to specify to which instance my binding will be applied.
example:
press f1 -> keybinding on vim
press f1 again -> keybinding on terminal
is this possible or I necessarily need to choose different keybinding in order to use them all
You must have different key bindings for Vim and for your terminal. Vim doesn't read keyboard input independently of the terminal it lives in, it reads the keyboard from the terminal. If you press a key sequence that has a meaning for the terminal, the terminal will apply whatever function corresponds to it, and it simply won't hand the sequence to Vim.
Is it possible to some how setup IntelliJ IDEA so that I can column select with the cursor keys similarly to how I might in Notepad++, Visual Studio, or FlashDevelop.
For instance when I'm typing code I almost always do my navigation solely through use of the keyboard. In the IDEs mentioned previously I can quickly select blocks of code by holding Shift + Alt then tapping ↑ to extend my cursor across the lines above. I can then hold Shift + Alt + Ctrl and tap ← or → to quickly jump across words and select the chunk of text I want.
In IntelliJ IDEA I have to constantly enable and disable Column Selection Mode using the Shift + Alt + Insert and even then it doesn't quite function as it does in the other IDEs or Text Editors.
Any ideas?
You can do column editing using the Edit | Column Selection Mode.
The shortcut to turn it on/off is Alt+Shift+Insert. You navigate with arrow keys to select blocks of text.
Multiline Caret (without mouse)
Windows/Linux: CTRL + CTRL(Hold) + ↑ / ↓
Mac: ⌘ + ⌘(Hold) + ↑ / ↓
ESC will end multiline mode.
Change Multi-caret Hotkey
To add a custom Keymap, CTRL+SHIFT+A, type keymap and click on the one with Settings as subtext. Search for Clone Caret Above and Clone Caret Below.
I mapped mine to ALT+SHIFT+↑ / ↓.
Bonus
Try holding combinations of CTRL, SHIFT, and arrows for improved selection power.
It is also possible to select holding middle mouse key.
Go to the Settings | Keymap and set a shortcut for Clone Caret Above and for Clone Caret Below
Most convenient way is to:
MAC: Hold Option+Shift and click with mouse.
Windows: Hold Alt and click with mouse.
On a mac, to toggle block select on/off:
shift command 8
⇧⌘8
For me on Mac:
Press once 'option' key, release it, and press and hold it again.
Now navigate with cursor to select desired code.
Press 'Esc' to exit column mode! :)
I think #Meo's answer is the most correct, but if your hand happens to be on the mouse, you can also accomplish this with Ctrl+Alt+Shift+Left Mouse Button Click. Or look for the Add Rectangular Selection on Mouse Drag in the keymap settings.
In Windows or Linux I press two times Ctrl
For Mac cmd+shift+* didn't work for me. I changed the keymap to something else and now it works seamlessly.
with the filesystem menu (default shortcut 'm') in the NERDTree plugin, you can easily add/copy/move/delete files and folders.
But the vim keybindings (h,j,k,l, w, e, b, y, v and so on) do not work in that menu.
I know there is a key-combo to enable those vim keybindings in that menu, but I have forgotten it and cannot find it again via google/forums... The shortcut is also not documented in the help menu.
Does anyone know how to enable the vim keybindings in the NERDTree FileSystem Menu?
This comes in very handy when creating large amount of files and folders with more or less the same name. I would like to copy/paste and use the vim movement keys (w, e, b, h,j,k,l) in that menu.
Ok, I've just found it myself while mashing random keys in the menu.
You can press ctrl+f in the menu, the menu will then change to another form(some sort of command history view ?!) where you can use the vim keybindings. When your input is done, press enter!
You didn't find that shortcut in the plugin's documentation because that's built-in Vim functionality: :help c_CTRL-F! The plugin uses input() to query for the file name, CTRL-F will switch to Vim's command-line window, using the input line history.
You can use the same shortcut while typing an :ex command, or while /searching!