21 ms·
Tmux and Vim – better together
- zeroxfe 10y agoAll 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. 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.)
- joonoro 10y agoI did the same. I got fed up with constantly tweaking my Emacs config so I switched to VS Code. A month later I was back because VS Code was missing too many things I wanted and didn't really work the way I wanted it to. 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.
- adrianN 10y agoNeovim 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.
- zeroxfe 10y ago> The configuration is only as complicated as you make it to be. 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. :-/
- btschaegg 10y ago> 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?
- RomanPushkin 10y agoCan you share your 32 line config?
- adrianN 10y agoexecute 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=black
- ika 10y agoSame 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.
- fredsir 10y agoWhat are you guys doing with your configurations? I'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.
- ika 10y agoNothing works out of the box, especially if you are trying to make two plugins work nicely with each other. 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..
- fredsir 10y ago> Nothing works out of the box, especially if you are trying to make two plugins work nicely with each other. 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.
- juandazapata 10y agoWeird. 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.
- rublev 10y agoHow do you store them? Just backup into a dotfiles repo or what? I've been looking into dotfiles + gnu stow.
- falcolas 10y agoI do exactly this myself, and it works remarkably well. I had a few conflicts I had to work around between different packages, but the updated vim package directory structure has mostly solved that problem. 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.
- rublev 10y agoI've aliased ls to `alias ls='ls -GFhal'` to get around hidden dotfiles.
- juandazapata 10y agoI use a Github repo + gnu stow. I wrote a little post about it (http://juanda.me/managing-your-dotfiles-with-gnu-stow http://juanda.me/managing-your-dotfiles-with-gnu-stow). Notice that I've made my dotfiles repo private since then so you can't check it out, but the post still draws the general idea.
- dylanz 10y ago+1 for this method! Good post. I originally learned about this through: http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to...
- dwc 10y agoPeople have different workflows, and different desires for what they want out of their editor. For myself, I have just enough vim config to turn off compat mode and enable a few things. I think the only plugin I use is fugitive for git. I used to be a full blown IDE person, but I found that I really don't need all that stuff. Vim as a more featureful vi makes me very happy and requires no ongoing maintenance.
- ryanswapp 10y agoSame boat. I use Atom with vim keybindings now and I feel much more productive than when I rolled with straight vim + tmux. Great tools, but there are much better options these days.
- artursapek 10y agoWhy does Atom feel more productive?
- matzy 10y agoBecause he/she never learned how to use vim
- artursapek 10y agoZZZZZZZZZZZZING!
- nobleach 10y agoI am a huge fan of Vim. I've used it for quite a few years... but vim-mode-plus for Atom has made me very happy for the last month.
- mod 10y agoI found the Atom vim-keybinding plugins severely lacking in a lot of vim functionality that I use regularly. I moved quickly back to tmux/vim.
- c0achmcguirk 10y agoSame here. Macros worked inconsistently, finding matching parens, and search/replace using registers just was off. 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.
- sevensor 10y agoI've taken a month or two off from plugging Kakoune on HN because I was worried about becoming tiresome, but I can't resist mentioning it in this context. I used vim for 20 years, although I always preferred to stick with the default configuration. I switched to kak a couple of months ago, and I couldn't be happier. It's got great tmux integration, it automatically runs a server so you can connect multiple clients to one buffer, and it has a novel selection-oriented modal interface that's not just an attempt to mimic Vim.
- scruple 10y agoI'd like to try Kak, a friend recently told me about it. But, I'm concerned about needing to relearn common commands. For instance, I believe that they mentioned that in Kak the Vim equivalent to `dw` is `wd`. I've got decades of use with Vi(m) under my belt, as well, and I am not too thrilled at the idea of having to unlearn/relearn common commands.
- brynedwards 10y agoHaving switched to Kak recently, I've found this painful since I sometimes SSH into machines with only vi installed and so have to switch back and forth between kak and vi; it's a real headache...and a real shame since kak's selection method is much nicer IMO
- sevensor 10y agoI find that I get irritated at vi / vim for not being as nice as kak, but vi is still useable. The hjkl keys still work, :w, :q! and so on are still the same. I, i, O, o, P, and p still do the same thing. Basic movement is almost the same except you don't get selection with your movements. I tend to fall back on this common subset when I'm using vi. Marks are different in kak, so I don't think to use those in vi. Same thing with ex commands. I'm more likely to use sed rather than messing around with vi's ex commands now. 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.
- Bluestrike2 10y agoHave you considered splitting up your vim config into multiple files, particularly for the conditional stuff? It doesn't cut down on the size of configurations as a whole but it does make it a bit easier to approach. 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.
- wsdjeg 10y agoThanks. And I think SpaceVim is good for beginners.
- nilkn 10y agoI've used vim for a long time and simply don't bother with different configurations for different special cases. I also never bother with GUI versions. Just always use the terminal and only use plugins that are cross-platform.
- wyclif 10y agoThis is a smart way to manage vim: terminal vim and a small number of the essential plugins. Clone ~/.vimrc and ~/.tmux.conf via GitHub. I haven't had any headaches doing it this way.
- ajross 10y agoSeems like this needs to provide your definitions for "better" or "high quality". I haven't tried VSCode yet, but I play with Atom on occasion just to see what the cool kids are doing. And I go back to emacs every time scratching my head that people still spend their lives on the mouse and arrow keys.
- MrTonyD 10y agoI just decided to dump Atom - I discovered that it gets very slow as file size increases (to the point where it could be described as "broken".) Makes me glad that I write most of my code in C and do most of my editing in vi.
- apcsniperz 10y agoI'm pretty new compared to most people, only have been writing code for about 4 years, with emacs and vim having been around much longer than I've even been alive. But I've always found vim to be just that an editor. I personally love it, it can do nearly anything related to editing. Atom/vscode seem like an attempt to make omni-IDE's for every language. Overall not sure what's better, it seems people compare tools such as intellij, which is aimed at a specific language (I'm only referring to java here, I know it has many other languages supported and tools built off of it), with other tools such as atom/vscode which are aimed at being almost a weaker in some aspects IDE allowing for it to be used for all work. Than this is also compared to vim, which is in my opinion the best editor, but it's just the best at that. If you want refactoring, or many other features vim isn't the best tool for the job, although you can always hack whatever in if you needed it. Can't really speak for emacs here though, as I've never learned more than the basics of it yet, it seems like a completely different beast. Overall, just always seems sorta silly to me how these tools are compared like you can't use them all, why not leave intellij open for its features, with vim open to do any quick editing needed for example? Seems like it's always "you can only have one or the other" with the way people describe it.
- Periodic 10y agoThe thing that prevents me from using VSCode, and I tried, is having to edit code on multiple systems. It's so nice to be able to have the exact same environment on my local system, remote production systems, test servers, VMs with crappy graphics. All I have to do to get my development environment set up on just about any Unix system is copy a few dot files. 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.
- molloy 10y agoIf you'd like a consistently high-quality default user experience for emacs, check out Spacemacs![0] Especially since you're a Vim user. It's a distribution built around evil-mode with fantastic defaults. [0] http://spacemacs.org/ http://spacemacs.org/
- city41 10y agoI've always felt vim is an excellent editing experience but a lousy project management (ie "IDE") experience. I've also grown tired of the song and dance of setting up vim config and plugins, getting excited when I finally get a decent autocomplete working without stopping to consider VS Code has great autocomplete out of the box. 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.
- tomsthumb 10y agoThe real solution to this problem is for IDEs to support an editing frontend interface and then editors to be split into frontend and backend so that really you could use them in the context of the IDE. 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.
- city41 10y agoThat's what this project is working on: https://github.com/carlosdcastillo/vim-mode https://github.com/carlosdcastillo/vim-mode -- using neovim as the editing backend to Atom. It still doesn't completely solve the problem of vim and editor key commands clashing. Another interesting approach is VimR (http://vimr.org/ 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.
- jdc0589 10y agothat's exactly how limetext approached it. one back end, multiple frontends. I think that project is dead-ish though
- ruleabidinguser 10y agoThjis is just what Vim and emacs die-hards won't recognize. This is the value of an IDE. The driving force behind these editors' popularity is bad developers.
- news_to_me 10y agoI think that's a little harsh. What a lot of people (including myself) dislike about IDEs is that you lose a lot of tool composability, and to some extent you have to play by the IDE's rules. With a Vim + CLI setup, you get to define the optimal flow, but the tradeoff is maintainability. 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.
- ruleabidinguser 10y agoHere is the key value provided by an IDE: * 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.
- mxvzr 10y agoI've noticed your trolling re: emacs & vim vs IDEs in the previous days (ie: mostly argumentless name calling), but I'll bite anyway. 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.
- lelandbatey 10y agoMaybe. I've not experienced these same issues of "hard to maintain" Vim configs. However, just to learn, I downloaded VS code from the website right now. I extracted the archive and ran the executable. 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. [0] - http://i.xwl.me/2017-04-20-093624_4480x2096_scrot.png http://i.xwl.me/2017-04-20-093624_4480x2096_scrot.png
- ptr_void 10y agoOn the same boat, recently switched to VSCode. 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.
- microcolonel 10y agoIn my humble opinion, emacs is much closer by default. 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.
- wtbob 10y ago> If there was one thing I could ask of Vim (or even emacs), it'd be a consistent high-quality default user experience. FWIW I find both Prelude (https://github.com/bbatsov/prelude https://github.com/bbatsov/prelude) and Spacemacs (http://spacemacs.org/ http://spacemacs.org/) to offer pretty out-of-the-box experiences.
- vxxzy 10y agoI'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?
- coldpie 10y agoBecause that's how you create a vertical split. Maybe it could choose not to do that when there is no pane to the right of the current pane. But maybe the heuristics on that are hard.
- yorwba 10y agoExpecting terminal programs to interact sanely with mouse gestures is somewhat futile. If I need to paste something from a vim buffer into a graphical application, I use :'<,'>!xsel -bi to copy the text. If I were doing it more often, I would probably add a keybinding to streamline the process, and solve minor annoyances like having to undo to get the copied lines back. Maybe there is a good plugin for clipboard integration?
- deanstag 10y agohttps://github.com/wincent/clipper https://github.com/wincent/clipper is what i have been using for clipboard integration. It is useful for remote server clipboard syncing too.
- palunon 10y agoYou could use "y (and/or "+y, depending on your X clipboard setup) to yank to your clipboard. Similarly, "p paste from it.
- baldfat 10y agoI love TMux and Vim and I miss it when off my machine. Has anyone used TMux in the Creator's Edition of Windows 10? It is AWESOME. I need to get CMUS and Ranger working and I will be a happy camper.
- skrebbel 10y agoI used it for a while but then I realized that ConEmu also supports split panes, and then i can just scroll/select the buffers by mouse instead of ctrl+b, [. ConEmu really is an amazing piece of work. Quirky to configure (but hey, so it tmux), but truly amazing still :-)
- baldfat 10y agoIf you like ConEmu try out cmdr http://cmder.net http://cmder.net > 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.
- jamesgeck0 10y agoIf you've already extensively customized ConEmu, Cmder is probably just going to annoy you. It's ConEmu in portable app mode with different defaults and some bundled tools.
- baldfat 10y agoYou certainly can configure ConEmu but you can't make it into Cmdr.
- jamesgeck0 10y agoCmder is a bundle of ConEmu, configuration files, a tiny launcher that makes ConEmu's portable app mode easier to manage, and some provisioning stuff for the unix tools and cmd enhancements. 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.
- rcpt 10y agoMouse integration has always been the blocker for me with tmux. Any good solutions out there yet?
- fredoliveira 10y agoWhat issue do you have? I use tmux on iTerm on macs and it works just fine. Maybe you have an issue with your tmux conf?
- brunoluiz 10y agoJust set the following configs at your .tmux.conf # Enable mouse set -g mouse on # Sane scrolling set -g terminal-overrides 'xterm*:smcup@:rmcup@'
- juandazapata 10y agoMouse works perfectly fine (at least in macOs), you can even resize vim panes and tmux panes using the mouse.
- hultner 10y agoThey fixed the mouse integration about a year ago, I remember it being a bit of a hassle before that.
- vitorsgomes 10y agoHow do you guys share session in TMUX beetween computers that there are not in the same local network?
- ibotty 10y agossh
- lojack 10y agoI'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.
- edvinbesic 10y agoI 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.
- hultner 10y agomosh with ssh, very fast, resilient and excellent when roaming networks. Even the worst train network connections work decently with mosh. https://mosh.org/ https://mosh.org/
- bpizzi 10y agoThere's tmate: a tmux fork wich allow instant pairing without the hassle of ssh'in into the other computer and running a shared tmux. You can instant-run with the online service or install and use your own tmate server (BSD-licensed). https://tmate.io/ https://tmate.io/
- ake1 10y agoi used to use tmux but when i migrated to neovim i started using its built in terminal for multiplexing instead.
- hultner 10y agoInteresting, I suppose neovim much like emacs is turning more and more into an entire OS/environment for some users nowadays using it as a windowmanager like that.
- red2awn 10y agoNeovim got a great builtin terminal emulator so I can just treat it like any other vim panes.
- hultner 10y agoLast 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.
- hashkb 10y agoNormal panes are still nice in that they can be "far" from (n)vim; also sometimes I crash the editor and I wouldn't want my shells to vaporize.
- omurphy27 10y agoThis. I tried tmux but it required too much configuration, whereas Neovim just used my current terminal, already configured exactly the way I wanted it. I 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.
- danieldk 10y agoOne of the attractions of tmux is that you can attach/detach sessions in arbitrary terminals, which is incredibly handy when working remotely. Does Neovim provide this functionality?
- placeybordeaux 10y agoNope, abduco adds it pretty seemlessly without getting in the way, but unfortunately it doesn't seem to handle mouse events which I use occasionally with vim.
- gsf 10y agoI've been using abduco and neovim as my dev environment for the past month or so and am very happy with the setup. I don't rely on mouse events so didn't notice that missing. Whenever I log in local or remote I start a new session or attach to the existing one with `abduco -A nvim nvim`.
- paapi__gudiya 10y agoI use vim 7.4 and it segfaults atleast four-five times everyday. I suspect it's some plugin that is causing it to crash but I don't really know. Does it happen to anyone else too? 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.
- jstimpfle 10y agoVim has never crashed for me. And I've been using it almost exclusively for almost ten years. 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).
- juandazapata 10y agoI agree. Vim is solid as a rock. I've been using it for about 10 years and I saw it crash 2 times. On the other hand, I had to use Atom for 2 weeks and it crashed on me exactly 6 times.
- adrianN 10y agoHave you tried upgrading to a non-ancient vim?
- brunoluiz 10y agoNot 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?
- grimgrin 10y agoNo 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.
- brunoluiz 10y agoI had the same config, but I discovered what was missing. If you use zsh, you need to add this as well: set-option -g default-command "reattach-to-user-namespace -l zsh"
- deleted 10y ago[deleted]
- sweeneyrod 10y agoDon't use TMUX, but other than that yes (presuming you mean that you can't copy to the clipboard buffers with * and +). I've not got round to fixing it yet; copying from iTerm works for single lines (for multiple you get line numbers too) and just doing pbcopy isn't too much effort otherwise.
- tbezman 10y agoI'm sort of stuck in IDE Mode now. Been using IntelliJ for a few years with a vim emulator in it. It's alright but I miss this cool stuff too.
- Morantron 10y agoNice article! I'm gonna introduce some of this in my configuration for sure! I have a function in my .vimrc ( https://github.com/Morantron/dotfiles/blob/master/vimrc#L229 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 https://github.com/morantron/tmux-fingers which is awesome and you should totally try it! ( </shameless-plug> )
- hultner 10y agoI 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.
- bphogan 10y agoThat's what I've done for years too. I didn't know about the diff, but I love that - thank you.
- name_for_now 10y agoI used to run more commands from vim, but now I personally find Ctrl-Z is usually more convenient for all the one-off commands. If I do run stuff from inside of vim, it's now usually ":w !" or ":r !" (or some custom command wrapper around those).
- sergiosgc 10y agoOh! Ctrl-Z! I've been calling !zsh all these years, for quick shell access, and never thought of suspending vim. Thanks for the nugget.
- NocturnalWaffle 10y agoPut this in your zshrc, and Ctrl-Z will also resume the most recently suspended process. Really handy to just Ctrl-Z in and out of Vim. # 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
- mrkgnao 10y agoI don't really know zsh, but that looks like it should be zle flush-input
- 10y ago
- mulrian 10y agoAnyone know what shell colour scheme they are using?
- cust0m 10y agoI want to know it too
- dotsh 10y agohttps://github.com/gregsexton/Muon https://github.com/gregsexton/Muon :)
- mulrian 10y agoAwesome. Do you also know what they are using for the shell? Seems to be something a bit different from that theme.
- dotsh 10y agoIt looks like Atom but Im not sure, you can see more of them here: https://github.com/lysyi3m/osx-terminal-themes https://github.com/lysyi3m/osx-terminal-themes
- taude 10y agoLooks like what he really needs/wants is an IDE.
- fredsir 10y agoI use tmux and vim too. The problem is no IDE (or editor) comes near tmux+vim for me. If they did, I wouldn't be using tmux+vim since it's an awful experience living inside a text-based window-manager like that.
- falcolas 10y agoLooks like he has one that fits his needs nicely with the bash terminal.
- hultner 10y agoWhat I most time miss in an IDE is tight terminal integration, I find myself often redirecting buffer contents between panes, terminal pipelines and composing microprograms on the fly to enhance my workflow.
- erikb 10y agoIn fact, if you are not on Windows your OS already _IS_ an IDE. An OS is software, so it also needs to be developed. Therefore it was natural for OS developers to create their OS in a fashion that enables development. Apple and Microsoft are the only exceptions, and Apple somewhat backtracked on that path to enable developers as well. 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.
- wruza 10y ago>os is an ide 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.
- hashkb 10y agoDisappointed in Bugsnag for covering such trodden trails for a HN front page grab. Content marketing should have something to do with your business. There are hundreds of blog posts describing this exact setup.
- grzm 10y agoWhat's your indication that this was submitted by bugsnag rather than by an HN member? If you think this or any other submission is inappropriate for HN, please flag it and move on.
- hashkb 10y agoI'm disappointed that they wrote it, and whether or not they submitted it to HN it's still a blatant traffic grab. It has zero to do with error reporting.
- drewbailey 10y agoNot once does the article mention Bugsnag or try to market their product. Who is to stop an enthusiastic engineer from sharing a workflow they find useful. The article has great content and powerful visuals to help convey their point. I'm happy to see companies not try to influence authors to plug their product in their blog posts.
- hashkb 10y agoThen it goes on their personal blog.
- falcolas 10y agoPrior to moving to a mac and using iTerm2, I did this very thing. But iTerm2 has good enough support for all of the same things, without some of the limitations imposed by tmux, that I find I don't need to use tmux anymore. Split windows, quick switching between panes, mouse support... it's all just there. 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.
- austinpray 10y agoOn my mac I used tmux and vim for years. However, only after building a little arch linux box did I realize I actually wanted a tiling window manager and an ide all along.
- greenshackle2 10y agoAt one point I was using a tiling WM and tmux. But between the WM, tmux and vim windows.. well, I don't really need 3 layers of tiling, so I got rid of tmux.
- whatupmd 10y agoI like using :r ! <command> for running terminal commands. What I liked the most about your article is that 'further reading' section at the bottom!
- 1001101 10y agoHmm. I use both vim (and vi since '93 or '92), and tmux, but maybe not with this type of workflow - mine is similar. For a shell, I use ConqueShell (and ConqueGDB when debugging) and have a vertical split bound to a leader (and you can use the output as a normal buffer - copy, paste, scroll, search using regex in normal, etc are some of the benefits). I've got shift+arrow bindings for navigating around buffers in splits, and alt+arrow for navigating around windows. As for running tests, I have autocmds that do bindings based on filetype for generic operations, and if there's a test I run often on a project, I just create a leader binding for it. If you're thinking about this type of workflow, give ConqueShell an eval. YMMV. edit: fzf seems to work a lot like CTRL-P.
- AkBKukU 10y agoI've been using this recently as well. ConqueGDB is almost perfect. I want to have a tab for development that is just files and a tab for debug that is a split with gdb and one file viewer for stepping & etc. But if I set breakpoints in my development tab the Conque buffer has to create a new split and show itself there. So I have to close it every time after I set breakpoints. I had some problems with CounqueShell and ended up finding it easier to switch to a "real" shell using byobu.
- cmurf 10y agoI use tmux and vim often, but man my mind turns to mush reading about about either one of them. The biggest hassle I have is with copy-paste with tmux which I find ugly and can never remember. And then the method differs if you need to copy from tmux to another program that is not in tmux. Like for example just clicking on a URL in a tmux pane won't work (for me), nor have I figured out how to copy them so I can paste them into Firefox. And whenever I go read about it or ask it's like, 14 steps to glory and my mind is mush on step 4. No, I don't think I have a brain injury.
- dotsh 10y agoNice article, I used tmux for a long time until I switched back to screen as it is default on most operating systems. -- 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.
- shazow 10y agoNeovim is not what you think it is. It is a vanilla vim, it's just a fork of the codebase/community. It's not a package/distribution like Spacevim is.
- dotsh 10y agoI know what neovim is. I was talking about answering to all vim problems with "did you try neovim?"
- matzy 10y agoWho really says that though? As a regular lurker on the vim/neovim subreddits and mailing lists, I've never seen anyone try to fix someone's issue in vim by telling them to get neovim (literally never). Because, in the end, they're going to end up with the same issue. You already know what neovim is....so why would switching solve anything? Say they don't know how to use tabs, omnicompletion...why would neovim be any different? 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).
- cmurf 10y agoAnother idea is a tiling terminal program. I just started using Tilix. https://github.com/gnunn1/tilix 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.
- artisdom 10y agolooks very good, been looking for a terminal that supports tiling and it has nice color theme built-in, thanks.
- nialv7 10y agoI wish tmux could document their line protocol. Currently only iTerm is using that to integrate with tmux and no one else is doing it.
- svlasov 10y agoTerminator devs are working on the same kind of integration [1]. You can already attach to a running tmux session and Terminator will pick up the layout and create the splits and tabs accordingly. It has some rendering issues if you are using zsh and/ or fzf but otherwise great to see the progress. [1]: https://bugs.launchpad.net/terminator/+bug/1301605 https://bugs.launchpad.net/terminator/+bug/1301605
- erikb 10y agoI'm really a little disappointed how much this article is about using plugins and additional tools instead of learning to integrate both tools by oneself. At least vim is not a tool that gets better by plugins.
- tcoff91 10y agoVim absolutely gets better with plugins. ctrlp.vim, vim-tmux-navigator, vim-clang-format, ag.vim, vim-fugitive, supertab, vim-surround are all valuable plugins that I make use of every single day.
- erikb 10y agoBut you don't know what it stopped you from discovering about vim core that you solve your problems that way. And as shown in another comment in this thread, each problem you can solve with vim core you can combine with other features: 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.
- tcoff91 10y agoI still do those things you are talking about (really handy to read the output of find into the buffer when creating a new CMake file), but you are going to be hard-pressed to achieve something like :Gblame command from vim-fugitive or the funcitonality of ctrlp.vim without plugins.
- erikb 10y agoYes, you can't achieve the same thing without the plugins. You also can't achieve the interactive debuggers that IDEs have. But have you missed those? After some time I bet you've found other ways to debug your code that are just as handy, maybe not in all cases but therefore are even better in others. When I started to miss debuggers it forced me to really learn strace, logging frameworks of my favorite languages, dmesg, and journalctl filtering. It's still more work than setting up a breakpoint and tabbing through my code, but on the other hand I have it available as well, when I need to debug a wordpress plugin a contract worker wrote for my customer 10 years ago on a webserver that has none of my usual settings, plugins etc. In the end the pros and cons equal out I'd say. 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.
- chilicuil 10y agoThis is great, I have a similar configuration with near to zero effort to setup thanks to vundle (vim) and tundle (tmux) plugin managers. https://github.com/chilicuil/dotfiles/blob/master/.vimrc#L252 https://github.com/chilicuil/dotfiles/blob/master/.vimrc#L25... https://github.com/chilicuil/dotfiles/blob/master/.tmux.conf#L83 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-command-whenever-a-file-changes https://superuser.com/questions/181517/how-to-execute-a-comm...
- jeromenerf 10y agoBeing a tmux+vim and acme user, I'd love to see some mouse integration when using tmux+vim: - right click on a file pattern, say some/path/to/file:line:column to open in the current vim session - middle click on some selection to execute in a new tmux pane 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.
- nolemurs 10y agoTmux is a great program, especially when trying to edit on a remote server. But I think it's worth pointing out that for most purposes, Tmux is basically just a Tiling Window Manager that only works on your terminals. 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.
- tomsthumb 10y agoI use multiple tmux sessions within my tiling wm (i3). A tmux sessions is for management of terminal contexts for a specific task/project. i3 is for managing the set of contexts (terminal, browser, etc) for a task/project in any given desktop and then multiple desktops for different tasks/projects. It's also nice for the sake of having another paste-buffer, but this is perhaps a little idiosyncratic.
- kingmanaz 10y agoUsed Ion for years but finally just "upgraded" to fvwm2 and multiple tmux terminal windows. Reason? More often than not dozens of Unix hosts are being accessed through SSH rather than X. Tmux is always there, regardless of method of connection. Also, use the antique "nvi" (rather than Vim or Neovim) whenever possible. Same reason; it's always there, no tweaking. If I find myself craving extra functionality I'm probably overthinking things and am in need of a vacation.
- wtbob 10y agoI use tmux within my tiling window manager: it manages my terminal, and the WM manages windows. It works great for me, because this way I only have a single terminal to worry about.
- whitetub 10y agoI use tmux and vim together as my dev environment for five years (used Sublime before) and I like to add another thought: 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.
- daveguy 10y ago> (btw tmux and vim are perfect for phone keyboards, try it yourself) What terminal emulator do you use on your phone? Android, right?
- whitetub 10y agoPrompt on iOS and JuiceSSH on Android are very good.
- vitohuang 10y agoThat's what I have been doing for last couple years. To make the experience even better, try replace ssh with Mosh https://mosh.org/ https://mosh.org/ Its perfect for mobile or desktop. Also changing from bash to fish will make it even better.
- Taek 10y agoI've found my flow with vim+i3+ranger 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.
- certifiedloud 10y agoI use the same except for ranger. I'll have to check it out now.
- flukus 10y agoHow is i3 for a general purpose desktop? For coding it sounds great, but the same machine is used when I'm browsing the web or playing games or whatever.
- mxvzr 10y agoI've been using awesomewm for a few years now, and while it's not i3 I believe it's close enough that I can answer that: A tiling wm is very viable for a general purpose desktop. It's also extra useful if you have a multi-monitor setup. 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.
- flukus 10y ago
- tmaly 10y agoI have been using vim since 1996. I really never started customizing things till 2005. I still keep things super minimal.
- kingmanaz 10y agoAmen.
- wsdjeg 10y agoNice post, I want improve tmux layer in SpaceVim. I think it is best editor for developers. https://github.com/SpaceVim/SpaceVim https://github.com/SpaceVim/SpaceVim
- lwakefield 10y agoYou wouldn't happen to be an author, would you? Could that maybe be why you believe it is "the best editor for developers"?
- motyar 10y agoI use tmux window instead of splits. bind-key -n C-t new-window bind-key -n C-w kill-window bind-key -n C-n next-window
- ruleabidinguser 10y agoI think you have to be a fool to use anything short of a full IDE unless you have no choice.
- tambourine_man 10y agoGood article. I like the colors you chose for tmux and vim
- vanboxel 10y agoI was a little bummed to see no mention of `slimux`. It's a fantastic way to execute commands in a real shell (another tmux pane) from the comfort of your ViM session. By combining this with say IPython running in the shell, it's a powerful way to do data analysis. I wrote an ebook on this kind of workflow at http://dvbuntu.github.io/compute/ http://dvbuntu.github.io/compute/
- egonschiele 10y agoLots of good advice, Vimux was the killer for me I think. I have a common workflow of edit -> run -> edit and that will make that workflow seamless. I also tried out vim-arpeggio but kept seeing "Arpeggio is not defined". Looks like the project hasn't been updated for a while.
- flukus 10y agoWhat keyboards are everyone using for these setups? I find by the time you've got three layers (desktop, tmux, vim) the bindings are getting really complicated and inconsistent. Alt-tab might switch applications but then some lower programs use alt for a lot of things. 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.