Home

Awesome

Kyoz Neovim

Cool & Modularized vim configurations to work like an IDE

<p align="center"> <img src="demo.gif" width="800px"> </p> <p align="center">(Sorry for low quality gif, i'v tried to optimize and reduce the demo.gif size. I'll update it later when i have time)</p>

View asciinema version (without nerd font it look not too good)

Currently i'm using coc.nvim. But there's also a version using ncm2, you can try it here.

Table of contents

Introduction

This's my efforts to create an IDE like with nvim. With cover a lots of great features for coding: syntax, autocomplete, snippets, language server protocol...but with very simple and modularized scripts, which every one can easy understand and config.

<details><summary>My vim story</summary> <p>

I'v falled in love with Vim in the first time i'v tried it. I love the way i can coding, writing without using mouse or trackpad to move the cursor arround...

In the past, i just use VSCode as my main editor. If Vim doesn't exist in my life, i think VSCode definitely is the best (with me).

There are times i'v quit using Vim cause it's so hard to customize and using, mostly because i can't integrate autocomplete for it. So i give up and back to using VSCode.

But then i'v figure out that i can't life without Vim. I have to install VSCodeVim (An extension provide some Vim feature in VSCode). Although it work, but it lack a lot of Vim's features, and it slow down my machine too.

Then i'm back with vim, this time i pay a lots of time to learn, to customize my vimrc. And now, i'm really happy that i can use Vim (Nvim) as my main editor with those configurations. I hope this can help you all too :blush:

</p> </details>

Requirements

System

Those configurations is only for Neovim, although most plugins work with Vim too, but i'v built this only for Neovim.

For Vim, i just have some minimal configurations in my dotfiles.

Those configurations work well on almost all OS i'v ever used (OSX, Linux, Window...).

But as it scale, i haven't have times to check it all, for now i just use OSX at home and Linux at work. So i can only make sure it work well on OSX and Linux. If you have any problem with Window please open an issue.

Neovim

In order to have all the coolest features. You should install lastest release (>= 0.4.0) Nvim. Which support some new great features like float window...

Nodejs

There's a lot of plugins that use external packages (Like language server protocol...). And we do need to install Nvim Node.js provider too. So Nodejs & Npm is needed.

Please download and install it or you can install it via package manager

Providers

We have to install python providers (most nvim plugins do need em to work). Python 2 is no actually required. But some plugin may need it, so just install them all :laughing:

Assume you are using linux:

# Installing python 2.7 and pip for it
sudo apt install python2.7 python-pip
# Installing python-pip for 3.6
sudo apt install python3-pip

# Install neovim for python 2
pip2 install pynvim
# Install neovim for python 3
pip3 install pynvim

Already installed python neovim ? Then upgrade it (Some plugins need latest versions)

# Upgrade neovim for python 2
pip2 install --upgrade pynvim
# Upgrade neovim for python 3
pip3 install --upgrade pynvim

Nvim Node.js client is also needed (for neovim to be able to communicate with plugins). Let install it too:

npm install -g neovim

For clipboard support you must install xclip or xclipboard

Installation

Before starting with this step, you must make sure that you'v read and install everything required in above steps.

And make sure there's no ERROR showing when running :checkhealth in nvim.

Download

