Live data from Hacker News

Tmux and Vim – better together

blog.bugsnag.com

31–40 of 297 posts

Re: Tmux and Vim – better together

#31

Not sure if it is only at my Mac, but with the latest Mac OS + iTerm + TMUX + VIM, my clipboard doesn't work properly, even using the following setup on my tmux bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" Anyone with the same problem?

No clue if you've done these steps, and I'm not on Mac OS at the moment (also I use Terminal.app), but:

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.

Re: Tmux and Vim – better together

#32
I usually use :!command to run a command real quick from within vim, where I also have access to the current filename and contents.

A classic gem is ":w !diff % -" to see what I've changed since the last save.

Re: Tmux and Vim – better together

#33
post #30

All this looks really great, however I think I just can't deal with the effort of maintaining these complex editor configurations anymore. 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. termina…

Neovim tries to improve defaults. My vimrc is 32 lines and contains no ifs and I'm reasonably happy with it. I don't use many plugins. The configuration is only as complicated as you make it to be. I suppose over the decades you used vim your vimrc accrued many layers of cruft. I wonder how your VSCode config will look like in 20 years.

Re: Tmux and Vim – better together

#34

How do you guys share session in TMUX beetween computers that there are not in the same local network?

I'd imagine it'd be pretty easy to do that with tmate, but I'm only ever sharing sessions on a LAN or VPN so I could be wrong.

Of course, you can always ssh in to a shared account.

Re: Tmux and Vim – better together

#35
post #30

All this looks really great, however I think I just can't deal with the effort of maintaining these complex editor configurations anymore. 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. termina…

Same here! I've been using both Vim (4 year) and Tmux (2 year) and I noticed I was actually spending more time configuring my text editor rather than just writing code. So I switched first to Atom and then to VSCode and I'm supper happy with the result.

Re: Tmux and Vim – better together

#37

How do you guys share session in TMUX beetween computers that there are not in the same local network?

I vpn into my home network when working from coffee shops etc and ssh into my workstation. It does require a semi descent connection but mosh helps mitigate a lot of issues with ssh and latency. Works pretty well and gives me descent battery life to boot since compilation/tests now run on the remote box.

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.

Re: Tmux and Vim – better together

#38
post #11

Neovim got a great builtin terminal emulator so I can just treat it like any other vim panes.

Last time I gave it a serious try I remember running in to a few oddities making me resort to keep using normal panes. Don't know if it's improved recently or if I were unlucky.

Re: Tmux and Vim – better together

#39
post #2

I've shyed away from using tmux and Vim. For some reason, when I use tmux and Vim, if I 'copy' a snippet of text (using my mouse/cursor higlight -> right-click -> copy) it treats all of the empty space a actual "space" characters when I 'paste'. Why does it do this?

I just tried this on my Mac with tmux, vim, and textedit (with a normal text file) and didn't run into this problem. This is with vim 7.4 and tmux 2.1.

Re: Tmux and Vim – better together

#40
post #30

All this looks really great, however I think I just can't deal with the effort of maintaining these complex editor configurations anymore. 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. termina…

Weird. I built my .rc files like 10 years ago, and only edit them about twice a year to add a plugin or modify a keybinding. Not a pain to maintain at all.
Post reply on HN