Live data from Hacker News

Vim Splits – Move Faster and More Naturally

robots.thoughtbot.com

11–20 of 68 posts

Re: Vim Splits – Move Faster and More Naturally

#11
I am SO SATISFIED with my splits key remapping I have to share it:

    map  l
    map  h

    map  j
    map  k

    map  :splitj " Horizontal split
    map  :vsplitl " Vertical split
    map  :close

    map  K " Convert vertical to horizontal split
    map > L " Convert horizontal to vertical split

Re: Vim Splits – Move Faster and More Naturally

#12

In addition to that, I can heartily recommend the ZoomWindowPlugin: https://github.com/skeept/dotvim/blob/master/plugin/ZoomWinP... Basically, if you have multiple split windows, it allows you to do a cmd+O to zoom the current split view (i.e. making it the only view visible). That's neat if there's something tricky going on (say a weird bug) and you want to focus just on this piece of code, without seeing anything e…

Any advantage to this plugin over mapping one key to ':tabopen' and another to ':tabclose %'? I have this in my .vimrc and it seems to get the same results: nmap :tabedit % nmap :tabclose

Splits are not tabs.

Edit re below: OK, good point. But I would still prefer the plugin (and plan to install it) because I just don't use tabs, preferring to stick with splits.

Re: Vim Splits – Move Faster and More Naturally

#13
post #11

I am SO SATISFIED with my splits key remapping I have to share it: map l map h map j map k map :split j " Horizontal split map :vsplit l " Vertical split map :close map K " Convert vertical to horizontal split map > L " Convert horizontal to vertical split

I moved over to evil-mode (Vim emulation) in Emacs a couple of months ago and do most things the Vim way but some things are more efficient to do in a non-Vim manner and this is one of them.

Although I use M-- and M-| for vertical and horizontal splits.

Re: Vim Splits – Move Faster and More Naturally

#14

Earlier quoted context omitted.

Any advantage to this plugin over mapping one key to ':tabopen' and another to ':tabclose %'? I have this in my .vimrc and it seems to get the same results: nmap :tabedit % nmap :tabclose

Splits are not tabs. Edit re below: OK, good point. But I would still prefer the plugin (and plan to install it) because I just don't use tabs, preferring to stick with splits.

True, but AlexSolution is saying that you can get the same effect without a plugin.

Open your split as a new tab. The new tab (i.e. that split) takes up all of vim. When you want to return to your splits, just close that tab.

Re: Vim Splits – Move Faster and More Naturally

#15
post #9
post #6

After years of abusing my little finger for using Ctrl & the RSI that goes with it, I tend to use alt/meta with my thumb more and more nowadays, for this I make it usable in insert mode also, this is probably one of the oldest bits of my .vimrc "quick window movements map map l map k map j map h imap li imap ki imap ji imap hi

Only problem with those imaps is that now you can't type ì, ë, ê, or è. Vim is pretty dumb about utf-8. I'd also suggest using instead of the ...i dance. Edit: "The way [Vim] stores alt+letter in its input queue collides with UTF-8/Unicode handling" -- LeoNerd in freenode/#vim at 2013-04-15 15:22:29

"Vim is pretty dumb about utf-8."

It might not work the way you prefer using your favorite input method, but vim allows you to enter any utf-8 character, and even has mnemonic digraphs for many you are most likely to want. To get è, for example, in input mode just type -k`e.

Re: Vim Splits – Move Faster and More Naturally

#16

In addition to that, I can heartily recommend the ZoomWindowPlugin: https://github.com/skeept/dotvim/blob/master/plugin/ZoomWinP... Basically, if you have multiple split windows, it allows you to do a cmd+O to zoom the current split view (i.e. making it the only view visible). That's neat if there's something tricky going on (say a weird bug) and you want to focus just on this piece of code, without seeing anything e…

Any advantage to this plugin over mapping one key to ':tabopen' and another to ':tabclose %'? I have this in my .vimrc and it seems to get the same results: nmap :tabedit % nmap :tabclose

I already have a fixed set of tabs open for different use cases, and switch between them frequently. Adding a new tab to that temporarily would probably confuse me. I may try the tabedit / tabclose solution nevertheless though, I hadn't thought about doing it that way. The advantage being that I'd have one plugin less :)

Re: Vim Splits – Move Faster and More Naturally

#17
post #13
post #11

I am SO SATISFIED with my splits key remapping I have to share it: map l map h map j map k map :split j " Horizontal split map :vsplit l " Vertical split map :close map K " Convert vertical to horizontal split map > L " Convert horizontal to vertical split

I moved over to evil-mode (Vim emulation) in Emacs a couple of months ago and do most things the Vim way but some things are more efficient to do in a non-Vim manner and this is one of them. Although I use M-- and M-| for vertical and horizontal splits.

+1 For evil-mode. I'm still using MacVim and Emacs+Evil side by side because many things that my vim does (via plugins etc) my emacs/evil doesn't do yet and I lack the time to research it all. But having elisp for extension is such a joy to use. I've dabbled a bit with evil, too, and I really like how easy it is to extend it.

Re: Vim Splits – Move Faster and More Naturally

#18
post #11

I am SO SATISFIED with my splits key remapping I have to share it: map l map h map j map k map :split j " Horizontal split map :vsplit l " Vertical split map :close map K " Convert vertical to horizontal split map > L " Convert horizontal to vertical split

You should use `nnoremap` instead of just `map`: http://learnvimscriptthehardway.stevelosh.com/chapters/05.ht...

HTH

Re: Vim Splits – Move Faster and More Naturally

#19
post #13

Earlier quoted context omitted.

I moved over to evil-mode (Vim emulation) in Emacs a couple of months ago and do most things the Vim way but some things are more efficient to do in a non-Vim manner and this is one of them. Although I use M-- and M-| for vertical and horizontal splits.

+1 For evil-mode. I'm still using MacVim and Emacs+Evil side by side because many things that my vim does (via plugins etc) my emacs/evil doesn't do yet and I lack the time to research it all. But having elisp for extension is such a joy to use. I've dabbled a bit with evil, too, and I really like how easy it is to extend it.

Funny, I just started using evil too. You might want to checkout prelude/projectile if you haven't yet. Also, less obviously for a vimmer, keychord.el. I'm able to use 'jk' for ESC, for instance. For others interested, the brief evil manual is worth peeking at: https://gitorious.org/evil/evil/blobs/raw/doc/doc/evil.pdf. Motions, text objects, and operators in theory are easy to add in elisp, which is cool. For this reason, evil seems unlike other vim 'emulators' that I'm aware of (could just be ignorance, obviously). I'm really digging evil though.

Re: Vim Splits – Move Faster and More Naturally

#20
post #9

Earlier quoted context omitted.

Only problem with those imaps is that now you can't type ì, ë, ê, or è. Vim is pretty dumb about utf-8. I'd also suggest using instead of the ...i dance. Edit: "The way [Vim] stores alt+letter in its input queue collides with UTF-8/Unicode handling" -- LeoNerd in freenode/#vim at 2013-04-15 15:22:29

"Vim is pretty dumb about utf-8." It might not work the way you prefer using your favorite input method, but vim allows you to enter any utf-8 character, and even has mnemonic digraphs for many you are most likely to want. To get è, for example, in input mode just type -k`e.

or `, delete, e if digraphs are activated (IIRC)
Post reply on HN