# nvimrc **Repository Path**: venjiang/nvimrc ## Basic Information - **Project Name**: nvimrc - **Description**: The ultimate Neovim configuration - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-20 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png) # The ultimate Neovim configuration thanks for [amix/vimrc](https://github.com/amix/vimrc) . ## Installation ### Install Vim Plugin Manager [Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim) and put it in the "autoload" directory. ###### Unix ```shell curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ``` ###### Windows (PowerShell) ```shell md ~\AppData\Local\nvim\autoload $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' (New-Object Net.WebClient).DownloadFile( $uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath( "~\AppData\Local\nvim\autoload\plug.vim" ) ) ``` ### Install nvimrc The version includes a lot of great plugins, configurations and color schemes that make Neovim a lot better. To install it simply do following from your terminal: ```shell git clone --depth=1 https://github.com/venjiang/nvimrc.git ~/.vim sh ~/.vim/install.sh nvim +PlugInstall ``` Just run `nvim`, have fun!!! 😄 ## Screenshots Colors when editing a basic.vim: ![Screenshot 1](https://github.com/venjiang/nvimrc/blob/master/screenshots/basic.png?raw=true) Colors when golang development: ![Screenshot 2](https://github.com/venjiang/nvimrc/blob/master/screenshots/golang.png?raw=true) ## Included Plugins I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Neovim experience! * [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for `the_silver_searcher` (ag) or ack -- a wicked fast grep * [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `` * [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to `` * [goyo.vim](https://github.com/junegunn/goyo.vim): * [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim * [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim * [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` * [snipmate.vim](https://github.com/garbas/vim-snipmate): snipmate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim * [ale](https://github.com/w0rp/ale): Syntax and lint checking for vim (ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel) * [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines. * [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination * [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal * [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts ## Included color schemes * [onedark](https://github.com/joshdick/onedark.vim) The default * [vim-one](https://github.com/rakr/vim-one) * [iceberg](https://github.com/cocopon/iceberg.vim) * [gruvbox](https://github.com/morhetz/gruvbox) * [Oceanic Next](https://github.com/mhartington/oceanic-next) * [Deep Space](https://github.com/tyrannicaltoucan/vim-deep-space) ## Key Mappings The [leader](http://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader) is `,`, so whenever you see `` it means `,`. ### Normal mode mappings Fast saving of a buffer (`w`): nmap w :w! Map `` to `/` (search) and `+` to `?` (backwards search): map / map ? map :noh Disable highlights when you press ``: map :noh Smart way to move between windows (`j` etc.): map j map k map h map l Closing of the current buffer(s) (`bd` and (`ba`)): " Close current buffer map bd :Bclose " Close all buffers map ba :1,1000 bd! Useful mappings for managing tabs: map tn :tabnew map to :tabonly map tc :tabclose map tm :tabmove " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory map te :tabedit =expand("%:p:h")/ Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer: map cd :cd %:p:h:pwd Open `ack.vim` for fast search: map g :Ack Quickly open a buffer for scripbble: map q :e ~/buffer Toggle paste mode on and off: map pp :setlocal paste! ### Visual mode mappings Visual mode pressing `*` or `#` searches for the current selection: vnoremap * :call VisualSelection('f') vnoremap # :call VisualSelection('b') When you press gv you `Ack.vim` after the selected text: vnoremap gv :call VisualSelection('gv', '') When you press `r` you can search and replace the selected text: vnoremap r :call VisualSelection('replace') Surround the visual selection in parenthesis/brackets/etc.: vnoremap $1 `>a)` vnoremap $2 `>a]` vnoremap $3 `>a}` vnoremap $$ `>a"` vnoremap $q `>a'` vnoremap $e `>a"` ### Insert mode mappings Quickly insert parenthesis/brackets/etc.: inoremap $1 ()i inoremap $2 []i inoremap $3 {}i inoremap $4 {o}O inoremap $q ''i inoremap $e ""i inoremap $t <>i Insert the current date and time (useful for timestamps): iab xdate =strftime("%d/%m/%y %H:%M:%S") ### Command line mappings $q is super useful when browsing on the command line. It deletes everything until the last slash: cno $q eDeleteTillSlash() Bash like keys for the command line: cnoremap cnoremap cnoremap cnoremap cnoremap Write the file as sudo (works only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write): :W ### Plugin related mappings Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) to see and manage the current buffers (`o`): map o :BufExplorer Open [MRU.vim](https://github.com/vim-scripts/mru.vim) to see the recently open files (`f`): map f :MRU Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): let g:ctrlp_map = '' [NERD Tree](https://github.com/scrooloose/nerdtree) mappings: map nn :NERDTreeToggle map nb :NERDTreeFromBookmark map nf :NERDTreeFind [ctrl-p](https://github.com/ctrlpvim/ctrlp.vim) mappings to easily find and open a file, buffer, etc.: let g:ctrlp_map = '' map j :CtrlP map :CtrlPBuffer [vim-snipmate](https://github.com/garbas/vim-snipmate) mappings to autocomplete via snippets: ino =snipMate#TriggerSnippet() snor i=snipMate#TriggerSnippet() [vim-surround](https://github.com/tpope/vim-surround) mappings to easily surround a string with `_()` gettext annotation: vmap Si S(i_f) au FileType mako vmap Si S"i${ _(2f"a) } [ale](https://github.com/dense-analysis/ale) to easily go to the next Ale syntax/lint error: nmap a (ale_next_wrap) ### Spell checking Pressing `ss` will toggle spell checking: ```shell map ss :setlocal spell! ``` Shortcuts using `` instead of special characters: ```shell map sn ]s map sp [s map sa zg map s? z= ``` ### Cope Query `:help cope` if you are unsure what cope is. It's super useful! When you search with `Ack.vim`, display your results in cope by doing: `cc` To go to the next search result do: `n` To go to the previous search results do: `p` Cope mappings: ```shell map cc :botright cope map co ggVGy:tabnew:set syntax=qfpgg map n :cn map p :cp ```