Vim plugins I use
prakashdanish.github.io
prakashdanish.github.io
* FZF. Perhaps the best fuzzy finder for Vim https://github.com/junegunn/fzf/
* ALE. Asynchronous Linting Engine, totally awesome. https://github.com/w0rp/ale
* Polyglot. A "best of" language pack. https://github.com/sheerun/vim-polyglot
* Plug. IMHO the best plugin manager going https://github.com/junegunn/vim-plug.
* Fugitive. The best git wrapper there is https://github.com/tpope/vim-fugitive
* vim-test. A plugin that helps you run tests from inside of Vim. https://github.com/janko-m/vim-test
Outside of that, switch to NeoVim if you haven't already (https://neovim.io/). Or give Oni a chance, it looks really promising (https://www.onivim.io/).
Could you expand on why? Personally I’d be particularly interested on your thoughts about vim-plug, as I use pathogen currently and I seems to do everything I need.
- You can lazy load plugins
- You can execute commands after a plugin update (e.g. building the new binary for youcompleteme)
Those are the major points I think.
Seriously, isn't part of the problem that vim by default looks for all plugins in one directory? Tim Pope's Pathogen does the minimum here and lets each plugin have its own directory (which translates to git repo). You're responsible for going to each directory and updating them.
My favourite thing about vim-plug is its `:PlugDiff` command which, after running `:PlugUpdate` will load all the new commits in an explorable vim buffer, so you can see exactly what changed and even easily see code changes.
I now use doom-emacs [1] and haven't looked back.
Overall, it's a solid alternative to Spacemacs that not enough people know about.
Spacemacs markets itself much better and I tried it first, but found it to be bloated to be point that it noticeably impacted performance. E.g. start-up time was 10+ seconds; ~2s with doom (and doom doesn't feel any less feature-complete).
As for the bus factor, doom has the maturity of a 4-year-old project; it won't just fall apart on you. It is mostly a one-man show, but Henrik is still very active and super quick to respond to issues.
And if you want to see some crazy vim usage, there's always Damian Conway: https://www.youtube.com/watch?v=aHm36-na4-4
Most of the IDEs have vim like features or plugins. It works a lot better the other way - make your IDE into Vim.
Also, being able to ssh into any machine and remotely edit code is pretty awesome.
Unfortunately most IDEs that have vim keybindings don't support this, and it has become such a baked in part of my muscle memory that it makes switching to anything else such a pain.
The most productive vim keybinding I ever came across was:
noremap <Space> @q
Since the key to start a macro is q, you can quickly tap qq to record a macro to the q register (end it by pressing q again.) Then by whacking the space bar you can execute the q macro as many times as you'd like. Once you get into the rhythm of using it often even for small tasks, it can become a great optimization. Sometimes I use it with five or more different macros in a single minute. If you ever look forward in time and see that you're about to perform the same edit two or three times, pressing the q key three times total and the space bar once per execution (or only once with a count) will often be fewer keystrokes than had you performed the edit manually each time. Not to mention triumphantly smacking the space bar to repeat an edit is a great feeling.(Simple edits can be repeated using . which is another indispensable vim feature that sometimes gets missed by vi-plugins in other editors.)
I do wonder what your gripe with the autocomplete dropdown is though, vim's built in TUI completion dropdown (this isn't something plugins invented, it's in Vim by default) seems to work just fine for me. The only completion plugin I use is supertab, which I understand to be dated and out of vogue these days, but it gives me continuity with command line completion being triggered by my tab key. The dropdown works exactly like I'd expect it to; tab and shift-tab to cycle up and down, and enter to select a completion. If I continue typing with it open, it refines the suggestions on the fly. I'm not sure what else I should ask for.
I never was able to leave VIM though. The reason is that it works so well over SSH and I don't like the context switching from VIM to IDE.
Also IDE's always end up crashing or lagging at some point. When you're in the coding mindset this can really upset me greatly.
What IDE do you use?
The vim editor gives you only the editing style. VS Code on the other hand gives you that editing style (arguably less powerful, but good enough for my needs) plus a whole lot of other things without much configuration. I'd choose VS Code anyday
For everz we've ben trying to shove one into the other.
Every IDE has a sort of shitty text editor.
Every text editor tries to make a shitty IDE.
Can someone please ackgnowledge that the reality is that neither is a good approach? I wish that I could have complete integration between VIM and JetBrains suite. Would be nice if the JetBrains platform could render a VIM inside itself as the actual text editor but kept 100% of its features as vim plugins to be installed. That way nobody has to re-invent the wheel on great text editing (emacs falls into this category too) and actually making intelligent IDEs.
Here's my more conservative plugin list:
https://git.sr.ht/~sircmpwn/dotfiles/tree/.vimrc
fugitive: I use this for the sole purpose of :Gblame because the command line blame tool that ships with git is frustrating to use.
ctrlp is there for opening files quickly in large codebases. It's better than NerdTree and fits more nicely into my workflow.
surround should be built into vim.
editorconfig is useful because I work on a large variety of projects.
The rest of the plugins are syntax highlighting related. ctrlp and surround are the only ones which meaningfully change the experience of using vim.
As for the unix philosophy, it's all about programs doing one thing and doing it well... but isn't it also about composing those programs to do the job you need done? If you're just ^z'ing out of vim to run `grep` or `ack`, how do you get those results back into vim? copy/paste it through your terminal emulator, using tmux in the best case scenario? How is that more in line with the unix philosophy than simply having vim shell out to those utilities for you?
^z to run unix utilities is like coping the output of one command into a file on disk before sending it to another, instead of simply piping the output of one into the input of another using the functionality of your shell. If vim filling in for a shell violates the philosophy, then damn the philosophy. I'd rather have "the traditional shell+domain specific shells(vim, ranger, etc)" than turn the traditional shell into a one-size-fits-poorly shell.
https://github.com/mileszs/ack.vim (Because ack.vim and plugins like it are actually in keeping with the so-called unix philosophy for reasons I outlined above, you don't actually have to use `ack` with ack.vim. I use it with `ag` (the silver searcher) instead.)
Because ack.vim can't be piped into other tools. You can't, for example, limit your search to the last 50 files modified. Or only to executable files. You can't pipe the results into sed or make matching files world-readable. Sure, you could install ack.vim, slow down vim's startup and bloat your installation, or you could just hit ^z and use the unparalleled power of the Unix shell.
>How is that more in line with the unix philosophy than simply having vim shell out to those utilities for you?
Sometimes it's not. But vim has ! built in, you don't need plugins to run commands from it. I do it all the time.
Or I could use both, when the need arises, which frankly it never has for me. Ack.vim does not preclude using ^z when you have a special need, it optimizes the common case. And Ack.vim is much nicer than !ack <cword>
> "install ack.vim, slow down vim's startup and bloat your installation"
Well I don't run vim on a z80, so the difference would be pretty hard to measure ;). The way modern well-coded vim plugins like Ack.vim work involves lazyloading using 'autoload' (which is poorly named.) Ack.vim includes plugin/ack.vim (p/av) and autoload/ack.vim (a/av). p/av loads when you start vim, but is a light-weight file that only contains keybindings and settings variables. The actual code of Ack.vim, the function definitions, exists in a/av which is loaded lazily, when one of those functions is called by a keybinding created in p/av.
The result is a truly negligible startup impact.
https://github.com/mileszs/ack.vim/blob/master/plugin/ack.vi...
https://github.com/mileszs/ack.vim/blob/master/autoload/ack....
I rarely (if ever) need to make matches world readable from the context of text editing. When I do, there's nothing stopping me from using ^z, but until that day comes, a plug-in is going to be fewer keystrokes, faster, and better integrated with what I was already doing.
For example, to use ripgrep:
set grepprg=rg\ --vimgrep\ --no-headingAs someone who used to do this, I can tell you it's not very effective. For example, build systems. I work with a lot of C++ code, and after making changes I used to ctrl-z to the terminal and then `make` manually ... only to get blindsided by lines and lines of error messages, many due to a lot of trivial syntax errors. Using YouCompleteMe may not be very minimal or "Unixy", but having error messages inline with my code and being able to correct them as I work is invaluable. Maybe your experience is different, but I couldn't get it to work for me. ¯\_(ツ)_/¯
Nowadays I have a vimrc that just tweaks vanilla features the way I like, plus some highlighting for certain keywords regarding a C codebase I occasionally work on. The only plugin I use is a modified version of DetectIndent.
I've found that setting a custom colorscheme in vim averts this problem completely. If I see my colorscheme, my muscle memory is primed for my config. If I see the default vim colorscheme, my muscle memory reverts to default vim.
If somebody gave me a copy of otherwise vanilla vim to use that had my colorscheme, that would certainly throw me for a loop. But so far nobody has been that diabolical.
Tbh, the only thing that gets in my way are the exact tab-related settings you also have.
In any event, I just mitigate this problem by not overriding a bunch of standard behaviour. Also, none of the many plugins I use modify any standard behaviour in any serious way, they just help speed up certain actions when working in a large code base. There is very minimal context switch for me when editing a file remotely.
As for other plug-ins, there are a few I would recommend (can you tell I'm a Tim Pope fan?):
- vim-commentary: Gives bindings for commenting out code quickly: https://github.com/tpope/vim-commentary
- vim-surround: Easily surround selected text with symbols: https://github.com/tpope/vim-surround - vim-unimpared: Adds bindings for some misc. commands, like enabling relative line numbers and spellcheck: https://github.com/tpope/vim-unimpaired
- vim-repeat: Allows many more commands to be repeated with . : https://github.com/tpope/vim-repeat
- VimCompletesMe: A much more bare-bones auto-completion tool than YouCompleteMe, hitting tab gives you matches from your previously typed text. It's also all in vimscript so it's much easier to install and manage: https://github.com/ajh17/VimCompletesMe
- Pathogen: A plug-in manager, if you can call it that. It simply re-adjusts the file paths so you can centralize your plugin directory. Some plug-in managers will auto-update, but I never liked that, just run git pull if you wish to update a plugin: https://github.com/tpope/vim-pathogen
There are some other cosmetic ones I like as well, like airline, and vim-highlightyank, but that's a personal preference.
And you can just use the built in :Ex for that
I'm not a vim user (yet), but this feature is built into Atom and I've come to find it indispensable. I'm a bit of a commit diff freak (I like it neat and tidy), and once i've finished messing around on some branch I want to gradually converge to some simple differences, a git diff type gutter is really helpful in visualising ("watch git.." can come close but nothing is as good as in editor integration).
For those that want to take a look at some more vanilla approaches to some common tasks, Max Cantor has a great talk about that on YouTube [0].
Vim has no unified plugin structure, there are several plugin manager packages (often installed via git clone). I personally use vim-plug[i] which is more on the minimal side, but there are others like pathogen or vundle. No real centralized plugin repository like melpa, I don't think one of the plugin managers I've used had some kind of common install-screen. You mostly enter the github address and execute the package update vimscript. I've seen more Emacs info packages than :help docs, but in most cases I'm browsing the githup README.md/.org anyways.
I create a ".vim\pack\foo\start\" folder and git clone plugins there.
Invoking ":helptags .vim\pack\foo\start\somenewplugin\docs" for a plugin makes the docs available to the :h and :helpgrep commands.
If configurability is a burden on you just quit Emacs because that's its biggest point which makes it a very productive tool. And just like a sponge won't clean your tabletop by itself if you don't put soap on it and rub it to the tabletop, Emacs can't do anything for you if you don't learn how to use it and actually use it.
C-h i: info manuals
C-h ?: help for help
C-h F: help for commands
C-h v: help for variables
C-h f: help for functions
C-h m: help for minor modes
That's a lot of help if you ask me!https://valloric.github.io/YouCompleteMe/
:)
I like the default vim keybindings, but I don't like having to install plugins in order to make my editor usable, I like the batteries-included concept.
But when I try to learn Emacs I can't accept the fact that I have to press M-v to go up one screenful. It must become really uncomfortable really fast.
For a Windows console user - it's worth noting that since they got 24-bit colours working in the console the work is now on-going to get the colours properly working in terminal Vim [1].
[0]: https://github.com/vim-airline/vim-airline/wiki/Dummies-Guid...
nerdtree :E<CR>
fuzzy finding :e /index<Tab> (index being part of filename)
autocompletion <CTRL-P> while in insert mode and typing word
I'd love to switch to Vim...
You spend most of your time in Vim (when editing) in normal mode, executing deft movements and register usage to behave as a surgeon upon the text, as it were. Vim's noun/verb with multipliers make this an effective editing paradigm. Enlightened users have reported "thinking in Vim."
Vanilla Emacs to a vim user feels like you're always in "insert" mode. Chording everything felt a little weird, and I gave up on evil-mode because it wasn't vim enough for me.
here are some plain vim alternatives:
1. goyo: i write markdown quite a bit. it is not necessary to have much for this except perhaps syntax highlighting. hiding the status line can likely be done with a few configuration directives.
2. gitgutter. for the described use case: <ESC>:new<ENTER>:read !git diff use the search :/ to go from one diff to the next
3. vim-surround
for a word: (<ESC>wa) for a line: (<ESC>$a)
depends on the situation, but i'd need more to be sold to use this plugin.
4. vim-autoclose as described here it might possibly be nice except if you have to write a smiley, an arrow, or similar. if you never need to i can see this being useful, but the effect is quite minimal, as going to the end of the current line is a matter of <ESC>$ and inserting a closing parenthesis after it is a matter of a) .
5. vim-commentary visual block mode is sufficient for this usually. java: (<ctrl>+v)<ESC>$g$0i//<ESC>
6. the gruvbox color scheme looks pretty neat. however: the built-in desert scheme works well on almost every machine and is included by default, so there is no real need to go to this amount of trouble. if you work regularly under a shared root account via ssh, i think it is wise to stay away from custom color schemes.
7. could be useful actually, i might try it. however find and grep and other external tools can be used from vim as well. the only gain by using this is that results appear as you type instead of after. marginal gains.
<ESC>:new<ENTER>:read !find -name 'bla' 8. i think the preinstalled netrw plugin is just fine for exploring. it can be configured to run in a treemode too with some configuration. and the advatage is that it will be available on your average shared server account as well, so it pays much more dividend to learn netrw over nerdtree.
9. sounds like a simple remapping. you could just use the default key <ctrl>+p . the nice thing is that this will be available on shared servers.
10. importing is pretty easy already. here is how i do it. importing <ESC>1giim<ctrl-p> whatever dropping <ESC>/import\ what*<ENTER>dd
Agreed.
For a bit of an optimization to that:
- https://github.com/rainux/vim-desert-warm-256
Not many stars on it, but works on a few machines without needing to have extra stuff installed.
Plug 'mileszs/ack.vim', {'as': 'vim-ack'}
Plug 'vim-airline/vim-airline', {'as': 'vim-airline'}
Plug 'slashmili/alchemist.vim', {'as': 'vim-alchemist'}
Plug 'ap/vim-css-color', {'as': 'vim-css-color'}
Plug 'hail2u/vim-css3-syntax', {'as': 'vim-css3-syntax'}
Plug 'ctrlpvim/ctrlp.vim', {'as': 'vim-ctrlp'}
Plug 'ck3g/vim-change-hash-syntax', {'as': 'vim-change-hash-syntax'}
Plug 'Raimondi/delimitMate', {'as': 'vim-delimitmate'}
Plug 'junegunn/vim-easy-align', {'as': 'vim-easy-align'}
Plug 'elixir-editors/vim-elixir', {'as': 'vim-elixir'}
Plug 'airblade/vim-gitgutter', {'as': 'vim-gitgutter'}
Plug 'fatih/vim-go', {'as': 'vim-go'}
Plug 'junegunn/goyo.vim', {'as': 'vim-goyo'}
Plug 'othree/html5.vim', {'as': 'vim-html5'}
Plug 'pangloss/vim-javascript', {'as': 'vim-javascript'}
Plug 'othree/javascript-libraries-syntax.vim', {'as': 'vim-javascript-libraries'}
Plug 'tpope/vim-markdown', {'as': 'vim-markdown'}
Plug 'tmhedberg/matchit', {'as': 'vim-matchit'}
Plug 'scrooloose/nerdcommenter', {'as': 'vim-nerd-commenter'}
Plug 'scrooloose/nerdtree', {'as': 'vim-nerdtree'}
Plug 'chr4/nginx.vim', {'as': 'vim-nginx'}
Plug 'prettier/vim-prettier', {'as': 'vim-prettier'}
Plug 'tpope/vim-rails', {'as': 'vim-rails'}
Plug 'tpope/vim-repeat', {'as': 'vim-repeat'}
Plug 'cakebaker/scss-syntax.vim', {'as': 'vim-scss'}
Plug 'justinmk/vim-sneak', {'as': 'vim-sneak'}
Plug 'tpope/vim-surround', {'as': 'vim-surround'}
Plug 'gasparch/tagbar', {'as': 'vim-tagbar'}
Plug 'SirVer/ultisnips', {'as': 'vim-ultisnips'}
Plug 'mbbill/undotree', {'as': 'vim-undo-tree'}
Plug 'maxbrunsfeld/vim-yankstack', {'as': 'vim-yankstack'}That said, what’s described here is nowhere close to “vanilla” vim.