14 ms·
Vim after 15 Years
- lillesvin 9y agoInteresting read, I've been using Vim for some 18 years myself and I was completely unaware of fzf. However, I'm curious if you know `rg` (aka. ripgrep): https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep In my experience it's markedly faster than `ag` (which is markedly faster than `grep`).
- bowmessage 9y agoIt gets faster?! What? Thanks for this.
- skinnymuch 9y agoSomething faster than ag? Honestly had no idea. I've been so happy with ag.
- JesseObrien 9y agoCame here to make a plug for `rg` as well. I've put it through it's paces the last few months and it's awesome.
- octref 9y agoI work at VS Code and we recently switched to ripgrep for quick open and search. Even searching in Chromium source takes only a few seconds. Pretty impressive speed.
- zild3d 9y agooff topic, but why do you say you work "at VS Code", isn't it "at microsoft" / "on VS Code"?
- riquito 9y agoDamn, I'm an avid user of both fzf (super useful, recommended) and rg (yes, it's really faster than ag!) and I never thought of combining them... gotta try
- statico 9y agoThat's been the response on Reddit and Disqus as well. Guess I'll have to give it a try!
- kej 9y agoJust want to add that the blog posts[1] detailing how and why ripgrep is able to beat other search tools are pretty interesting reading. [1] http://blog.burntsushi.net/ripgrep/ http://blog.burntsushi.net/ripgrep/
- chewz 9y agoYou can use rg with fzf. I do. http://owen.cymru/fzf-ripgrep-navigate-with-bash-faster-than-ever-before/ http://owen.cymru/fzf-ripgrep-navigate-with-bash-faster-than... https://medium.com/@crashybang/supercharge-vim-with-fzf-and-ripgrep-d4661fc853d2 https://medium.com/@crashybang/supercharge-vim-with-fzf-and-... fzf is lifechanger inside and outside Vim. I now use it for almost everything. Selfpromotion: I have made a Vim plugin for searching and playing iTunes Library based on fzf. https://github.com/chew-z/itunes.vim https://github.com/chew-z/itunes.vim
- BlackjackCF 9y agoI swapped from ag to rg as well, and I've had a much better experience with it (in terms of speed.
- pmoriarty 9y agoAlso check out fzy: https://github.com/jhawthorn/fzy https://github.com/jhawthorn/fzy
- Spiritus 9y agoThen you should also check out vim-picker[1] which integrates Vim and fzy very nicely (instead of the barely usable example in fzy's README). [1] https://github.com/srstevenson/vim-picker https://github.com/srstevenson/vim-picker
- TheGrassyKnoll 9y agoRipGrep kicks Ass. (Ag is excellent as well) Both these guys did terrific work on these tools.
- monkmartinez 9y agoProblems with macOS and iTerm2... that is too bad. I am going to do a 30 day challenge with a Thinkpad from Costco next month. Full linux install with Ubuntu 17.10! I have wanted to try i3wm for as long as I can remember. Unfortunately, it is a PITA to get working on a VM with the Mac as the key chords don't play nicely intersystem. Super excited to give it a go... what is awesome is that I can have an IDE like Pycharm right next to VIM and my shell in a tiling window manager with Linux. I hope I can ditch macOS...
- soulnothing 9y agoI've been using i3 for years now. I experienced the same pain. Mac hijacks a lot of the child vm keybindings. I didn't have this problem with windows as the host os. But that doesn't really make sense. Best of luck with the transition. Posting from a thinkpad, with i3, pycharm and vim right now :).
- asselinpaul 9y agoWhat kind of thinkpad? :)
- tbrock 9y agoT or X. There is no substitute. The rest, as they say, is garbage.
- soulnothing 9y agoT440s, but I was on a T430s earlier for work.
- regulation_d 9y agotmux send-keys is fantastic. I recently added a shortcut to run the test that my cursor is on in a different pane. This changed my life. I thought I had to decide between having a separate pane to run my tests in and having a convenient and precise way to run to exactly the test or test file I want to run. But because of send-keys, I can have both!
- hyperpallium 9y agoSounds cool! Could you share that shortcut please? I'm sure I could work it out, but there's always a bit of trial and error, and looking up docs without knowing the name in vim (for me, anyway).
- regulation_d 9y agoFor sure! There was definitely some trial and error as I was writing it. :) The specific use case I have is for running Elixir tests, but I'm sure adapting it wouldn't present too much of a challenge: https://gist.github.com/ddresselhaus/98b022e295bc27e9264dece7823e74e8 https://gist.github.com/ddresselhaus/98b022e295bc27e9264dece... I haven't done a ton of Vim scripting and found this resource to be super helpful! https://devhints.io/vimscript https://devhints.io/vimscript
- tonyhb 9y agoI'm an avid tmux+neovim user, too, though working with Reason is a lot easier in VS Code. Making the switch from actual vim to fake vim (ie JS emulation) sucks. Recently, VSCodeVim merged #1725 to add actual neovim as an editor - it's using NeoVim's embedding API so you're using neovim to edit the text file inside of VSCode's chrome, including all of VSCode's type hints and popups. Info here: https://github.com/VSCodeVim/Vim/issues/1735 https://github.com/VSCodeVim/Vim/issues/1735 There's an ongoing rewrite to make neovim also work with your existing .vimrc file: https://github.com/VSCodeVim/Vim/pull/1897 https://github.com/VSCodeVim/Vim/pull/1897 I'm really stoked that we get the best of both - for languages with first-class VSCode support we don't have to decide between a half-baked VIM plugin or using VSCode without vim... you get both!
- chillee 9y agoTo be clear (as the guy behind these efforts), what was merged was a PR to let Neovim handle Ex-commands. This by itself was already pretty cool. In <200 lines of code, we were able to obtain full Ex-mode support, an aspect that had already taken 2000+ lines of code for much more limited support. The PR for full neovim integration is the one you linked. It's more than just making it work with your existing .vimrc file: it's making it work with most vim plugins, leveraging the neovim runtime to make macros run faster, etc.
- Lio 9y agoMy hope is that language server protocol support in NeoVim will make all of VSC’s best toys available in the terminal. Personally I’d prefer that to working in GUI with an embedded terminal.
- 9y ago
- hyperpallium 9y agoI had another pane autorunning something when it detected src file changes (inotify). So you just :w, and it happens. The method in this blog could do this: just add :w to the mapping. The blog method might seem hacky in using up and enter, but this makes it easy to modify the command you want to run.
- flukus 9y agoLately I've been going the other way, from a complex vim setup to using the terminal and tools like inotify, tmux, and bash, so far I've found this a much better solution. Keeping my vim configuration and plugins synced between environments (windows, cygwin and linux) was getting to be a compatibility nightmare. I also wanted to try using kakoune (http://kakoune.org/ http://kakoune.org/) but found that for day to day stuff I was far to reliant on my vim setup. Since beomming more reliant on the shell this is now more feasible and I've got a lot more flexibility.
- sevensor 9y agoHighly recommend kakoune. I've been using it since January or so, and its selection-oriented approach is really nice. I was a heavy user of visual mode in vim, so switching to kak, which has a much richer notion of selections, was a breeze.
- unhammer 9y agoIf you use inotifywait a lot, I recommend trying http://entrproject.org/ http://entrproject.org/ which solves a lot of minor annoyances with inotifywait. It makes it easy to e.g. rebuild all web pages, restart your simplehttpserver and reload the current Firefox tab every time on of your `git ls-files` changes. The "restart server"-part can be fiddly with plain inotifywait, trivial with `entr -r`.
- qznc 9y agoNice! Currently, I use my own script [0] but entr is more general and supports more platforms. [0] https://github.com/qznc/dot/blob/master/bin/git-onNotify https://github.com/qznc/dot/blob/master/bin/git-onNotify
- eradicatethots 9y agoVim is the best lightweight single file editor there is. That’s all it should be. If you’re heavily configuring it, you should be able to answer “why is this better than an ide?” Without saying “vim makes me cool”. Also, if you can answer that, please let me know! To me, an IDE is better for everything but what default vim is good at. And if you tell me that typing is faster, please also tell me why that’s relevant!
- ehsanu1 9y agoI can't live without my vim bindings now, it's incredibly jarring anytime I have to use someone else's editor. The muscle-memory is just too strong, and configuring vim with a bunch of plugins is extremely easy to do and provides me a lot of value for no downside afaict. I started configuring vim years ago and have only tweaked it here and there over time, adding a plugin for this or that as I felt the need. I don't really see anything wrong with that :)
- eddieroger 9y ago> “why is this better than an ide?” Because it's a workflow that works for some people. Shouldn't being the most effective you can be trump things like which editor is better, or IDE versus vanilla editor? Your workflow is your workflow, don't worry about other people's.
- foo101 9y ago> Vim is the best lightweight single file editor there is. Are you serious? Do you know about Vim buffers? The `:b` command? The `Ctrl + 6` command? The `m` and `'` commands? These commands alone make Vim a far superior multi-file editor than anything else I have seen. Now if you add plugins like `NerdTree`, `CtrlP` or `fzf` to the list, I don't think there is any other editor on the planet with the exception of emacs that comes anywhere close to multi-file editing productivity that Vim can offer.
- solatic 9y agoAfter you really internalize the Vim movement keybindings, using anything else to move, from arrow keys to home/end to the mouse, feels like an interruption in your workflow. The wrist movements are what kill you by a thousand cuts. It's like TrackPoints versus mice. Once you're used to never leaving the home row, the alternative feels rough and unergonomic.
- incomplete 9y agoVim, apparently, is the new emacs. /me ducks and runs out of the room
- yarrel 9y agoYou forgot to press ESC before typing that, so...
- zeamaize 9y agoIt always seems to take people a long time to figure out vim’s keys and usage pattern but it’s quite easy. I have people ask me how to quit vim all the time and I’m amazed they can’t remember a few simple keystrokes. CTRL-D sudo apt-get remove vim sudo apt-get purge vim See, it’s not hard at all to learn the proper way to use vim!
- harrygeez 9y agoGo home, you're drunk
- PurpleRamen 9y agoStill a long road to go. But appearently neovim is working on making which-key (https://github.com/justbur/emacs-which-key https://github.com/justbur/emacs-which-key) possible, which would close a great gap.
- Lio 9y agoI think there's loads of great ideas in emacs we can use for inspiration. I've tried Spacemacs a couple of times, it's very good but not for me I think. I'd be happy to import ideas like dired though.
- justinmk 9y agodirvish.vim is my attempt to adapt dired to the Vim philosophy. It doesn't attempt to "DWIM", but provides :Shdo which allows you to script file operations using your shell. https://github.com/justinmk/vim-dirvish/ https://github.com/justinmk/vim-dirvish/
- tombh 9y agoI made a Vim plugin to use 'normal' sublime/atom-like keybindings: https://github.com/tombh/novim-mode https://github.com/tombh/novim-mode I have an almost identical setup as that described in this post. Being in the terminal and integrating with tmux is a wonderful environment - lightweight and immersive. And all these Vim plugins are of such good quality - are Vim plugin authors perhaps of a different, geekier, ilk? So it's a shame that vanilla Vim is restricted to its special modal editing paradigm, there's so much more to it than that. BTW I post this on HN everytime I see a gushing Vim thread, apologies if you've seen it before. PS I'm also working on refactoring my tmux keybindings that do a similar thing - SHIFT+ARROW to select, CTRL+C to copy, CTRL+D to select the current word, etc, etc.
- dotsh 9y agoMany newcomers using your plugin will have a huge problem when using vanilla VIM. The same problem exist with Spacemacs, Spacevim or other weird things. If someone don't want to use VIM modal editing why not to stay with Sublime/Atom/VSCode or any other editor? They also have very rich plugins ecosystem. Not mentioning that Sublime is like crazy fast... To clarify it's not an attack on anyone. For instance evil mode in emacs is also a heart breaking plugin for me. Every editor is made for different workflow, why on earth mix them up? And in most cases it does not work very well.
- icc97 9y agoI agree that you can't just use all the old keys otherwise you'll never learn. But what I am looking for is kind of a translation guide from ST to Vim. For Vim learners I really think that GVim is a great tool because eg it doesn't do bad things when hit some keys you're used to with muscle memory such as copy/paste and Ctrl+arrow. It has dropdown menus with the commands on so you can learn from them. Once you're comfortable in GVim it's easy to switch to regular Vim. Plus I use it on Windows as handles fonts and syntax highlighting better.
- alwillis 9y agoBecause the composability of Vim is its killer feature, which these other editors lack. See "Why Atom Can't Replace Vim"--https://medium.com/@mkozlows/why-atom-cant-replace-vim-433852f4b4d1 https://medium.com/@mkozlows/why-atom-cant-replace-vim-43385...
- philippeback 9y agoAmen to tmux+vim. Best combo, especially when doing things on remote boxes.
- shabbyrobe 9y ago"The vim-surround plugin is so useful that it should probably be built into Vim." I couldn't agree with this more. Also undotree [1] should be built into Vim as well. Vim represents undo/redo under the hood as a tree, which is absolutely incredible once you have a plugin that unlocks it, but the built-in facilities for traversing that tree could be charitably described as "dismal". Vim's undo tree makes a solved problem out of the old "undo undo undo undo undo... ok what did this file used to look like... redo redo y... oops did I just press 'y' by accident instead of redo and blow away a bunch of my later edits... next time I should remember to commit before I do that (even though I totally won't)" situation, but without the plugin, it's effectively inaccessible. [1] https://github.com/mbbill/undotree
- brazzledazzle 9y agoKickass. Thanks for pointing out undotree. I had no idea it worked that way under the hood. This will certainly help me with bad habits I probably wasn't going to kick anyway.
- unkown-unknowns 9y agoClickable link for [1] [1]: https://github.com/mbbill/undotree https://github.com/mbbill/undotree
- dmix 9y agoAnd https://github.com/tpope/vim-surround https://github.com/tpope/vim-surround
- Spiritus 9y agoHere's an alternative to vim-surround mentioned on r/vim: https://github.com/machakann/vim-sandwich https://github.com/machakann/vim-sandwich
- roryokane 9y ago> without the plugin, it's effectively inaccessible I wouldn't say that. Plain Vim does have the `:earlier` and `:later` commands, which aren’t too hard to use in the case you described. For example, `:earlier 40sec` takes you to the state of the file as you saw it 40 seconds ago, no matter where in the undo tree you are or were. I agree that undo-tree is usually easier to use, though.
- afarrell 9y agoDoes anyone know of a good approach to debugging .vim files? I've not been able to find an interactive debugger or really even a good source of information about the program model of the vimscript interpreter.
- rav 9y agoI would not remap , and ; as the article suggests, since those keys are already used in Vim for repeating f/F/t/T.
- Graziano_M 9y agoI have not heard any good argument for a leader key better than <space>. <space>f, t, b for fzf (and t is not a stretch on my keyboard layout)
- s_kilk 9y ago> (and t is not a stretch on my keyboard layout) Colemak?
- Walf 9y agot? How does that not ruin "to" movements?
- s_kilk 9y agoWhy would it? In the Colemak layout, 't' is on the left-hand index finger, it couldn't be more convenient.
- Graziano_M 9y agoIt's hit after leader. `t` on its own is still `to`.
- Graziano_M 9y agobingo
- grive 9y agoThe only thing preventing me from using <space> is the slight lag it introduce each time <space> is used in insert mode. It is bearable with ',', but I cannot stand it with <space>. If it is possible to remove completely this lag (not simply reduce it), then it would be awesome.
- chewz 9y agoRegarding buffers in Vim I am fond of using vim-workspaces plugin. With Tab mapped to :WSNext (and C-Tab to :WSPrev) I can see all open buffers and cycle through them. And close unnecessary with :WSClose. https://github.com/bagrat/vim-workspace https://github.com/bagrat/vim-workspace
- icc97 9y agoFZF with `:Buffers` gives you a fuzzy search on your buffers. Plus there's unimpaired which gives `[b` and `]b`. I did try to get tabbing through buffers working and yours looks like a good solution, but I find my buffers are rarely next to each other.
- TheYumasi 9y agoAs a former Vim user I'm happy to see a post like that ! Some old problems mentionned in the post like asynchronous processes mostly, but also the lack of smart indentation with the TAB key that also takes into account the type of file you're editing really drove me out of Vim. I've since switched to Emacs (with Evil mode because modal editors rocks), and I haven't looked back since.
- colordrops 9y agoSmart indentation in VIM has been solved by plugins for a long time now.
- lucaspiller 9y agoAn interest plugin I've found recently (Neovim only) is Deoplete, which is basically Ctrl-n on steroids. As you type, it shows a list of completions without any kind of slowdown (on my 4 yo MBA). For some languages, such as TypeScript, it even shows type definitions. It's close to being on-par with the smart completion in IntelliJ. https://github.com/Shougo/deoplete.nvim https://github.com/Shougo/deoplete.nvim
- Spiritus 9y agoThere's a bunch of plugins like that, here's a couple of the most popular ones: - https://github.com/prabirshrestha/asyncomplete.vim https://github.com/prabirshrestha/asyncomplete.vim - https://github.com/lifepillar/vim-mucomplete https://github.com/lifepillar/vim-mucomplete - https://github.com/roxma/nvim-completion-manager https://github.com/roxma/nvim-completion-manager - https://github.com/Valloric/YouCompleteMe https://github.com/Valloric/YouCompleteMe
- auscompgeek 9y agoYou missed https://github.com/maralla/completor.vim https://github.com/maralla/completor.vim - one of the first async ones targeting vim8, later gaining neovim support. It doesn't look like it's easily extensible though, aside from using omnicompletion, which negates the async benefits. Note that mucomplete isn't async, it's intended to be simple.
- deleted 9y ago[deleted]
- Philipp__ 9y agoI was split between using Emacs and Vim for last 2 years (I used Vim for last 6, and learned Emacs 2 years ago). But what made Vim my main editor is fzf and ag, and smooth workflow that I had in terminal. But I have to say, ivy and counsel made my Emacs experience much, much nicer. But I guess that I got too deep into Vim already that I kinda got used to it so much, that I appreciated more that "terminal" workflow.
- criddell 9y ago> I was split between using Emacs and Vim for last 2 years You're going to have to pick a side. You can't be an atheist that dabbles in Catholicism.
- majewsky 9y agoA friend of mine is an avid Spacemacs user (which, as far as I understand, is a Vim distribution running on Emacs or something like that). He has both a Vim and an Emacs sticker on his notebook next to each other, and they've been carefully applied so that they overlap each other both ways. Some men just want to watch the world burn.
- jaux 9y agoI had tried spacemacs for a few months, it was nice overall, but everything seemed to be a little bit slower there than in vim, so I eventually switched back to vim.
- Philipp__ 9y agoI picked vim in the end because I already got really used to the workflow I previously mentioned. But there are many nice things from Emacs that I really miss. For example magit, various REPL integrations and much better support for functional programming languages. Emacs felt cool and nerdy but I always felt like I was using 1% of it. Many things on the other hand felt much more clunky than I expected (terminals for example). And I don't like all in one philosophy of people reading emails, reading reddit, chatting on IRC all through emacs. I tried many of those things but didn't find it appealing at all. But if I had to do some serious work in one of the functional languages I can see myself coming back to Emacs pretty easily.
- cup-of-tea 9y ago> TextMate and Sublime Text showed us that the fastest way to find a file is by fuzzy finding Stopped reading here. This is from emacs and those other editors copied it. Emacs had this in about 1996, a full decade before those other editors existed. Oh, and the emacs versions are way more flexible than fzf due to supporting tab completion as well. All this other stuff has been in emacs for decades as well. I know about the Holy War etc.. but seriously, credit where credit is due.
- ujal 9y agoFor people working on smaller screens Golden Ratio is a godsend - https://github.com/roman/golden-ratio https://github.com/roman/golden-ratio
- dghf 9y agoIf you're going to use buffers (which you should), make sure to set hidden otherwise you'll get an error message when you try to swap to a different buffers when you have unsaved changes in your current buffer,
- Walf 9y agoGreat for helping lose unsaved changes, too.
- icc97 9y agoYou still get a warning if you try to close without saving
- dghf 9y agoBut the whole point of 'set hidden' is that the current buffer is hidden (rather than unloaded/closed) when you switch to a different one, so there's no prospect of losing unsaved changes -- unless you :qa! without checking your buffer list first.
- snarfy 9y agoI've been using vim about 20 years now. Maybe I'm weird but I don't use any plugins. When I want more than what Vim does I use something else. Autocomplete, find usages, etc? I'll use an IDE for that. When I need to refactor a 500MB text file without hanging my machine, I'll use vim.
- emidln 9y agoI used to use `alias qvim="vim -u ~/.qvimrc"` as my small, toned down vimrc. It still had some bells (like vim-surround), but lacked the full-on Unite.vim, tmux, etc integration of my usual vimrc.
- falcolas 9y ago> I'll use an IDE for that. These are usually attempts at reducing the need for IDEs, while keeping the familiar vim editing. With no exceptions so far, no IDE plugin (or emacs plugin, for that matter) has been able to emulate vim editing well enough to replace vim as my primary editor. Perhaps when neovim (or anything else) is able to give me native vim capabilities in a more extensible or powerful editor, I'll switch. But we're just not there yet.
- ghjnut 9y agoIt sounds like you haven't given it a whirl. I've been on neovim for about about 3 years now after 5 years of native vim and it's been a complete drag-and-drop.
- falcolas 9y agoSorry for the confusion, but I'm talking about moving out of the vim ecosystem into Visual Studio or one of the Jetbrains IDEs or Eclipse when they can integrate an actual vim environment; not about moving from vim to neovim.
- equalunique 9y agoI also prefer plain vim or plain neovim, mainly because plugins aren't guaranteed to be on the servers I have to do work on.
- dagi3d 9y agoI'm so in with fzf. I discovered it recently, after using CtrlP for several years and I couldn't be happier. maybe there was a workaround, but with CtrlP I had to clear its cache everytime I added a new file to be listed in the search results. With fzf it just works out of the box and it's blazing fast <3
- nunez 9y agoI avoid using too many plugins because the biggest advantage of using vim is its ubiquity on every *nix and BSD-based OS. I don’t want my workflow to become reliant on things I might not be able to use. Also, vim on its own is really damn powerful.
- dmix 9y agoI spent forever tweaking my plugins, now I just use SpaceVim and love it. http://spacevim.org/ http://spacevim.org/ The default settings required very little changes for me and I've adjusted to their (clever) default key shortcut scheme.
- ryanpcmcquen 9y agoStill awesome.
- santix 9y agoObligatory video: https://www.youtube.com/watch?v=XA2WjJbmmoM https://www.youtube.com/watch?v=XA2WjJbmmoM - How to Do 90% of What Plugins Do (With Just Vim)