3 ms·
My single greatest tip to make vim even more amazing is to run it in a tmux session: It makes it super easy to split panes and create new windows for related th
by SeoxyS 14y ago
My single greatest tip to make vim even more amazing is to run it in a tmux session: It makes it super easy to split panes and create new windows for related things you need to do (git stuff, compilation, running tests, running a REPL, etc.)
- gnosis 14y agoYou can easily split panes (called windows in vim) within vim. You can also create new tabs within vim for related things you need to do. I still use tmux or screen to do other things which aren't convenient or elegant to do within vim, but splitting windows and creating tabs can be done just fine within vim itself (or, in my case, within gvim, which I prefer due to the increased color gamut and keybinding abilities over terminal vim).
- SeoxyS 14y agoWhen I said split panes in tmux, I meant to put shells, repls, or servers. I also use split panes and tabs within vim for extra buffers.
- q_revert 14y agoyou should take a look at https://github.com/jpalardy/vim-slime https://github.com/jpalardy/vim-slime , very handy for sending code from vim sessions to other tmux panes
- gfodor 14y agoHis/her point is to use tmux for splitting the editor and terminal windows, because vim sucks at subshells.
- zem 14y agoi use terminator for that. works wonderfully. http://www.tenshu.net/p/terminator.html http://www.tenshu.net/p/terminator.html
- grn 14y agoPersonally I have a mapping <leader>x that starts a terminal emulator when running under X or drops to the shell otherwise. When I work on a project I cd into its directory. Executing commands is just a matter of hitting <leader>x, doing what's necessary, and closing the terminal.
- pjungwir 14y agoThis is my setup as well. I open two terminal windows: the one on the left is used for "control" stuff, and the one on the right is for code. Then in each terminal I run tmux. For a Rails project, I have separate tmux windows for models, controllers, views, stylesheets, a psql prompt, etc. I've done it long enough that I know which window has which stuff, and each vim session only has a few files open, so it's easy to `:ls` and `:e #3` around. My scripts to launch tmux look like this: # ~/bin/ss-ctrl #!/bin/sh env_name=ctrl long_name=skillspy short_name=ss cd ~/src/${long_name}/site && \ tmux new-session -d -s ${short_name}-${env_name} && \ tmux rename-window -t ${short_name}-${env_name}:1 git && \ tmux new-window -t ${short_name}-${env_name}:2 -n log 'RAILS_ENV=development rails s -p 3009; bash -i' && \ tmux new-window -t ${short_name}-${env_name}:3 -n db 'ssdb; bash -i ' && \ tmux new-window -t ${short_name}-${env_name}:4 -n misc && \ tmux new-window -t ${short_name}-${env_name}:5 -n redis 'cd ~/src/redis-2.6.0-rc8/src && ./redis-server && date && bash -i' && \ tmux new-window -t ${short_name}-${env_name}:6 -n sidekiq 'RAILS_ENV=development bundle exec sidekiq | tee log/sidekiq.log; date; bash -i' && \ tmux select-window -t ${short_name}-${env_name}:1 && \ tmux -2 attach-session -t ${short_name}-${env_name} # ~/bin/ss-code #!/bin/sh env_name=code long_name=skillspy short_name=ss cd ~/src/${long_name}/site/app/models && \ tmux new-session -d -s ${short_name}-${env_name} && \ tmux rename-window -t ${short_name}-${env_name}:1 models cd ~/src/${long_name}/site/app/controllers && \ tmux new-window -t ${short_name}-${env_name}:2 -n controllers cd ~/src/${long_name}/site/app/views && \ tmux new-window -t ${short_name}-${env_name}:3 -n views cd ~/src/${long_name}/site/app/assets/stylesheets && \ tmux new-window -t ${short_name}-${env_name}:4 -n css cd ~/src/${long_name}/site/app/assets/javascripts && \ tmux new-window -t ${short_name}-${env_name}:5 -n js cd ~/src/${long_name}/site/app/workers && \ tmux new-window -t ${short_name}-${env_name}:6 -n workers tmux select-window -t ${short_name}-${env_name}:1 && \ tmux -2 attach-session -t ${short_name}-${env_name}
- AlexLegg 14y agoFor anyone using tmux and vim, I recommend having a look at vimux (https://github.com/benmills/vimux https://github.com/benmills/vimux). It lets you control your tmux pane from within vim. I use two tmux windows, one of each of my screens. One is code and the other runs `make && ./test blah blah` whenever I hit F5 in vim. To get vimux to use windows (as opposed to just panes) there's a fork under pull requests (disclaimer: I wrote it).
- statico 14y agotmux is fantastic, especially for remote development. However, you can't change a single pane's font size, nor is it easy to select an entire line of text using the mouse (with vertical panes). Thus I suggest iTerm2 for local development if on a Mac. If you haven't tried multiple panes with multiple font sizes — e.g., smaller font for logs/compiling/long-running, bigger for editing — then that's a world I don't want to live in. (j/k ;)