1. 41
  1.  

  2. 12

    That’s all well and good, but I think it goes against the usual flow of using vi, which (to me) feels optimised for opening, editing, closing, running other commands in the shell, opening again and so forth.

    Emacs, OTOH, feels much more like it’s intended to be opened once, then used for a prolonged period of time (an entire login session, perhaps). It has a rich set of buffer-manipulation commands which assist with this, as well as many interactive modes which perform tasks vi users would probably do from the shell (browse the web, say, or read email).

    There’s nothing wrong with trying to live in vi, really, but there’s a lot of programming required to bring it the features found in Emacs — and much of that work has already been done for Emacs, and if it hasn’t been, well, elisp is a much nicer language than Vimscript.

    I use vi almost every day, but I live in Emacs. For me, at least, living in vi would feel odd.

    1. 6

      Though my workflow in vim is as you described, that is merely a personal choice. Vimscript is no longer the only option in mainline vim, and, if you require even more power, the neovim fork aims to allow any language for plugins.

      And much of this usability work has already been done. I am currently in limbo between emacs and neovim; with org-mode drawing me in from one side, and all of my fuzzy-file-finding and project navigating plugin tools pulling me from the other. It’s just as much “programming” to set these things up in emacs.

      1. 2

        all of my fuzzy-file-finding and project navigating plugin tools pulling me from the other. It’s just as much “programming” to set these things up in emacs.

        Do Helm and Projectile not do the trick? Prelude packages them both up nicely.

        If you prefer the vi style, I hear excellent things about Spacemacs.

        1. 3

          I am more saying that I already have that stuff set up in neovim, and it will be just as much work to figure it out in emacs. EDIT: I have tried spacemacs, but it feels heavy-weight and gives me option paralysis.

      2. 4

        I have a friend who uses something in between: He uses ^z to get back to the shell and fg to return to vim. He has multiple vim instances in the background sometimes. Essentially he uses shell jobs instead of vim buffers.

        1. 2

          Binding ^z to fg might have been the single most impactful thing I ever put in my zshrc.

          function rebind-z() { fg }
          zle -N rebind-z
          bindkey '^Z' rebind-z
          
          1. 1

            I do this instead of using vim buffers, I think because I spend most of my time in the shell and not vim.

            Line for line, I write just as much zsh code as anything else.

          2. 3

            I’m currently a heavy vim user, and have made everything (browser, window manager, tmux, shell, etc) use vim-like bindings. This is how I ‘live in vim’ (though not actually always in vim). I’m really curious what your workflow looks like using emacs + vi though. Getting to the point I am at now with everything set up this way was not easy, but on the other hand, using emacs would require me to unlearn a ton of old muscle memory and learn a ton of new muscle memory.

            1. 4

              Take a look at Spacemacs – truly the best of both worlds, plus a mind-opening leader key menu (the “Space” part).

              1. 2

                I’m really curious what your workflow looks like using emacs + vi though.

                Honestly, I’m a bit embarrassed by it: I ought to use emacsclient instead of vi (and in fact on one of my machines I do). Instead, I tend to use Emacs to edit code, documents (LaTeX or Org mode), browse the web (ewe), read documentation (woman), interact with git (Magit), handle projects (Projectile), interact with Common Lisp (SLIME), work in a shell (Eshell) and so forth.

                Meanwhile, I use vi to do quick edits to line-oriented config files, e.g. stuff in /etc, in part because I have an old habit of typing sudo vi /etc/foo rather than editing sudo::/etc/foo with TRAMP (I keep trying to switch completely, but … old habits die hard).

                I would suggest to everyone to not do as I do, but just learn Emacs and use it for everything. If you want vi’s almost certainly better text-manipulation language, then use Viper mode, e.g. as provided by Spacemacs.

              2. 1

                As someone who uses vi for spot-editing and emacs for project work, I work like you.

                Emacs, OTOH, feels much more like it’s intended to be opened once, then used for a prolonged period of time (an entire login session, perhaps).

                With tmux, for me emacs is open until unplanned server reboot or emacs version upgrade.

              3. 6

                Mapping bn to tab and bp to shift-tab changed how I use vim.

                1. 3

                  Left and right arrow keys for me :)

                  1. 2

                    Page-up/down for me :) it’s wonderful

                  2. 1

                    I’ve been using buffers for 6 to 9 months, or so, and it has drastically changed my workflow. Where I used to have multiple nvim open in multiple tmux windows I now only have one nvim running.

                    I have had a couple of hurdles. Switching nvim windows and tmux windows are different key commands, where they used to be the same. It adds a little cogitative overhead.

                    Another oddity that I’v experienced is that :bn and :bp don’t seem to cycle in a consistent way. I’ve run :bn and :bp and the buffer is a third buffer altogether.

                    1. 1

                      buffers really are the fundamental unit of concern in vim, once I grasped them and started using them properly along with splits and tabs vim became a “place” more properly for me.

                      One missing command in that list is <C-w>q which closes the “view” on the buffer without closing the buffer itself. I use this all the time when I want to reorganize my splits or tabs and don’t want to close out everything and start over.

                      1. 1

                        To make that workflow even smoother, snappier, and more fun: https://statico.github.io/vim3.html

                        I also do a bit of config to make the split experience fast and available (among other things) https://github.com/maxzinkus/dotfiles

                        Then, I use tmux to have one pane full of vim (with buffers and splits aplenty) per project and other panes in which to run commands.