Apart from setting up a preferred color and language specific tab spacing and highlighting, I don't need more, but I've seen some pretty fancy setups.
Out of the different plugins, which would you never operate without?
Apart from setting up a preferred color and language specific tab spacing and highlighting, I don't need more, but I've seen some pretty fancy setups.
Out of the different plugins, which would you never operate without?
set tabstop=4
set expandtab
set shiftwidth=4 " or 2 or whatever
set shiftround
syntax on
EDIT:Just for some fun archeology, I google searched on the 3rd line, 'set shiftwidth=4 " or 2 or whatever' because I very dimly recall copying most of my standard set (minus the syntax on bit) from someone else a long long time ago. This was the only hit I found:
https://www.perlmonks.org/index.qs1968.pl/perlmonks.org?disp...
if $WORK_COMPUTER
set number
endif
But then I came to like line numbers and just have 'em on all the time now. '<,'>w !xclip -selection clipboard
to copy the text to your clipboard. Macs have another program that works similar to xclip, but I don't remember what it's called.But now you've said it maybe I'll remember if I need it today, and.. well I'll see.
pbcopy
While I'm here, on Wayland substitute wl-copy (or whatever you use).
:set nu!
Just toggle them off when you copy/paste, then on again. Takes a fraction of a second.> nnoremap <C-n> :exe 'set nu!' &nu ? 'rnu!' : ''
Are you still using goto's ?
% vim Makefile
:verbose set expandtab?
noexpandtab
Last set from /usr/share/vim/vim90/ftplugin/make.vim line 15
% vim file.c
:verbose set expandtab?
noexpandtab
Last set from ~/.vim/vimrc line 56
but I think that may not work as intended for OP as they don't have "filetype on plugin". set autoindent
set copyindent
set preserveindent
This should be compatible with basically any language (other than some esolangs like "whitespace") and any tab/spaces scheme. There's no need to have per-file/project configuration, as long as you're okay with pressing space 4 times instead of tab in the projects that use 4-space indentation. autocmd FileType go,make,sh set noexpandtab
autocmd FileType js,json set sw=2 ts=2
Edit: I think you might also need the following to make it trigger the FileType event when you open a file in the first place: filetype plugin indent on set expandtab shiftwidth=4 softtabstop=4 tabstop=4
syntax on
set number
inoremap jk <Esc>If you type `j` in insert mode, it waits to see if there's a possible `k` following. That's the lag.
There's a setting for how long it waits.
> set timeout timeoutlen=3000 ttimeoutlen=100
set number
setlocal cm=blowfish2
set noswapfile
set nobackup
set nowritebackup
set viminfo=
set tabstop=4
set softtabstop=0 noexpandtab
set shiftwidth=4
set noundofile
set backspace=indent,eol,start
set autoindent
set smartindent
set cindent
autocmd BufRead,BufNewFile *.vue setfiletype html
colorscheme morning
map Q <Nop>
map q <Nop>
noremap x "_x
let &t_ut=''
if has("gui_running")
:set guifont=Cascadia_Mono:h16:cANSI:qDRAFT
endifyou turn off macro recording? any particular reason why?
" My vimrc from 1994 to about 2000
set et
set ts=4
" Added this circa 2000
syntax on
" Added this ~2013
let g:solarized_termcolors=256
set background=light
colorscheme solarizedshiftwidth([{col}]) shiftwidth() Returns the effective value of 'shiftwidth'. This is the 'shiftwidth' value unless it is zero, in which case it is the 'tabstop' value. This function was introduced with patch 7.3.694 in 2012, everybody should have it by now (however it did not allow for the optional {col} argument until 8.1.542).
When there is one argument {col} this is used as column number
for which to return the 'shiftwidth' value. This matters for the
'vartabstop' feature. If the 'vartabstop' setting is enabled and
no {col} argument is given, column 1 will be assumed.
Can also be used as a |method|: >
GetColumn()->shiftwidth()
What does that even mean? And I've been using vi since 1988!![0] https://github.com/weiss/original-bsd/commit/3effe8f62d3c7b5...
shiftwidth is how far text moves when you shift it with >> or <<
Normally you'd set them both to the same value so that indenting blocks of code with >> or << shifts them by the same amount as the tabstop.
There's also another setting 'shiftround' (which I only learnt about today in another comment) which makes shifts done with << and >> round themselves to the nearest multiple of shiftwidth.
never occurred to me to use >>. probably because the three keystroke savings didn't register with me. but that's what I mean, once I learn the basics, the rest are just gravy that don't stick in my memory.
> i've always used 0i\t\t\t\t...\esc to shift.
Also consider I instead of 0i (it's not quite identical, but should serve the same purpose).
If I'm working in any other language it's == (for a single line), or = after marking a region in visual mode, or magg=G'a to just re-indent the whole file.
I haven't used vim as a daily driver in ~14 years; it's weird how the muscle memory of things like magg=G'a or gqip stay in your fingertips.
noremap ; l
noremap l k
noremap k j
noremap j h
- neoterm, for opening a REPL in a split buffer and quickly sending chunks of lines to the REPL (https://github.com/kassio/neoterm)
- fzf for faster buffer and file navigation (https://github.com/junegunn/fzf.vim)
- vim fugitive for good git integration (https://github.com/tpope/vim-fugitive)
- some other tpope plugins (surround, unimpared, commentary, vinegar)
The most important ones lately seem to be the LSP integrations (basically IDE features like autocompletion, go-to-definition etc) and auto-completion managers. But honestly it's been breaking all the time over the last year or so that I code more often in VSCode and maybe it's about time I stop trying to make an ever-improving IDE out of Neovim :(
Neovim project's direction seems to be aligned with making it easier to have IDE-like experience with LSP integration but it's been painful in Neovim. In Vim, it's typically even worse and even harder to set it up.
Overall, I've been using Vim for about 8 years and went from a really simple set-up of "this is just a text editor" down the IDE rabbit hole. I also went for Vim -> Neovim -> Vim -> Neovim and eventual split of the two configs in the end and. I'm thinking about making it much simpler again :D
I have a quite extensive setup (https://github.com/Julian/dotfiles/tree/main/.config/nvim) which I built up over 10+ years, indeed sometimes including sitting there for an hour or two and just investigating plugins or writing some function to make editing easier. I enjoy it, and it means I can do lots of things in my setup that involved time investment.
Others obviously just want to get on with their work.
To me though part of the reason I use vim/neovim is because anytime something annoys me about editing I can automate it, or find a plugin which has done so already.
Every once in awhile I think I might do a fancier setup but then I lose interest. Ditto for checking out neovim. I'm sure I'd get some gains, but I guess I've sort of settled into a decent sweet spot that I haven't left for almost a decade, haha (been using vim for ~25 years total).
Since this editor (and Emacs) are SO extensible, it's hard to find two long-time users with similar configs.
Previously to managing my dotfiles, my .vimrc was usually 4-5 lines, written by hand on each machine I sat at. This was my first 20+ years of vi/vim.
Once I started managing dotfiles across systems (~3 years ago), my .vimrc has grown to be ~700 lines. My .bashrc has also grown to almost as much for reference.
Like most, the work in customizing .vimrc is in configuring plugins and making sure they don't conflict with each other, but also, I've taken care so that I can use the same configs across Linux and Windows, allowing me to use the same tools, plugins and configurations regardless of the underlying OS. Neovim is my tool of choice on both OSes but my configs fallback well to vim or other vi implementations rather gracefully (via bash/pwsh alias trickery) for when needed.
Regarding plugins that I would never operate without (of the many installed): - nerdtree (and friends like nerdtree-git-plugin, vim-nerdtree-syntax, vim-devicons) for decent file nav integration - vim-fugitive (Git integrated into vim, makes interactive commit creation and navigation easy from within vim) - Coc for language server support that works on both sides of the fork and vscode like plugins.
Also, not a plugin, but worth configuring in your environment: neovim-remote. I use this to make "vi <file>" open the file in a new tab, rather than start a nested editor, from within a terminal window within neovim (again with more shell alias trickery dependent upon $NVIM_LISTEN_ADDRESS being set or not). Using it for $EDITOR and $VISUAL when NVIM_LISTEN_ADDRESS is set is also really useful when invoked indirectly by tools being run in a windowed terminal e.g. "git commit" or "kubectl edit".
If you aren't tracking dotfiles, I really suggest you start. It's really cool to be able to sit at a new system, sync some files and get your editor / development environment installed/booted with all the bells and whistles you like installed ready to go. You will find that there is no end to this rabbit hole in the end. I think that's a good thing :)
Vim only has that reputation of needing a lot of config because too many newbies want to skip the learning phase and just jump in between two JIRA tickets. Of course you will need a lot of plugins and pre-baked stuff and hand-holding in that case!
The more sensible path is to learn Vim properly, and configure it as you go. It means that there's never a "take the week-end to configure Vim for React" moment: it's one line here, two lines there and it never really stops because you work with new languages and libs, etc.
As far as plugins. I can use Vim just fine without plugins or without my config but half of the plugins I use are written by me and tailored around my own needs so I guess those are the ones I need the most for my daily use.
One of the issues I found was that every plugin seemed to reference other plugins and you need to figure out how to make them play nicely together yourself. Most of the best info is just buried in GitHub issues and neovim was such a moving target that everything needed more digging into to get working correctly.
For me now essentials include; Telescope, Trouble, Cmp and a good LSP setup.
$ du -s -h .vim
22M .vim
A lot of that is git submodule history.Specific plugins I use all the time: bufexplorer (though I've mostly rewritten it), ctrlp, colorizer, syntastic, vim-commentary, vim-projectroot, vim-surround, zeavim (Zeal integration, similar to Dash on macos).
The plugin that I find myself using all the time is vim-surround with a couple of minor language-specific tweaks.
The editing plugins I use most heavily are probably vim-surround and vim-commentary. My development would definitely slow down without them.
I would say that the plugins I could not do without are:
- vim-polyglot
- syntastic
- nerdtree
- coc.vim