269

GitHub - Blacksuan19/init.nvim: An Opinionated Minimalist Neovim Configuration

 4 years ago
source link: https://github.com/Blacksuan19/init.nvim
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

An opinionated Neovim config for the Minimalists

Table of Contents

Why?

Modern Vim distributions are really huge and bloated with way too many fancy features that you won't ever use or need, for example directory trees like Nerd tree, you don't need a tree, you can view a project structure with fzf which is faster and has search. Another example is ThinkVim has a separate extension for formatting while also having ALE which can do that as well, this double functionality is very common, thats one of the things this distro avoids, KISS!

Features

  • Single file (you don't want your dotfiles to be all Vim script)
  • Super minimal (~400 lines)
  • Super fast startup (less than 40ms!)
  • Lazy loading plugins
  • Highly customizable
  • Beautiful Material ocean color scheme
  • Vscode like auto completion, multi cursor
  • Smooth Scrolling (its really smooth!)
  • floating window + borders + file previews on fzf(see demos)
  • Asynchronous Lint Engine
  • Simple, Intuitive shortcuts

Supported Languages

Neovim provides support for a wide range of languages by default. There is also support for:

Requirements

  • Linux (not tested on other platforms)
  • Neovim (you can try regular Vim)
  • Properly set up environment

Setup

To check if your current environment is correctly set up run :CheckHealth.

Environment

  • python
    • python3 pip3 install --user pynvim
    • python2 pip2 install --user pynvim
  • ruby gem install neovim
  • nodeJS yarn install -g neovim

Tools

Installation

  • git clone https://github.com/Blacksuan19/init.nvim ~/.config/nvim
  • Start nvim and it will do the rest
  • press enter if there are any errors (don't worry its fine)

Plugins

Thanks to vim-plug the plugins are lazy loaded (anything that is not needed for the current buffer is not loaded) for example opening a python file means all other non python related plugins are not loaded.
Coc extensions are lazy loaded as well, they work the same way as vim-plug plugins.

Plugin Functionality vim-airline airline status line airline-themes airline themes devicons icons everywhere rainbow rainbow parenthesis vim-material material themes goyo focus mode coc.nvim async completion and more ale-sensible better ALE experience ale diagnostics, linting and more fzf fuzzy finder fzf.vim fuzzy finder vim integration ultisnips snippets engine vim-snippets snippets for many languages vim-closetag auto html tag closing indentLine auto indent lines vim-searchindex show index of a search string vim-liquid liquid language support vim-commentary better comments everywhere vim-sensible sensible defaults for vim suda add sudo support vim-auto-save auto save on insert mode exit vim-startify cool startup thingy vim-carbon-no-sh cool screen shots powered by carbon now sh vim-fugitive best git integration around vim-sandwich surround stuff with stuff vim-smoothie super smooth scrolling vim-lastplace open a file in the last place cursor was vim-cool better search highlight control tmux-complete tmux panes completion Vista list of tags vim-eunuch some common Linux commands

Keyboard shortcuts

To learn the default vim shortcuts run Tutor and or checkout this site.
Not a lot of changes have been done here, the plugins shortcuts are almost identical, check each plugin under the plugins section for its key mappings, the changes i have made either make a function easier to access and or expose a hidden functionality within a plugin.

Legend

, == leader key
S == Shift key
C == ctrl key

Mapping functionality Replaced Mapping ; commands key : ,r reload nvim config None ,t Trim white spaces(enabled by default with ALE) None ,q close tab :q ,w save changes(tho save when existing insert mode is enabled by default) :q ,f fzf files viewer (shows project files with the ability to search) None ,g Goyo (zen mode) Default ,m opens markdown preview (only in markdown files) None ,e call :PlugInstall (install plugins) None ,v search in vista tags None ,/ search in project folder (calls Ag) None ,rn rename globally None ,l easymotion to the left None ,h easymotion to the right None ,j easymotion to the bottom None ,k easymotion to the top None jj Escape Esc d use a different register for deletion (so the deleted text wont be copied) "_d C-q close all buffers and exit nvim None C-c copy text to system clipboard (only in visual mode) +y C-x cut text to system clipboard (only in visual mode) +d C-l move to the split on the right Default C-k move the split above Default C-j move to the split on below Default C-h Move the split to the left Default C-c highlights character for multi cursor selection (in normal mode) None C-a Highlights word/selection for multi cursor selection None ENTER insert blank line below in normal mode None ENTER inputs selected snippet in insert mode None Tab cycles throw coc in insert mode None Tab switch to the next buffer(tab) Default S-Tab switch to the previous buffer(tab) Default F4 Open vista (tags viewer) none F5 Rotates splits in current view None F6 Startify Default F8 opens selection in carbon now sh (only in visual mode) None [g next diagnostic None ]g Previous diagnostic None

|

Customizations

Since the file is pretty small its very easy to interpret by even those who don't have any knowledge about vim script, most of the sections have comments about their functionality, and can be removed, commented out or swapped easily, there are some defaults that are not everyone's cup of tea (after all this is highly opinionated).

  • Disabling autosave: set let g:auto_save = 0
  • Disabling format on save: set let g:ale_fix_on_save = 0
  • removing words from completion: CocList extensions highlight extension then press Tab to show actions

Most of the included plugins are highly customizable in nature (this is vim), checkout Plugins

Demos

fzf preview Ag preview asciicast asciicast asciicast

Credits

All the Credit goes to the Neovim team for making most of the extensions possible and better (async), and to all the plugins developers, and the hacker who spend time Finding good shortcuts and tricks to make this an even more superb experience.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK