4 ms·
"I always find vim's window-manipulating commands obscure. . . ." What's obscure? I assume you're talking about the keys mapped to the commands, which can eas
by hsitz 12y ago
"I always find vim's window-manipulating commands obscure. . . ."
What's obscure? I assume you're talking about the keys mapped to the commands, which can easily be changed to whatever you want them to be. Trivial. Other than that, the operations themselves just seem to be basic stuff, splitting windows, closing windows, moving between windows. The common and obvious manipulations.
- chongli 12y agoRemapping default key commands is a fraught problem. Doing so acclimates the user to a custom environment which is not strictly a superset of the default environment. This makes it very difficult to switch to other environments and remain productive. Defaults enjoy privileged status.
- rane 12y agoPersonally as a developer (not a sysadmin), I choose to be more productive 99% of the time than eschew customizations because I might vim in remotely here and there.
- xiaq 12y agoI was referring to the commands to manipulate complex layouts. Take the following transformation for example: +---+---+---+ +---+---+ | | 1 | | | 0 | 1 | | 0 +---+ 3 | => |---+---+ | | 2 | | | 3 | 2 | +---+---+---+ +---+---+ The tmux command to achieve this is "move-pane -s .3 -t .0 -v", which reads very natural once you know the options. "Move the source pane 3 to the target pane 0 by creating a vertical split in the target pane". I then looked up windows.txt of the vim reference manual. In the window-moving section, we are given commands to rotate and exchange windows and move windows to the far left, right, top and bottom. So apparently I can achieve my goal by moving 3 to the far left, splitting 0 into 0a and 0b, exchanging 3 with 0a, and closing 0a. Which is why I always end up closing 3, splitting 0 into 0a and 0b and redo what I used to open 3 in 0b instead. Also, how do you split 0 when you are in 3, without leaving 3? In tmux it is simply "split-window .0". Apparently there is no way to do that in vim... Instead of consisting of a set of simple, powerful primitives, vim's window-manipulating commands are built from the perspective of special use cases. This makes these specific use cases easy but everything else hard. This is why I call them obscure.
- hsitz 12y agoThanks, I see what you mean. However, I think 'obscure' is the wrong word. Tmux seems to have analogous commands for most of Vim's, mapped to keys for use just like Vim's; they're simply the usual commands many people use to move windows(vim)/panes(tmux) around. The commands you mention (at least move-pane) are more flexible than Vim's window manipulation commands. That's the word I would use, 'flexible'. I think building a Vim plugin to emulate those tmux commands would be interesting project; I've put it on my list. One last thing. I'm curious what tmux command(s) you would use to transform the layout above back to its original state. In Vim it's quite simple, with cursor in your window 3, just issue command ':winc L'. I don't see anything as straightforward with the tmux commands you've described, but I could be missing something.