4 ms·
I didn't know this was possible: " Resize splits when the window is resized au VimResized * exe "normal! \<c-w>=" That's really handy. Also, this part
by nickknw 15y ago
I didn't know this was possible:
" Resize splits when the window is resized
au VimResized * exe "normal! \<c-w>="
That's really handy. Also, this part made me smile:
" Heresy
inoremap <c-a> <esc>I
inoremap <c-e> <esc>A
- JoshTriplett 15y ago"C-w =" equalizes the size of splits. That works fine if you already had them near-equal, but I frequently shrink or maximize split windows, and I don't want them equalizing every time the window resizes.
- stevelosh 15y agoYou could bind a key to :setlocal winfixwidth, and press that when you want a certain window to not be resized. Or just not worry about it at all -- each person has their own way of working with Vim.
- graywh 15y agoThe comment is cute, but doesn't it make more sense to just map to End itself since A is essentially a shortcut for <End>a inoremap <C-e> <End> Technical note: I's behavior changes depending on 'cpo' so you can't just map it to <C-o>^.
- swah 15y ago(I love both editors) That's something disgusting about Vim - mapping to other keys instead of commands. In Emacs its much nicer IMO: (global-set-key (kbd "C-a") 'beginning-of-line)
- stevelosh 15y agoDisgusting but practical. I already know the keys on the right because I use them every day. If it were a function I'd have to look it up first.
- undees 15y agoIs there a Vim equivalent of Emacs's C-h k followed by the key combo, which basically says, "Tell me what the official command name is for this keystroke?"
- similarthough 15y agoI don't know of anything quite like that but the help can be searched by key, though only for the default key combinations, e.g. ":h i^a" would show the docs for the ctrl-a command in insert mode. Note though that vim really doesn't have commands the same way as emacs does. That's why you generally see assigning one key combination to another instead of some "command name."
- ralph 15y agoMapping to keys lets one map to the first part of a key sequence as opposed to the whole sequence/command name.
- crazydiamond 15y agoYou can bind a key to a command too. However, mapping to keys allows you to create your own. To give you a crude example, you could map a key to go down 5 times (5j). A real example would be more complicated for some specific task -- jump to other window, maxmimize it, go down to 5th line or some bookmark, etc.
- djacobs 15y agoHaving paired with many people who have loaded Emacs keybindings into Vim, this made me laugh. But serious talk: Unless someone has loaded Emacs keybindings, shouldn't <C-a> be used to increment a number (even a hexadecimal one)? How is that heresy? Not having <C-a> makes several macros difficult.