# VIM This repo contains my vim configuration, hope it will be useful for you. ## Installation You will need `vim` and `git` to be able to use this configuration. Normally if you run the `install.sh` script it will work, but if you have a problem, try to install vim plug and check if your problem is solved. ```bash curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ``` Oh and remove neovim, it make some problems with vim. ## Plugins This config has just the necessary plugins installed: ### Themes - [OneDark](https://github.com/joshdick/onedark.vim) onedark theme. - [Vim Airline](https://github.com/vim-airline/vim-airline) Vim statusline. ### Graphics utilities - [Fern](https://github.com/lambdalisue/fern.vim) to have a file tree in vim. - [Fern renderer devicons](https://github.com/lambdalisue/fern-renderer-devicons.vim) to have devicons in fern. - [Fern git mapping](https://github.com/lambdalisue/fern-mapping-git.vim) to add git stage & unstage in fern. - [Fern git status](https://github.com/lambdalisue/fern-git-status.vim.git) show file git status in fern. - [Vim which key](https://github.com/liuchengxu/vim-which-key) show leader keybinds in a GUI. - [Vim devicons](https://github.com/ryanoasis/vim-devicons) language icons for vim. - [Vim gitgutter](https://github.com/airblade/vim-gitgutter) to see diff between files with git. ### LSP - [Vim-lsp](https://github.com/prabirshrestha/vim-lsp) linter & formatter for language. - [Vim-lsp settings](https://github.com/mattn/vim-lsp-settings) easily setup lsp servers for languages. - [Asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim) async autocompletion - [Asyncomplete & lsp-vim](https://github.com/prabirshrestha/asyncomplete-lsp.vim) use vim-lsp as source for autocompletion lsp server. - [Vim Wakatime](https://github.com/wakatime/vim-wakatime) to have wakatime time tracking in vim. ### Languages utilities - [Vim emmet](https://github.com/mattn/emmet-vim) html snippets & utilities to write html faster. ## Command & keybinds ### General - `hl` remove highlighting #### Window - `Ctrl+h` move to the left window, - `Ctrl+j` move to the bottom window, - `Ctrl+k` move to the upper window, - `Ctrl+l` move to the right window, #### Buffer - `bd` close the current buffer, - `ba` close all the buffers, - `bn` go to the next buffer, - `bp` go to the precedent buffer, #### Tabs - `tn` open a new tab, - `to` close all other tabs, - `tc` close current tab page, - `tm` move the tab after another, - `t` go to the next tab, - `tl` toggle between this tab and the last accessed tab, - `te` open a new tab with the current buffer, #### Spell check - `ss` toggle / untoggle spellchecking, - `sn` go to the next word to spellcheck, - `sp` go to the previous word to spellcheck, - `sa` add a word into the dictionary, - `s?` show the list of alternatives for the word, More help at `:help spell` ### Fern For help, use `:help fern`. Keybinds: - `Ctrl+f` open the treeview buffer at the left, - `ga` stage a file from git, - `gd` unstage a file from git, - `a` create a file or folder, - `d` delete a file or folder, - `r` rename a file or folder, - `m` move a file or folder, - `v` open a file in vertical split, - `s` open a file in horizontal split ### Vim Gutter For help, use `:help gitgutter`. Keybinds: - `hp` go to the previous hunk, - `hn` go to the next hunk, - `hP` to preview hunk, - `hs` to stage hunk, - `hu` to undo hunk, - `ht` to toggle GitGutter. Hunks are the difference between your file and the git file. ### LSP For help, use `:help vim-lsp`. Keybinds: - `ld` go to the definition, - `lnd` go to the next diagnostic, - `lpd` go to the previous diagnostic, - `lf` go to the reference, - `lr` rename element, - `ls` stop lsp server, - `lp` peek a view to the definition, - `la` code action, - `lh` lsp hover, - `ldf` format document. ### Emmet For help, use `:help emmet`. Keybinds: - `,` to create tags from an expression, - `;` to create a tag from a word, - `u` to update a tag, - `d` to select a tag and the content of a block, - `D` to select the content of a block, - `n` to jump snippet next edit point, - `N` to jump snippet previous edit point, - `i` to add width and height on image tag, - `m` to join multiline in one line, - `k` to remove the content of a block, - `j` to split join tag, - `/` to comment a block, - `a` to create an anchor (a href), - `A` make quoted text from an url, - `c` to convert a code block into html. ## Linters & fixers ### Python For using python linters & fixers, you will need to setup a virtual env & install the linters & fixers. ```bash python -m venv .venv source .venv/bin/activate pip install python-lsp-server[all] ``` ## VM To code on a virtual machine, I use sshfs, it just mount the system of the vm on my machine and tada! ```bash sudo mkdir /mnt/vm sudo sshfs -o allow_other -p 22 user@localhost:/home/user/ /mnt/vm/ ```