Download everything in this repo and put em in the nvim folder of yours (Usually it's in ~/.config/nvim).

Or clone it with git (make sure there no file's in ~/.config/nvim or that folder does not exist for git to work):

git clone git@github.com:kyoz/neovim.git ~/path_to_your_nvim_folder --depth 1

" Example
git clone git@github.com:kyoz/neovim.git ~/.config/nvim --depth 1

Install Plugins

Open nvim and use :PlugInstall or :PlugI to install all plugins (If there are errors showing when you first running this, just enter to pass them all).

Quit and re-open nvim and now you have nvim with a lots of feature which can be your main IDE.

Fonts

In order to make everything look cool as it have to (with vim-arline, nerd-tree icons...), we have to using patched fonts. You can view some pathced fonts here.

There's a /fonts folder with patched Iosevka font, which i'm using now. You can use it too.

I'v tried a lots of fonts, but this Iosevka font seem suitable for me, it's easy to read and doesn't make me lose focus when coding.

Snippets

I'v use neosnippet to provide snippets for Vim. You can view all the snippets i have in snippets/ folder.

Currently i just add some basic snippet with some languages i usually use: html, css, javascript, typescript....

Because i use Angular, Material Components and Flex layout a lots. I also create snippets for em too :blush:. It's super useful.

Just view some examples in my snippets and you'll know how to create your own snippets.

Others

It's hard to cover all the cases when install neovim in each machine, os...

Please run :checkhealth in nvim to make sure everything is ok. Follow it's constructions and fix any errors you see.

If there's still error, please open and issue and let me know, i'm happy to help.

Features

Support Languages

Wait, why there's only a few languages ?

To provide autocomplete feature, i do use coc.nvim. There's a lots of extensions (which support for more languages, frameworks, filetypes...)...you can see it all in coc.nvim's Readme

Why not use other autocomplete plugin like deoplete, ncm2 ?

Actually, i'v used deoplete and ncm2 for a long times. It's all work great. But then i know coc.nvim, i really like the way it manage the extensions. With coc's extensions, i can easily add more languages autocomplete, add more useful extenstions without any fear...

There's also a version which using ncm2, you can try it here.

Plugins

Colors

PluginDescription
kyoz/purifyrainbow Clean & vibrant color schemes for Vim, Terminals...

Toolbar

PluginDescription
bling/vim-airlineStatus bar, Tabline
vim-airline/vim-airline-themesVim-Airline Themes
tpope/vim-fugitiveJust use to show git status in Vim-Airline

Finder

PluginDescription
junegunn/fzf.vimFuzzy file finder (help jump to other files faster and easier)

Note: I use ack.vim to provide global search feature for Vim. If you found the the search is slow. You can use the silver searcher as the search engine for ack.vim.

Navigate

PluginDescription
scrooloose/nerdtreeNerd Tree (View your folders in tree visualization like in VSCode)
tiagofumo/vim-nerdtree-syntax-highlightColors for NerdTree's icons
ryanoasis/vim-deviconsFiletype icons for NerdTree
easymotion/vim-easymotionJump around the screen like a boss
andymass/vim-matchupBetter % and highlight matching words
tommcdo/vim-exchangeEasy text exchange
rhysd/clever-f.vim'Make f more powerful

Syntax Hightlight

PluginDescription
leafgarland/typescript-vimTypescript's Syntax
ap/vim-css-colorHelp colorize text color
Valloric/MatchTagAlwaysAlways highlights the XML/HTML tags that enclose your cursor location
MTDL9/vim-log-highlightingSyntax highlighting for generic log files in VIM
MaxMEllon/vim-jsx-prettyJSX and TSX syntax pretty highlighting for vim (Use for React & RN)

Faster Code

PluginDescription
tmsvg/pear-treeAuto pair brackets
alvan/vim-closetagAuto close html tag
pope/vim-surroundAuto surround
tpope/vim-commentaryComment code faster
tpope/vim-repeatdot repeat with pluggins
Yggdroot/indentLineIndent code with v-line
wellle/targets.vimProvides additional text object
mg979/vim-visual-multiMultiple Cursor
mattn/emmet-vimEmmet for vim

Beautiful Code

PluginDescription
FooSoft/vim-argwrapWrap and unwrap function args, list, dicts...
prettier/vim-prettierFormat code

Utils

PluginDescription
NLKNguyen/copy-cut-paste.vimCopy, Paste with Clipboard
skywind3000/asyncrun.vimRun async shell commands in vim
kyoz/ezbuf.vimFast and easy use buffers
kyoz/npm.vimWork with npm more easier in Vim
segeljakt/vim-siliconVim plugin for generating images of source code using silicon
iamcco/markdown-preview.nvimMarkdown Live Preview
godlygeek/tabular'Text filtering and alignment
dhruvasagar/vim-table-modeVIM Table Mode for instant table creation
lervag/vimtexA modern Vim and neovim filetype plugin for LaTeX files
yardnsm/vim-import-cost'Display the import size of the JavaScript packages in Vim!
tweekmonster/startuptime.vimBreakdown Vim's --startuptime output
KabbAmine/vCoolor.vimSimple color selector/picker for Vim
guns/xterm-color-table.vimAll 256 xterm colors with their RGB equivalents, right in Vim!
junegunn/goyo.vimDistraction-free writing in Vim
junegunn/limelight.vimAll the world's indeed a stage and we are merely players
RRethy/vim-illuminateAuto highlighting other uses of the word under the cursor
voldikss/vim-search-mePerform a quick web search for the text selected in (Neo)Vim

Autocomplete

PluginDescription
neoclide/coc.nvimIntellisense engine

Customize

Directory Structure

There's no configurations suitable for everyone. Each one have different tastes.

So, in order to easily customize those configuration. You must understand the structural of configuration files.

/home/kyoz/.config/nvim
├── autoload/
├── colors/
├── configs/
│   ├── init.vim
│   ├── general.vim
│   ├── indent.vim
│   ├── keys.vim
│   ├── plugins.vim
│   ├── autocomplete.vim
│   └── lsp.vim
├── fonts/
├── snippets/
├── init.vim
└── ginit.vim

Folders:

NameMeaning
autoload/Contain autoload .vim files (Currently there's only plug.vim file cause i'm using VimPlug)
colors/Contain vim's color schemes
configs/Contain all main configurations
fonts/Contain some patched fonts are ready to use
snippets/Contain all of mine snippets, which define with NeoSnippet

Files:

NameMeaning
init.vimRun first when nvim start, use this file to link and call other script files (by orders)
ginit.vimTo setting things relate to GUI like fonts, font styles...
configs/init.vimDefinitions all the plugins with VimPlug
configs/general.vimContain all general configurations
configs/indent.vimContain all configuration relate to indent
configs/keys.vimContain all custom mappings
configs/plugins.vimContain all settings of plugins
configs/autocomplete.vimContain all settings relate to autocomplete
configs/lsp.vimContain all settings relate to language server protocol

Mappings

General

All general custom mappings is place in configs/keys.vim

Leader key: <kbd>space</kbd>
Local leader key: <kbd>\</kbd>

MappingModeActions
<kbd>jk</kbd>iExist insert mode faster
<kbd>dd</kbd>nDelete but don't store deleted lines in register
<kbd>space</kbd><kbd>z</kbd>nSave and close current buffer
<kbd>gb</kbd>nJump to next buffer
<kbd>gB</kbd>nJump to previous buffer
<kbd>ctrl</kbd><kbd>h</kbd>nResize window (Reduce width)
<kbd>ctrl</kbd><kbd>l</kbd>nResize window (Expand width)
<kbd>ctrl</kbd><kbd>j</kbd>nResize window (Reduce height)
<kbd>ctrl</kbd><kbd>k</kbd>nResize window (Expand height)

Plugins

All plugins custom mappings is place in configs/plugins.vim

MappingMode
<kbd>space</kbd><kbd>space</kbd>nOpen fzf to search buffers
<kbd>space</kbd><kbd>f</kbd>nOpen fzf to search files (not include node_modules, files & folder in .gitignore...)
<kbd>space</kbd><kbd>F</kbd>nOpen fzf to search all files
<kbd>space</kbd><kbd>l</kbd>nOpen fzf to search for line in current buffer
<kbd>space</kbd><kbd>L</kbd>nOpen fzf to search for line in all buffers
<kbd>space</kbd><kbd>c</kbd>nOpen fzf to search for git's commits
<kbd>space</kbd><kbd>a</kbd>nStart global search with ag
<kbd>space</kbd><kbd>b</kbd><kbd>x</kbd>nClose current buffer
<kbd>space</kbd><kbd>b</kbd><kbd>X</kbd>nClose all buffers
<kbd>space</kbd><kbd>b</kbd><kbd>o</kbd>nClose other buffers
<kbd>space</kbd><kbd>b</kbd><kbd>s</kbd>nClose all saved buffers
<kbd>space</kbd><kbd>s</kbd>nStart Easymotion
<kbd>space</kbd><kbd>S</kbd>nStart Easymotion (two characters)
<kbd>space</kbd><kbd>j</kbd>nStart Easymotion (search below rows)
<kbd>space</kbd><kbd>k</kbd>nStart Easymotion (search above rows)
<kbd>space</kbd><kbd>m</kbd>nOpen markdown live preview (When in markdown file buffer)
<kbd>space</kbd><kbd>t</kbd>nToggle NerdTree
<kbd>space</kbd><kbd>z</kbd>nToggle Focus Writing Mode
<kbd>g</kbd><kbd>w</kbd>nRun AirWrap
<kbd>,</kbd><kbd>,</kbd>nRun Emmet
<kbd>Q</kbd><kbd>C</kbd>nCopy whole line to system clipboard
<kbd>Q</kbd><kbd>C</kbd>vCopy selected text to system clipboard
<kbd>Q</kbd><kbd>X</kbd>nCut whole line to system clipboard
<kbd>Q</kbd><kbd>X</kbd>vCut selected text to system clipboard
<kbd>Q</kbd><kbd>V</kbd>nPaste from system clipboard
<kbd></kbd><kbd>c</kbd>nColor Picker (hex)
<kbd></kbd><kbd>C</kbd>nColor Picker (rgb)
<kbd></kbd><kbd>s</kbd>vSearch selected text with Google

Autocomplete

All autocomplete mappings is place in configs/autocomplete.vim

MappingMode
<kbd>tab</kbd>iGo to next autocomplete candidate
<kbd>shift</kbd><kbd>tab</kbd>iGo to previous autocomplete candidate
<kbd>ctrl</kbd><kbd>j</kbd>iExpand snippet (if possible)

Language Server Protocol

All lsp mappings is place in configs/lsp.vim

MappingMode
<kbd>tab</kbd>iGo to next autocomplete candidate
<kbd>g</kbd><kbd>d</kbd>nView Definition for word under cursor
<kbd>g</kbd><kbd>D</kbd>nView Document Diagnostics
<kbd>g</kbd><kbd>h</kbd>nView LSP Hover result for word under cursor
<kbd>g</kbd><kbd>r</kbd>nRename for word (variable) under cursor
<kbd>g</kbd><kbd>e</kbd>nGo to next error
<kbd>g</kbd><kbd>E</kbd>nGo to previous error
<kbd>g</kbd><kbd>f</kbd>nFormat for current buffer with prettier

License

MIT © Kyoz