Tmux and Vim – better together
blog.bugsnag.com
blog.bugsnag.com
I've been a multi-decade Vim user, until I switched to VSCode last year. It made me realize how much better the user experience can be for an editor. I had all kinds of complex vim configurations and plugins with special cases for linux vs. mac, server vs. desktop, GUI vs. terminal, all of which are a huge pain in the butt to maintain.
If there was one thing I could ask of Vim (or even emacs), it'd be a consistent high-quality default user experience.
(Ofcourse, the default experience in VSCode isn't perfect either, but it took me four lines in settings.json and four plugins (vim, go, eslint, clang) for a near-perfect experience.)
Sure, I understand that, and it's tricky maintaining a balance between simple configuration and features. My point is that with VSCode, there's just so much I get for free, with a very pleasant user experience. I still use vim when I need a quick editor in a terminal, but VSCode is my always-on go-to editor of choice for coding.
> I suppose over the decades you used vim your vimrc accrued many layers of cruft.
Yeah, I think I've got about 2 - 4 years of cruft (because I refactor and garbage collect a little bit every year.) But not 20. :-)
Still, it's a pain point that VSCode takes away. :-/
Interesting. May I ask why you use that particular smiley then? If VS Code works better for you, isn't that a good thing?
However, I would also be interested if there's more to this for you than the configuration. VS Code is the nicest editor I'm allowed to use at work (because it's a MS product, some companies are really paranoid when it comes to other software) - but I never really warmed up to it. It feels very clunky to me when compared with Sublime Text or Neovim. Also the Vim plugins for it really haven't impressed me so far.
Am I missing something, or is this a pure matter of taste?
execute pathogen#infect()
syntax on
filetype plugin indent on
set list listchars=tab:>-,trail:-
set ff=unix
set autoread
set number
set relativenumber
set linebreak
set tabstop=2
set shiftwidth=2
set expandtab
set ignorecase
set smartcase
set timeoutlen=1000 ttimeoutlen=0
let $BASH_ENV = "~/.bash_aliases"
color desert
set cursorline
augroup linehighlight
autocmd!
autocmd InsertEnter * set nocursorline
autocmd InsertLeave * set cursorline
augroup END
:hi CursorLine cterm=NONE ctermbg=darkblue ctermfg=white
:hi Normal ctermbg=blackI've been using vim since 2009 and tmux for the last 5 years. Initially, I had to figure out how things worked, and that took some time, but I never spent any time configuring it now except if I find a new plugin and figure out a new feature I'd like to add.
If you want IDE like features i.e Autocomplete than you have to spend days to make it work and even after that it doesn't work like other "GUI" editors.
+ Terminal interface is very limiting to have nice plugins...
I'm really glad I've switched to VSCode..
Indeed, but it doesn't really matter since the default experience in VSCode or IntelliJ or Xcode or any other IDE or editor doesn't work for me out of the box either. I have to change things anyways, and I can't change VSCode or IntelliJ or Xcode to fit my liking, but I've been able to change tmux+vim to it, although it could be even better.
> If you want IDE like features i.e Autocomplete than you have to spend days to make it work and even after that it doesn't work like other "GUI" editors.
For stuff like Go, Rust, Elixir, Python and so on, it works fine with when just installing the default "brand" plugin. Taking python as an example: even though "intellisense" in vim is worse than in pycharm, the rest of pycharm is so much worse than tmux+vim. "Intellisense" not being 100% in tmux+vim is not a dealbreaker for me at all. I can get by without "intellisense". But pycharm is so much worse for everything else than "intellisense", from basic editing to opening files to running shell commands and everything else I use all the time, which is a deal-breaker for me. For something like iOS+Mac development where I feel like I can't work without proper "intellisense", I do use Xcode.
> + Terminal interface is very limiting to have nice plugins...
Indeed, but still, even though tmux+vim sucks on some points because it's text-based, it doesn't suck enough to not be usable, and all these other editors and IDEs like IntelliJ, xcode, netbeans, sublimetext, vscode, atom and so on complete sucks for all the important things I need, which is a deal-breaker.
I disagree. The default settings of Visual studio work perfectly fine for me. As an added advantage, I can use other developers in my companies workstations to show them something quickly if I need
> For stuff like Go, Rust, Elixir, Python and so on, it works fine with when just installing the default "brand" plugin.
and so on? I'm a C++ developer. Setting up C++ autocomplete is anything but straightforward in vim and emacs
That's lucky for you, but unfortunately, it's not the case for me at all.
> As an added advantage, I can use other developers in my companies workstations to show them something quickly if I need
I might be using other peoples computers 10 hours a year, but I'm using my own maybe as much as 2200 hours a year. It doesn't seem logical to take the first scenario into account when deciding whether to customise ones setup or not, but it's indeed a nice bonus if ones optimal setup is the default one that every other developer is using too.
> and so on? I'm a C++ developer. Setting up C++ autocomplete is anything but straightforward in vim and emacs
I don't use C++ anymore, but 7 years back when I did, it worked good enough for my use case, and the problem with other IDEs and editors were the same back then as it is now, where they were actually hindering my work, which a less than perfect "intellisense" doesn't at all. YMMV.
The one problem I had was that I had to use the system version of clang as I'm using Arch.
That said, there is a fair bit of built-in auto completion in vanilla vim (on par with VSC), and a few quick rebinds might be all you need. I would suggest checking it out.
:help 24.3
(I wish it were indexed a bit better in the help files. :/ )Frankly, I would use neovim + deoplete. Modern, async, and a big user community right now (almost everyone with neovim runs deoplete).
[0] https://github.com/zchee/deoplete-clang [1] https://github.com/zchee/deoplete-clang/issues/57
./install.py --clang-completer --gocode-completer --racer-completerI used Vim for a good 5 years. I still miss many things about it, but a shitty default UX is not one of them.
Usually because the box doesn't have coreutils, make and exctags installed. Bloated plugins are snakeoil, they push vim to the dark^WIDE side, where the battle is too Pyrrhic to win.
edit: Just opened VSCode again and noticed one other major thing that has been driving me crazy. In vim I often have files open in different panes and then make one pane full size while editing. Can't do that with splits in VSCode as far as I know.
EDIT: The biggest problem, for me, is that since they are all dotfiles, they are invisible to normal ls operations within the stow directory. It's a minor nit, but it can be quite annoying to run up against.
Any change I make to a dotfile then shows up on any other machines.
https://github.com/RichiH/vcsh
I have separate repos for SSH, Bash, VIM, and other stuff (like .inputrc).
Yes, it took an initial investment but now it just works everywhere and maintenance is low.
(Some people say git repos in clouds sync are bad, but I have had zero problems with them over the years.)
Besides that, I don't see how a better way to do it.
No extra tools (just git), no symlinks.
So in my vimrc folder, I've got a work file, a school file, a home file, and a base file (which applies everywhere). Then I have a bash script that stitches all the relevant chunks together into a cohesive file for a given location. It can even do sub-locations by adding underscores to the name. E.g. 'work_nas' will produce a file consisting of the base, work and work_nas files, concatenated together.
This all sits in a private git repo, and I just manually copy the output files to wherever they belong whenever there's an update to them. I've been thinking for a while about writing a script to copy them into place, but GNU stow looks pretty interesting.
What the OP is saying that this doesn't have to be a perpetual state. Once you invest effort early on getting it right you often don't need to touch it, beyond a few tweaks now and then. The maintenance burden definitely declines over time.
Then all you need is a storage solution like git and GNU Stow or the various clones (plenty of good ones around or just use a basic dir).
There are a few preconfigured configs on github, ala oh my ZSH but for Vim or Emacs. That's one solution.
But otherwise if you're not a fan of this config heavy approach then it's not for you. Just like using Linux desktop vs Mac. I love the configurability of Archlinux and I've similarily reached a mature point in my configs where setting up a new machine is zero work and I rarely need to tweak it, nor does it ever 'break' (which is a side effect of constant change).
To me, the real hurdle to vim (or emacs) isn't configuration : it's learning vim (or emacs). That muscle memory doesn't come from a .vimrc file, and it doesn't come overnight. Is that what you meant by "quirks"?
I don't think anybody doubts that there's a steep learning curve and some investment required to get set up, but you get a completely custom user experience out of it. And if you stick with it for years you're definitely getting your investment back.
emacs on the other hand, even as an experienced programmer, I found near unusable in its default and after a week of frustration with all the inconsistencies and oddities gave up on it. Which is a shame because obviously it is the more powerful of the two. I wish someone would create a modern editor in the spirit of emacs.
Unfortunately, they used bloated Electron framework.
Little over a year ago I began sketching out a native Mac OS editor, taking ideas from xiki, ia writer, emacs.
The core API was mostly fleshed out. I just got wrapped up in personal life stuff. Might have to take another look at that soon.
One thing with emacs is that some Alt bindings do not work over remote connections. Maybe it was my fault but I could not get all Alt bindings to work.
Were you connecting from a Mac to Linux? Emacs on OS X has Esc as meta by default, which means you need to redefine the meta key to be Alt or else it's basically unusable.
I think emacs is the modern editor in its own spirit: none of the imitations come close.
[1]: https://marketplace.visualstudio.com/items?itemName=JaredPar...
[2]: https://marketplace.visualstudio.com/items?itemName=ZoltanKl...
VsVim is getting really good though, it even reads your vimrc these days.
My packages are static and I only update when there's a good reason to do so.
I tried VS Code for a couple months last year. It felt like less of a hassle than vim from 10 years ago. But with pathogen, cloning into .vim/bundle doesn't feel any more burdensome than finding the best plugins on VS Code did.
I mean, to each their own.
I moved quickly back to tmux/vim.
I use sublime, atom and VSCode every once in a while when pair programming but apart from intellisense/autocomplete I don't get a lot more value from the Vim alternatives.
The thing that confuses me most since the switch is vim's visual selection mode. I used to be a really heavy user of visual selection mode (V and v), but since selection is at the core of what kak does, vim's way of doing it seems really clunky now.
If I'm going to be spending more than half an hour on a machine, I'll probably end up taking a minute to build kak on it.
I will never be forced to use vi! ^__^
If you're not interested in kak because of that paradigm change why are you interested in it at all?
Furthermore, Kakoune has a JSON-RPC user interface option that new UIs could be built around:
https://github.com/mawww/kakoune/blob/7482d117cc85523e840dff...
So it could happen if you wanted it bad enough!
I was in a similar situation. I had a lot of junk in my config files from when I started learning vim seriously, a lot of which I never really used. I've recently started to rebuild them to try and simplify things, cut out the unused but "neat" stuff I added over time, etc. Kind of the nuclear option, and largely a result of a failure to adequately comment my dotfiles.
That's the tradeoff with editors like emacs and vim, unfortunately. Pretty much everything can be customized or tweaked, but it's mostly on you to explicitly do so. Spacemacs/SpaceVim/SpaceNeovim are some impressive default experiences, but they achieve that through large, complex config files that make it difficult for beginners to parse. I was recently talking to a friend who was thinking of switching to vim, and to be honest, I was a bit unsure about recommending one of those configurations when asked for a good default. They have some fairly well-defined conventions of their own, and while that allows some pretty neat stuff, it struck me as limiting for the beginner. With a configuration that's so tightly written (not sure if that's the best way to put it), I kind of felt like I was setting them up to use vim, but not be vim users. They might make tweaks in the future, but they might never dig deeper to really customize it. Or worse yet, even realize they can beyond a sort of intellectual acknowledgement of the possibility.
At that point, they might as well be using Atom, ST, or another GUI editor.
So the way I feel about it now is, yes, it would be nice to not have to deal with these configurations. But so far, editors like this aren't as good as the ones that do require more complex configuration, at least in my opinion.
But as others have mentioned, it's not so bad. Once you get your config right you can mostly leave it alone.
The problem is vim editing never quite mixes well with other editors. The vim plugin for VS Code is great, but do you let it take over Ctrl? Do you get Ctrl-R for redo, and sacrifice other VS Code usages of Ctrl for example? The vim plugin is also pretty buggy here and there and no matter what, I always find a vim plugin is missing some vim feature I depend on.
It's frustrating in a first world sense. It's hard to have your cake and eat it too with vim.
The obvious example would be using the neo-vim frontend to interact with VSCode, Eclipse, IntelliJ, etc.
What I want most is a Neo-Vim frontend to org-mode in Emacs, because it would be hilarious and because while Spacemacs is kind of cool it's still not Vim. And org-mode is awesome and unparalleled but vim > emacs all day.
Another interesting approach is VimR (http://vimr.org/), which is Neovim combined with native IDE addons such as Markdown preview, file tree, etc. The nice thing about VimR is since the whole thing is one cohesive package, the developers can ensure it has a consistent experience. Sadly it's OSX only though.
From the prompt, it is faster to open a large file in vim than emacs since you have to wait for all of the spacemacs plugins to load.
M-x customize
buffer -> tab
window -> tile
For many, though, once you get your environment set up, it feels amazingly natural, more than an IDE could provide. It's more a matter of taste than anything.
* Autocomplete. This deserves way more recognition than it gets. Having function signatures, documentation, overloads, types, available IN-LINE while you type saves so much work from programming and is essential to delivering correct code. If you want to be an effective programmer, this is a fundamental tool.
* Debugger. Easy breakpoints, conditional breakpoints, built-in profiling... Without these features, you will consistently produce inferior code.
I don't see how someone who calls themselves a serious programmer can throw away these exceptional tools.
VIM and other lightweights have their place, their place just isnt serious programming (by which I mean large software projects).
Whats more, VIM and similar tools make each step of the process, including incredibly simplke things like compiling and running your program, take exponentially longer and are similarly more xpensive to the programmer. I think most folks who don't believe this are simply in denial. VSCode delivers on these two features and is instantly an infinitely superior programming experience.
Its a cult.
An idiot savant is still an idiot.
I'll welcome any points made for VIM that acknowledge the immense value provided by IDEs, but if I had already seen such points I wouldn't even be posting here today.
Every argument I've seen for VIM systematically denies:
* That programming is hard work.
* That making life easier is a good thing.
Its just an extension of the masochism that permeates programming culture.
Where vim and command line tools shine is giving the developer powerful tools to examine and manipulate projects, as they exist, on disk.
I personally believe there's a place for both. Vim and the cli are my secret weapon when it comes to comprehending, researching, and working with large, legacy, java enterprise applications. I only use an IDE when I'm actually editing java source files, which isn't very often. YMMV.
The individuals you are disparaging are merely talented developers working on useful projects they possess neither a surprising intellectual talent nor profound disability.
Despite your very superior opinion of yourself disagreeing with you doesn't imply mental disability.
In general, the stronger your opinions the more you must work to ensure that they're communicated in as non-alienating a way as possible. This is one of the fundamental forces of communication/persuasion. As it stands, your current comment leans on hyperbole quite a bit, and uses unkind labels for groups of people who are quite likely to read your comment. As a result, I suspect your comment may not go over well.
Linus uses microEMACS, Guido uses emacs, Bjarne uses sam. The list goes on. What is your point exactly? That they are all fools & idiots? Or that the Linux, python & C++ projects do not qualify as serious programming?
Is it unfathomable that they know something you don't? Is it inconceivable that some people out there have a different yet valid opinion?
My personal experience with the few large codebases I've had to work on in the past is that IDEs would choke on them. If we wanted to get any work done that day we'd have to do it in a lighter code editor. As an added bonus, if we used vim or emacs we could now be as proficient remotely as we were locally.
http://vimdoc.sourceforge.net/htmldoc/usr_24.html#24.3
And a debugger doesn't have to be built into an editor to be functional. PDB, GDB, PRY, your browser's built-in debugger... all are quite useful without being built-in to your code editor. As a bonus, all but the last can be easily accessed from your terminal (which, hey, you have multiple terminal windows readily available in tmux!).
Sorry, troll fed. My apologies.
Coding. This deserves way more recognition than it gets. Having function signatures, documentation, overloads, types available IN-YOUR HEAD while you type saves so much work from programming and is essential to delivering correct code. If you want to be an effective programmer, you need to stop relying only on autocompletion.
And as always.. have a nice day!
I've only spent a few hours in GDB so far (mainly because my working environment doesn't let me), but once you've tried it, it's astonishing how little comfort most IDEs actually give you when compared to it.
I had to remotely debug C/C++ code on a very obscure ARM platform. Normal IDEs didn't get me anywhere. There are GDB wrappers like Nemiver that worked, but still were very clunky.
But with GDB in TUI mode, I just had to SSH in. If I have to learn two or three commands to use it, so be it.
Every time I have to do any of that remote debugging dance with any Microsoft product, I still long back for my GDB terminal. :-/
Immediately, VS code took ~4 seconds to start. From there, I opened a text file and just started typing, and immediately my CPU usage spiked. From further examination, any kind of redrawing by VS code seems to cause the entire application to be redrawn on the CPU, meaning typing text in VS code causes ~30% CPU usage across most of my cores[0].
I'll pass.
Maybe there's a solution with SSH file systems or similar, but now I'm getting into the realm of configuration we were hoping to avoid, right?
For a while I was even using a Chromebook and doing most of my coding by SSHing to my much more powerful desktop.
I wish I could have had some sort of true-integrated-vim-key-bindings, none of the vim-bindings plugins feel as productive, but editor as a whole has a lot more features for a lot less work.
There are a couple of things which I think could make the default config simpler:
- Enable global-subword-mode by default.
- Enable delete-selection-mode by default.
With that, and maybe adding multiple-cursors to the default distribution (with a little bit more refinement) and I could use it out of the box. I would still probably set up colours, and I like my fonts really tiny, but those would be a matter of customization.
One other thing maybe is making M-x customize more discoverable. I think for a lot of users (including myself sometimes) it is sometimes simpler to search for an option by what you think it should be called, and select one of the known good values than it is to write the elisp expression for it.
FWIW I find both Prelude (https://github.com/bbatsov/prelude) and Spacemacs (http://spacemacs.org/) to offer pretty out-of-the-box experiences.
One huge advantage is that I can run the dev setup on a remote server which allows to keep the entire enviroment with all build tools and watchers live and persistent for weeks. You can do this on a local environment as well if you never shutdown the system or suspend only but it still feels different. Just an example: You worked weeks ago on a side-project and want to get in again for a small fix. Just to recall and open all relevant files, run the build tool and server plus tweaking the layout requires five minutes and usually you don't do it, you just want to fix one line and not think about the project setup. With tmux you go to the respective workplace with prefix+p (for previous) in case you kept the workplace still running. That's it. With a 1GB RAM VPS I can run many tmux workplaces/windows each with ~8 vim instances or other processes.
Further, I can develop on any of my notebooks/PCs/OSes with an ssh client installed, even on my phone. Btw, tmux and vim are perfect for phone keyboards, try it and it happens really frequently that you are on the go and want to try another idea/fix. Here, prefix+z for zooming into a pane is quite helpful.
And when I get a new computer my dev environment doesn't have to be setup again. I am still using the same remote server which survived three notebooks now.
And a (small) bonus: If you want to show coworkers your work in a browser (if it's a website) you give them just your static server IP without the need to ifconfig your current local dynamic IP before.
Running your dev environment remotely is a small thing but makes a huge difference in daily use.
What terminal emulator do you use on your phone? Android, right?
To make the experience even better, try replace ssh with Mosh
Its perfect for mobile or desktop.
Also changing from bash to fish will make it even better.
i3 is a window manager that can outcompete anything you can do with vim splits or a tool like tmux/screen. It's whole existence is based around putting windows in the right place at the right time.
Ranger is a vim-like ncurses file browser. I think it's genuinely one of the most underappreciated tools in programming. The ability to hjkl through your file system, with quick marks, with vim-style cut/paste, with visual mode, with about 20 other things that I use daily which just means that no other viewer comes remotely close.
My typical flow has between 4 and 12 terminals open, with the bulk being ranger->vim, which allows me to easily navigate complex project structures. The others are usually make, or htop, or some ssh.
I'll usually have a couple of web browsers open in another workspace as well. i3 tiling extends to all applications.
Applications that works in fullscreen (mpv, vlc, video games) requires you to set them fullscreen/floating, either yourself with a keybinding (Mod+f on awesome) or through the wm's config file. Some applications do not like tiling at all, some java gui apps from what I remember, but there are so few of them that I can't actually give you any example.
I say give it a shot, but beware: controlling your desktop entirely from your keyboard is addictive.
(awesome 4.x is more mouse friendly than awesome 3.5: in addition to the above, you can also change a few client modes with the mouse: float/tiled, maximize, stick (ie. display on all workspaces), on-top, close.)
Keyboard only: adding/removing columns/masters, moving a client to the master area, resize master area, move client to another workspace/screen.
Tip: Once you realize that you can make everything tabbed/stacked, your workflow becomes really fluent.
Example:
Workspace 1:
Stacked (left):
VIM - ASM / C
terminal
Stacked (right):
ddd
firefox (stackoverflow ftw)A classic gem is ":w !diff % -" to see what I've changed since the last save.
Thanks for the nugget.
# Make Ctrl-z also resume background process
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zleush-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z zle flush-inputI had to make a few small tweaks, like making it easier to switch between VIM and terminal panes, but overall I'm very happy with the Neovim + terminal mode setup.
Does Neovim provide this functionality?
Seems like some solid software other than that, I'm glad there's an option that interferes so minimally.
Do you know any good beginners guide?
Honestly the GitHub repo explains about everything. I check in on r/neovim, as the main contributor posts there often and helps people with problems/questions (I mostly just like reading about the new stuff their doing on the subreddit).
--
Dunno is it only me but I see a weird thing going on with "new" Vim community.
Everyone is starting to use it as a VSCode or Atom, trying to use hundreds plugins but most of them don't even know how to use tabs properly... I see most of this by new "neo" fans "you don't know how to make a thing in Vim? Download Neovim... or even Spacevim configuration." type of way. :)
Don't want to start a war here because every editor has it's own fans and I do not want to offend anybody either. But every one should learn to use vanilla version of their editor of choice before moving further.
Now what you may see, to your point, is people pushing (one of the many versions of) Spacevim on those forums. And they are shat upon rather immediately. It does happen though. But that at least makes sense, because those programs make using vim "easier", therefore eliminating issues users may have.
But neovim? Certainly not. The only time that would be a suggestion for someone is if they want some of the features neovim has over stock vim (maybe they want saner defaults, for example, or don't like tmux and want an integrated terminal).
My point here is only to learn first and extend further. Not throw yourself into high water with SpaceVim and than say how much vim or neovim is bloated.
I personally do not have the patience for it even after giving it a try. But in my case, my 3yo laptop might just be too slow to handle all that bloat.
You can learn basic Vim commands in 30min with vimtutor. One thing to keep in mind is this: https://danielmiessler.com/study/vim/#language and this https://www.vi-improved.org/recommendations/
I have a function in my .vimrc ( https://github.com/Morantron/dotfiles/blob/master/vimrc#L229 ) that allows me to send current vim selection to the adjacent tmux pane with vimux. This comes in very handy in REPLing sessions ( MySQL and the like ).
For copy pasting stuff ( like ids, urls, SHAs, etc ) I use https://github.com/morantron/tmux-fingers which is awesome and you should totally try it! ( </shameless-plug> )
Tiling Window Managers are awesome, and I totally see why people who can't use one would choose to use Tmux, but if you have the option, I would totally recommend just going with the TWM and skipping Tmux.
If I find myself craving extra functionality I'm probably overthinking things and am in need of a vacation.
When I work remotely, I use the tmux integration provided by iTerm2 to provide more native windows, and it works well enough that I don't have to think about it most of the time.
If I were moving back to Windows or to a Linux development machine, I probably would go back to tmux in a single window. I'm just somewhat glad I don't have to right now.
https://github.com/chilicuil/dotfiles/blob/master/.vimrc#L25...
https://github.com/chilicuil/dotfiles/blob/master/.tmux.conf...
One additional trick I often use is to look for inotify events in split tmux panes to compile/run tests on every save.
https://superuser.com/questions/181517/how-to-execute-a-comm...
I had some problems with CounqueShell and ended up finding it easier to switch to a "real" shell using byobu.
Of course, you can always ssh in to a shared account.
I've also done it through a cheap digital ocean instance but compilation speeds are much worse and running tests takes longer, but it's a bit easier to set up and try out I guess.
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
Anyone with the same problem?
In my main .tmux.conf I put:
if-shell 'test "$(uname -s)" = Darwin' 'source-file ~/.tmux-osx.conf'
And then in .tmux-osx.conf I add: # https://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future
# To copy/paste on OSX just brew install the following
# brew install reattach-to-user-namespace
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
I only pointed out the separation of configs because it's kinda nice for my setup.set-option -g default-command "reattach-to-user-namespace -l zsh"
E.g., if you don't use a plugin for command execution and instead learn about ":!command" then you will at some point be able to automatically read the results from your command into the current buffer (":r !command"). This enables a complete set of features that you haven't even known before. For instance you won't ever have spelling errors in your IP addresses ever again, because you just read them with a ifconfig-grep-awk combo into wherever you want to paste it. If you also learn about creating your own vimcode functions you can make it even a hotkey to insert your current ip address at the cursor position.
All of that wouldn't be possible to discover if you used a plugin to execute shell commands from vim.
And let's assume we can agree on that: Great plugins and great skill can on average be just as good. Why do I think that in vim plugins are the wrong course? Because everything in vim is based around skill. You can't even navigate efficiently without spending some time learning search, word/block navigation, etc. If one wants to achieve success with plugins I'd say it's much smarter to build your tools on a foundation that is created for plugins like emacs or an IDE.
No, I don't think I have a brain injury.
ConEmu really is an amazing piece of work. Quirky to configure (but hey, so it tmux), but truly amazing still :-)
> Cmder is a software package created out of pure frustration over the absence of nice console emulators on Windows. It is based on amazing software, and spiced up with the Monokai color scheme and a custom prompt layout, looking sexy from the start.
I'd use Cmder if I needed to carry a complete environment around on a USB stick, but it's not difficult to set up something similar for a single system manually with ConEmu.
Not sure about selecting panes with mouse though
$ cat ~/.tmux.conf
set -g default-terminal "tmux"
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
set -g mouse on
setw -g mode-keys vi
set display-panes-time 3000 #3s
My two wishes:- I wish mouse selecting text didn't select across multiple panes, or all of the blank space in a (zoomed) single pane. ("Anyone? Anyone?")
- I wish the tmux copy buffer ( ctl-b [ select yank ctl-b ] ) would copy into the system copy buffer ( ctl-v ).
That would be a nice way to integrate with the surrounding environment without so many plugins, just simple programs that would run in a separate window.
Vim remote can help, neovim-remote might help even further.
I'd love something configurable, like a dedicated WM key, a dedicated tmux key and a dedicated vim/app key.
I'm sure it's possible to setup manually, but it would take a lot of work.
https://github.com/gnunn1/tilix
It has panes, sessions, windows. Customizing is a lot easier if you're not already familiar with tmux. The one thing you get with tmux that's killer is if your shell dies (remote disconnect, you have to logout, etc) the processes in tmux keep running.
What I liked the most about your article is that 'further reading' section at the bottom!
I have mapped Ctrl-C to ESC and I use it often. One specific instance I have seen vim crash is when the cursor is at np.inf and I press Ctrl-C.
I don't use any plugins though. I haven't found a single usable plugin. They are terrible hacks. I figure vim must have an API that's difficult to integrate (it's too general a text editor. Look at the amount of built-in settings that hardly play nice with each other).
It's also worth spring-cleaning your config/plugin setups.
Instead I use i3 to split screens, etc. much better imo.
Still often use tiling though to tile a browser with a terminal or two browsers.
Anyway, using tmux for selection in vim is a bad idea. You can give vim mouse support by `set mouse=a`, which will prevent tmux from capturing selection and scrollback control if you like. Achieving parity between vim, system, and tmux clipboard (and for bonus points, across a network) is left as a "fun" exercise.
You can let vim catch the mouse clicks / drags and have it manage you X11 clipboard (start looking at vim help for :set mouse=...). Personally I prefer to not have vim mess with my mouse and X11.
I think it's better to just use vim's horizontal selection ("visual line", Shift+v) and use yank (y key) or filter it into an extern command like "xlip -i -selection clipboard" to copy the highlighted text into the clipboard.
set clipboard=unnamedplus
Then all yanking and deleting will put the yanked or deleted text in the X11 clipboard, from whence you can paste it in other applications, including terminals. For more information try help registers
I use this all the time, and find it essential (no mouse required).https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/
I'm just learning all of this, but since it's a suggestion from some smart people I bet, just like in vim, that you can do a lot more once you've overcome the first pain of using it correctly.
I also tried out vim-arpeggio but kept seeing "Arpeggio is not defined". Looks like the project hasn't been updated for a while.
# Enable mouse set -g mouse on
# Sane scrolling set -g terminal-overrides 'xterm*:smcup@:rmcup@'
bind-key -n C-t new-window
bind-key -n C-w kill-window
bind-key -n C-n next-window
Some easy things are usually much faster to learn in a traditional IDE, since it has GUI. But that often leaves people less able to continue development _OF_ their development environment. If you want the full power or understand how stuff works underneath you better use an OS that works as IDE, e.g. Linux.
It went nice for me with mingw/msys and selected tools for few years, but modern windows (>=vista) ugliness and death of native windows gtk distribution completely dimmed it. Msys2 may be a solution, but what a mess it is for non-packaging people. Since yesterday night I'm more than happy with mint/xfce laptop again.
I really don't need anything windows-specific, except few time-stealing games.