9 ms·
Dwm.vim : Tiled Window Management for Vim
- devgutt 14y agoI use TMUX with VIM for that.
- spolu 14y agoBetter yank/paste | over SSH support
- _delirium 14y agoIs there any way to run multiple vim windows from one vim process, with them sharing the same internal clipboard? To me, the window manager handling the window arrangement feels like The Right Thing, but vim handling the clipboard also feels right (because it interacts with many commands). So I'd like some hybrid of the two options of: 1) running multiple WM-managed vim instances; vs. 2) running one vim with vim-internal window management. I basically agree with the goal of running vim with dwm window management, but it seems wrong to have to reimplement dwm inside of vim, instead of using dwm itself to manage vim windows.
- milkmiruku 14y agoFor 2) you can use tabs in Vim to provide different workspaces, with each workspace having a certain layout of windows. I've just found out that dwm.vim doesn't work well with tabs just yet though - it copies all buffer windows to the current tab on Ctrl-f (make active window the master focus).
- spolu 14y agoYep this has to be fixed.
- dsrguru 14y agoAs an aside, you should also note that you can interact with the X clipboard from within vim or gvim. It's represented by the * register, so you can do things like "[asterisk]p to paste from other programs or "*Y to yank to them. Replace [asterisk] with the actual symbol. HN thought I was trying to italicize.
- devgutt 14y agoI bound some keys to this and works pretty well nnoremap <Leader>y "+yy nnoremap <Leader>d "+dd noremap <Leader>p "+p noremap <Leader>P "+P vnoremap <Leader>y "+y vnoremap <Leader>d "+d
- tammer 14y agoIf your vim is on a box with an X server, look into client/server mode. You can then specify if you want to open a file in its own process or in the server process you spawned earlier. Also, you can set the default yank register to be your X clipboard. Look into set clipboard = unnamed+ (make sure your vim is complied with X support for both of these)
- jlgreco 14y ago"Is there any way to run multiple vim windows from one vim process, with them sharing the same internal clipboard?" Yes, though you will need a Vim with support for it built. See `:h client-server` for details. (I never really got into using it regularly)
- arnarbi 14y agoI use XMONAD with VIM for that. :)
- spolu 14y agoThat looks cool!
- milkmiruku 14y agoI got into Awesome Window Manager a couple of months ago and have been getting to know how to manage remote Vim split windows with the help of NERDTree. A remote in-Vim managed tiling aproach would be cool though. Googling around, there's also https://github.com/fabi1cazenave/suckless.vim https://github.com/fabi1cazenave/suckless.vim which emulates wmii and has "[s]tacked, [d]ivided, [f]ullscreen" modes. I need to learn tabs also. Things can get busy on 1024*768!
- heretohelp 14y agoCtrlP + tabbar has done a lot to make this Emacs user tolerate the occasional vim outing.
- milkmiruku 14y agoWonderful, ta, I'll check them out soon! Links for the lazy yet interested; https://github.com/kien/ctrlp.vim https://github.com/kien/ctrlp.vim http://www.vim.org/scripts/script.php?script_id=1338 http://www.vim.org/scripts/script.php?script_id=1338
- spolu 14y agonice.
- milkmiruku 14y agoawesome wm, urxvt, ssh, tmux, vim, dwm.vim http://i.imgur.com/fC556.png http://i.imgur.com/fC556.png nerdtree <cr> opens things in the active window, nerdtree i opens a split in the master window, and a dwm.vim focus tidies things up. no fullscreen mode is unhandy though (i've not learnt how to unmaximise from Ctrl-w _ and Ctrl-w | yet). edit; silly me, doing Ctrl-f now unmaximises the window.
- malvim 14y ago+1 for tmux, I've been using it for a few months and loving every minute of it. One question about tmux/dwm.vim, though: Is there a way we could have the "focus"/automatic layout feature in tmux? I'd love to press a key combo and have tmux bring my current pane to the large left panel, switching it with whatever I had there before.
- xyzzyb 14y agoI don't understand. What does this do that vim buffer windows don't already manage?
- arnarbi 14y agoPresumably only the arrangement and sizing of windows. I.e. you don't have to :split or :vsplit manually, just create or delete windows and they'll be arranged according to the layout algorithm.
- spolu 14y agoYep, that's even better said
- spolu 14y agoIt forces a tiled layout that helps productivity by: - keeping all buffers visible - making jumping from one to another very easy - driving focus on the main buffer The advantages are well-known and demonstrated by dwm from which this plugin is inspired
- xyzzyb 14y agoAh, it helps automate the maintenance of that particular window structure. Nice.
- spolu 14y agoYep
- spolu 14y agoNow this is what happens when you do: dwm.vim < vim < tmux < vps < ssh < tmux < gnome terminal http://i.imgur.com/WR9JC.png http://i.imgur.com/WR9JC.png (courtesy of romainl on reddit/r/wim)
- spolu 14y agoHere's a screenshot as well http://i.imgur.com/TKL4i.png http://i.imgur.com/TKL4i.png available on the github of the script https://github.com/spolu/dwm.vim https://github.com/spolu/dwm.vim
- evan2m 14y agoI recommend Golden-ratio for this kind of thing: http://www.vim.org/scripts/script.php?script_id=3690 http://www.vim.org/scripts/script.php?script_id=3690 It does not take away the ability to do :split or :vsplit or force a particular layout. It does dynamically resize your windows to maximize visibility
- spolu 14y agoYep, that's a different religion. But it's just as good.
- lorenzfx 14y agoit would be awesome, if I could somehow use the same keys to switch between vim splits and my (tiling) window manager's windows. First move focus in vim, if I'm already in the utmost split then move the focus to the next window. Oh, and make it work with tmux's splits, too!
- spolu 14y agoI would also love to have vim brush my teeth! ;-)
- eterps 14y agoI am also looking for this functionality: http://superuser.com/questions/465780/anyone-know-how-i-can-use-the-same-keys-to-move-between-vim-windows-as-well-as-t http://superuser.com/questions/465780/anyone-know-how-i-can-... http://www.quora.com/tmux/How-can-I-use-the-same-keys-to-move-between-Vim-windows-as-well-as-Tmux-or-tiling-WM-panes http://www.quora.com/tmux/How-can-I-use-the-same-keys-to-mov...
- mukaiji 14y agoHN needs more posts like this. just saying...
- spolu 14y agoAgreed, Thanks, Upvote
- deleted 14y ago[deleted]
- heretohelp 14y agoI'd posted my dotfiles pre-restructuring, I'll repost it now that it's modularized. Maybe it'll catch this time.
- spolu 14y agoWe're far away indeed from the "Learn how you can code how it's hard to learn new things to learn how you can code" kind of posts :)
- pooriaazimi 14y agoIndeed. My dream HN has 30 of these posts on its front page.
- mwhite 14y agoI think this might be a minority constituency at this point.
- mrinterweb 14y agoNot quite figuring out how this is functionally different than vim's split buffers. Just seems less flexible than splits in that it did not mention that tiled windows could be repositioned or resized.
- msbarnett 14y agoBy default Vim's split buffers have some fairly annoying behaviours -- for example, if you accidentally close the file browser you have taking up the entire left hand of the window, all of the other buffers gobble up that space instead of retaining your painstakingly assembled layout.
- iankp 14y agoThis can be a common problem especially when working with a module which occupies a split, but doesn't depend on the file you're working on, like NERDTree. I've solved this problem in a fairly lightweight and elegant manner with the Bclose module, however, by (c)mapping bd to Bclose
- mrinterweb 14y agoI guess to each their own, but I like the default behavior of when a split buffers is closed that the other buffers resize to fill the void. I'd prefer to see the space available used rather than trying to find something to fill the empty buffer with. Unrelated, but I also enjoy being able to Ctrl+w,Shift+[hjkl] to move splits around relative to the other splits.
- msbarnett 14y ago> I guess to each their own, but I like the default behavior of when a split buffers is closed that the other buffers resize to fill the void. I'd prefer to see the space available used rather than trying to find something to fill the empty buffer with. Yeah, but the point is I closed it accidentally. So now I reopen NERDTree or whatever and have to spend a bunch of time micromanaging my splits back into the arrangement I just had them in. Wasted space sucks, but so does having things wreck my layout in an over-eager attempt to avoid it.
- luriel 14y agoAs one of the original instigators of dwm and wmii before that (mostly by shouting at garbeam) I want to point out that this kind of tiled window management was first introduced in larswm (that is sadly discontinued), which in turn was heavily inspired by Rob Pike's Acme editing environment ( http://acme.cat-v.org http://acme.cat-v.org ). So in a way we have gone full circle, from text editor, to window managers, back to text editor. That said, I still prefer Acme to vim, but would be really cool if somebody added mouse chording to vim :)
- pyre 14y agoI still prefer Acme to vim If you could expand on that (compare/contrast), I would definitely be interesting in reading it (blogpost, Show HN, etc).
- luriel 14y agoThe philosophies of acme and vim are so completely different that is very difficult to even compare. One of my favorite things about Acme is that it requires basically no configuration, you can write small scripts to perform certain tasks, so in a way it is 'scriptable', but this are usually little more than shell pipelines to transform text. I remember spending hours in vim simply looking around the huge mountains of documentation to find the right option to add to to my every growing vimrc, and when you wanted to do something slightly complex you had to use the rather bizarre vimscript. Yes, vim has bindings for python and ruby and a bunch of other languages, but this brings us to another issue with vim: every installation seems to be almost unique, it has no consistent defaults, or even available features, so even carrying your personal vimrc arond (which is a pain in the ass) is not enough as it might depend on some feature not enabled in whatever vim binary you will find in a given system. Window management and mouse chording in acme are simply a dream, while in vim i can rarely remember all the commands needed to manage windows, and the mouse is basically useless. I could go on, but if you have tried both, you will realize that the differences are quite fundamental and even philosophical, so I don't expect every vim-head to understand and appreciate acme right away, because it will not fit with what they expect from a text editor. All that said, I still use ed for quick edits, in part because it provides a consistent and almost universal interface, the trend some Linux distributions have of removing one of the most venerable and ancient Unix commands is very, very disturbing.
- kristopolous 14y agoThe most valuable two settings I know for this are: set ttymouse=xterm2 set mouse=n Now you can use the mouse to resize buffers and click on tabs. You can even click to focus on a buffer and don't need to meta-press your way around when you just want to browse things. Go on, click on topics inside of the help, assign the right click to supertab[1], navigate NerdTree[2] like the explorer clone it is. Collapse and expand code folds[3] like a 21st century digital boy.[4] Furthermore, your scrollwheel all of a sudden now scrolls through your document in putty, xterm, screen, rxvt, tmux, iterm; all of them. Yes, total heresy, I know. The only thing more important than this is doing a visual selection[5] and then doing a :!(any program) like say: fmt, sort, mail, python, rdoc, indent, bc ... I know what you are thinking; "But kristopolous, this is so easy; it is not possible". Relax my friend, this is unix, you know this. PS: Here's my custom vim builder/environment maker: https://github.com/kristopolous/vimbuild https://github.com/kristopolous/vimbuild [1] http://www.vim.org/scripts/script.php?script_id=1658 http://www.vim.org/scripts/script.php?script_id=1658 [2] http://www.vim.org/scripts/script.php?script_id=1643 http://www.vim.org/scripts/script.php?script_id=1643 [3] http://vimdoc.sourceforge.net/htmldoc/fold.html http://vimdoc.sourceforge.net/htmldoc/fold.html [4] http://www.youtube.com/watch?v=ZN6kCgMUjFw http://www.youtube.com/watch?v=ZN6kCgMUjFw [5] http://vimdoc.sourceforge.net/htmldoc/visual.html http://vimdoc.sourceforge.net/htmldoc/visual.html
- jlgreco 14y agoDo you mean `set mouse=a`? `n` just makes it work while in normal mode iirc, while `a` should work in any mode.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- michaelmior 14y agoI was excited for a minute, but the ttymouse change did nothing for me on Mac OS Terminal with vim 7.3.
- rjzzleep 14y agofast tiling splits in vim? hell yeah i say. one thing that would be nice, would be to preserve window width ratio on ctrl-f
- spolu 14y agoYep, that's a good point. I'll file an issue on that (https://github.com/spolu/dwm.vim/issues/5 https://github.com/spolu/dwm.vim/issues/5)
- pooriaazimi 14y agoAbsolutely wonderful. I had another plugin like this (that probably came with `janus`) and did the tiling, but was really complicated and I never get to use it anymore. Something odd though: Isn't ^f supposed to do a 'page down' by default? The 'focus' part of his plugin didn't work for me and I had to change the mapping to ^m instead.
- spolu 14y agoThis has been changed to ^h (https://github.com/spolu/dwm.vim/issues/2 https://github.com/spolu/dwm.vim/issues/2) You still need to download from github at this stage. Will push a new version today. Thanks!
- pinchyfingers 14y agoEmacs has awesome window management built in, just sayin'.
- firefoxman1 14y agoThis is a really nice plugin. I actually already had Ctrl-N mapped to a horizontal split, but this adds more functionality.
- abhishekam 14y agoThe ^F for focus doesn't seem to work - but the rest are really nice and helpful. Thanks very much.
- spolu 14y agoPossible that there is a mapping conflict with some of your scripts. (see https://github.com/spolu/dwm.vim/issues/2 https://github.com/spolu/dwm.vim/issues/2)
- grannyg00se 14y agoOne vertical split and two horizontal splits. Vim already does that. What does this add?
- exDM69 14y agoIt lays out the windows automatically in Vim like dwm and similar window managers do on X11. Manually opening and moving windows is a bit tedious, this might help.
- sunkencity 14y agoYep, this is almost exactly what I do normally with vim, but that I have another column for nerdtree and possibly 6-8 splits. I find that it's pretty easy to move around, and that I can bring out tabs with a work-area for each thing I'm working on.
- csl 14y agoI use iTerm2 on OS X with window splitting, with focus that follows mouse. Here is an example using several vim processes: http://i.imgur.com/Xsh8f.png http://i.imgur.com/Xsh8f.png Of course, you lose the ability to use vim copy buffers between the processes, but it works well and I like the look of it.
- lucaspiller 14y agoI have this in my vimrc which provides 90% of this: noremap <C-h> <C-w>h noremap <C-j> <C-w>j noremap <C-k> <C-w>k noremap <C-l> <C-w>l You can then jump between splits with Ctrl and the navigation keys.
- linhat 14y agoSame here. I do not really understand the need to have a 'window manager' inside vim. I'm a long xmonad user and I think tiling window managers are great (wish there would be a worthy native os x implementation), but adding yet another plugin to my vim setup doesn't really seem feasible, especially when one can map its core functions with a couple of lines. Vim provides uncountable ways to manage splits, including resizing, switching etc, and then there is still vim's great tabs feature to be discovered to reduce the on-screen mess splits can produce... That said, hat-tips to the author for managing to create a plugin for vim using its rather obscure vi/ex language.
- yogsototh 14y agoI've also done that. Using it with NERDTree, my typical vim session looks like (I select files in NERTree using `i` most of the time): +-----------+ | | | | F | S1 | | i | | | l |-------| | e | | | s | S2 | | | | +-----------+
- malvim 14y agoNot sure it provides "90% of this". Your mappings ARE really cool (in fact I've just added them to my .vimrc, thanks). I think the nicest feature of dwm.vim, though, is the "focus" and automatic layout of windows. Big left pane + lots of small panes on the right seems like a nice way of doing things...
- cturner 14y agoI think it's a mistake to overload ctrl+b. That's taken by standard vi functionality. If I'd written this, I'd have been tempted to use ` as a leader. So `n would open a new window. `b would open that buffers view currently bound to ctrl+b.