Skip to content

gko/vimio

Repository files navigation

Vim Settings

screenshot

An article describing key features of this config.

Prerequisites

In order to get all features you might want to install following packages:

Installation

On unix and windows(with bash which can be installed with git):

curl -L https://raw.github.com/gko/vimio/main/install.sh | bash

macOS

In macOS terminal.app don't forget to check the «Use option as meta key»:

terminal

And «Esc+» option in iterm2:

iterm2

Shortcuts

Some of shortcuts(Leader key is comma):

  • Ctrl + s saves current file
  • Leader + s in both select and normal mode initiates search and replace
  • Alt + Up/Down moves line or selection above or below current line(see upside-down for more info)
  • Alt + Left/Right moves character or selection to left or to the right
  • Leader + n toggles NERDTree
  • Leader + m shows current file in NERDTree
  • when in select mode ', ", ( wraps selection accordingly
  • y + m yanks found matches(see yankmatches.vim for more info)

Plugin shortcuts

vim-surround

For general instructions see README

See this issue for visual mode

Coc.nvim

For vim I use Coc.nvim, in their repository you can find their example vim configuration for shortcuts.

nvim-lspconfig

For nvim I use native nvim lsp config. You can find the example config here: example lsp config

Language servers installation
Typescript/Javascript

https://github.com/typescript-language-server/typescript-language-server#installing

Go

https://github.com/golang/tools/tree/master/gopls#installation

Rust

https://rust-analyzer.github.io/manual.html#installation

you may need to install:

Zig

https://github.com/zigtools/zls/wiki/Installation#install-zls

Scala

https://scalameta.org/metals/docs/editors/vim/#using-an-alternative-lsp-client

PHP

https://github.com/bmewburn/intelephense-docs/blob/master/installation.md

List of all plugins and commands

You can find the list of plugins as well as commands that they provide in the init.vim file.

Your config

If you create ~/.vimrc.local it will be loaded before the end of vim-plug. So you can add a custom config + vim plugins of your choice there.

Example .vimrc.local.

Color scheme

You can have a ~/.vimrc_background file, where you keep custom colorscheme settings.

Example can be found here. And you can symlink it as following:

ln -sf ~/.vim/.vimrc_background ~/

Taking notes and TODOs

  • Leader + w + w opens ~/Documents/Notes/index.md
  • :Todo opens ~/Documents/Notes/todo.md in a vertical split and fills in current date

see more info in this article: https://dev.to/konstantin/taking-notes-in-vim-revisited-558k you can find the code here: https://github.com/gko/vimio/blob/de73a9272c29acc6f2ce6d5be7f24cbe113a85b4/after/plugin/shortcuts.vim#L225-L229

and here

https://github.com/gko/vimio/blob/de73a9272c29acc6f2ce6d5be7f24cbe113a85b4/after/plugin/filetypes.vim#L28-L32

Checkboxes

For checkboxes vim-checkbox plugin is installed

Pasting images

With help of md-img-paste.vim you can paste images by using Leader + p (it would store in the same folder as the markdown document in img folder)

Benchmark

Not that it matters, but I get the following startup time:

$ hyperfine "nvim --headless +qa" --warmup 5
Benchmark 1: nvim --headless +qa
    Time (mean ± σ):     200.1 ms ±   6.9 ms    [User: 123.9 ms, System: 63.2 ms]
    Range (min … max):   191.9 ms … 210.9 ms    14 runs

License

MIT

Copyright (c) 2012-2024 Konstantin Gorodinskiy