GithubHelp home page GithubHelp logo

blacksuan19 / init.nvim Goto Github PK

View Code? Open in Web Editor NEW
418.0 16.0 53.0 1.3 MB

An Opinionated Neovim Config for the Minimalists

Home Page: https://www.blacksuan19.dev/projects/init-nvim/

Vim Snippet 0.66% Vim Script 99.34%
neovim coc asynchronous liquid prettier vimrc nvim nvim-settings fzf vim-script

init.nvim's Introduction

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
  • Various IDE features via coc.nvim
  • Smooth Scrolling (its really smooth!)
  • Fully integrated with fzf (see demos)
  • Live Markdown preview
  • Simple, Intuitive shortcuts

Supported Languages

Neovim provides support for a wide range of languages by default. For more languages install vim-polyglot.

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

  • python3: pip3 install --user pynvim
  • javascript: yarn global add neovim

Tools

Installation

After installing the requirements:

  • 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
devicons icons everywhere
rainbow rainbow parenthesis
vim-material material themes
coc.nvim async completion and more
fzf.vim fuzzy finder vim integration
vim-snippets snippets for many languages
indentLine auto indent lines
vim-commentary better comments everywhere
vim-startify cool startup thingy
vim-fugitive best git integration around
vim-sandwich surround stuff with stuff
vim-smoothie super smooth scrolling
tmux-navigator seamless movement between Vim and tmux panes
tmux-complete tmux panes completion
vim-eunuch some common Linux commands
semshi better highlighting for python
markdown-preview live markdown preview
vim-MvVis move visual selection

Keyboard shortcuts

To learn the default Vim shortcuts run Tutor and or checkout this vim adventures.

Essentials

Mapping functionality
; commands key
, leader key
leader + r reload nvim config
leader + w save changes
leader + e call :PlugInstall (install plug-ins)
Enter enter empty line in normal mode
F2 trim white spaces
F6 open Startify

Visual Mode Essentials

Mapping functionality
ctrl + j move selected text to bottom
ctrl + k move selected text to top
ctrl + h move selected text to the left
ctrl + l move selected text to the right

Navigation

ctrl + hjkl navigation also supports tmux panes.

Mapping functionality
leader + q close tab
ctrl + q close all buffers and exit
ctrl + l move to the split on the right
ctrl + k move the split above
ctrl + j move to the split on below
ctrl + h move the split to the left
Tab switch to the next buffer(normal mode)
S-Tab switch to the previous buffer

IDE Features

Mapping functionality
leader + o organize imports
leader + a run cocAction on what's undercursor
leader + s format file with available formatter
leader + rn rename globally
leader + jd jump to definition
leader + jy jump to type definition
leader + ji jump to implementation
leader + jr jump to references
ctrl + a highlight for multi cursor selection
shift + k show current symbol documentation
]g next diagnostic
[g Previous diagnostic

Flutter

Mapping functionality
F3 show list of devices
F4 show list of emulators
F5 start development server (flutter run)

FZF windows

Mapping functionality
leader + f files viewer
leader + c show editor commands
leader + / search in current folder files
leader + sh search / history
leader + b show open buffers
leader + t search current file tags
F1 show keyboard shortcuts for current mode

In FZF

these only work on an open fzf window

Mapping Functionality
C-x open file in horizontal split
C-v open file in vertical split
C-t open file in new tab

Git

Mapping functionality
leader + gd git diff split
leader + gc git commits
leader + gb git blame
leader + gs git status in fzf window

Custom commands

Command Functionality
Format format file with any available formatter
OR organize imports
Rg advanced Grep

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 Plugins: comment out the plug's 'Plugin/name' line from config and also remove the plugin settings

  • Disabling CoC Plugins: comment out the plugin from coc_global_extensions variable and uninstall it via :CocUninstall plugin name

  • Installing CoC plugins: open :CocList and search for marketplace, you can find all available plugins here

  • Adding Bookmarks: to add bookmarks to the start page, find g:startify_bookmarks in init.nvim and add the new bookmark just like the already present ones, the dictionary key is the shortcut you will use to quickly jump to that folder from the start page and the value is the path to targeted folder

for more customizations read throw the config file, there are comments everywhere and its easy to interpret, you can also checkout the linked github page for each plugin for even more options.

Demos

Project files with fzf

fzf preview

Project wide search with fzf

Rg preview

Git Status

git status

workflow demo

Workflow Demo

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 hackers who spend time Finding good shortcuts and tricks to make this an even more superb experience.

init.nvim's People

Contributors

asterix24 avatar blacksuan19 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

init.nvim's Issues

why disable netrw?

Love this setting but I get an empty screen when e.g. nvim ..
Just wanna know any specific reason to disable netrw?
let loaded_netrw = 0

image

Closing a file with :q <Shift>zz closes the all tab and exits NVIM

Hi, I am newbie to vim/nvim. I across your init.vim file and was following it to put my init.vim file. I noticed that after put in your Airline plugin configurations in the if I open two files using :e ~/XXX it opens the files in different tabs which I find great but

  1. I cannot use the "gt" or "gT" to cycle between the tabs
  2. Also when try to a single using :q or :wq or ZZ it closes all tabs and exits nvim
    Could you help understand the issue. Is it some configurations I need to do or am I missing something in general

Migrating to init.lua and Telescope, Native LSP

You have one of the best init.vim I have come across for a learner like me for python setup. I have used you setup in my nvim. Most logical keymaps and setup
Would be migrating this to init.lua with Telescope , nvim native LSP. Have heard it to be fast. I shall look forward to it

Can't see tabs

Hi, I can't see my tabs of vim, but when i do :tabs i get this output
Screenshot 2021-08-17 at 7 33 26 PM

Also I cannot use standard gt gt to rotate through tabs

E117: Unknown function: SemshiBufWipeout

I keep getting this error whenever I use shortcuts from the startify menu. Or when I use [ps] Plugin Status, [pu] Update vim plugins, [uc] Update coc plugins and close the respective buffer that error appears. Note that I can still use nvim after pressing enter to dismiss the error, but it's quite annoying.

Error:

Error detected while processing BufWipeout Autocommands for "*":
E117: Unknown function: SemshiBufWipeout
Press ENTER or type command to continue

2022-08-22_14-14

2022-08-22_14-14_1
(here I was closing the coc update buffer)

Really slow startup times

I removed all previous configs and did a clean install on this. Here's the output of: nvim --startuptime vim.log and cat vim.log:

`times in msec
clock self+sourced self: sourced script
clock elapsed: other lines

000.007 000.007: --- NVIM STARTING ---
000.284 000.277: locale set
000.589 000.304: inits 1
000.599 000.010: window checked
000.601 000.002: parsing arguments
002.617 002.016: init lua interpreter
002.743 000.126: expanding arguments
002.768 000.025: inits 2
003.158 000.390: init highlight
003.159 000.002: waiting for UI
003.931 000.771: done waiting for UI
003.943 000.012: init screen for UI
003.955 000.012: init default mappings
003.975 000.020: init default autocommands
004.269 000.033 000.033: sourcing /usr/share/nvim/runtime/ftplugin.vim
004.300 000.016 000.016: sourcing /usr/share/nvim/runtime/indent.vim
004.327 000.007 000.007: sourcing /usr/share/nvim/archlinux.vim
004.329 000.019 000.012: sourcing /etc/xdg/nvim/sysinit.vim
005.375 000.791 000.791: sourcing /home/sudokit/.config/nvim/autoload/plug.vim
008.255 000.040 000.040: sourcing /usr/share/nvim/runtime/filetype.lua
012.074 000.007 000.007: sourcing /home/sudokit/.config/nvim/plugged/vim-fugitive/ftdetect/fugitive.vim
012.132 000.019 000.019: sourcing /home/sudokit/.config/nvim/plugged/cypher.vim/ftdetect/cypher.vim
012.186 000.006 000.006: sourcing /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim
012.200 000.006 000.006: sourcing /usr/share/vim/vimfiles/ftdetect/augeas.vim
012.229 000.022 000.022: sourcing /usr/share/vim/vimfiles/ftdetect/gnfiletype.vim
012.247 000.012 000.012: sourcing /usr/share/vim/vimfiles/ftdetect/meson.vim
012.372 004.106 004.034: sourcing /usr/share/nvim/runtime/filetype.vim
012.440 000.006 000.006: sourcing /usr/share/nvim/runtime/ftplugin.vim
012.496 000.005 000.005: sourcing /usr/share/nvim/runtime/indent.vim
012.620 000.045 000.045: sourcing /usr/share/nvim/runtime/syntax/synload.vim
012.662 000.146 000.101: sourcing /usr/share/nvim/runtime/syntax/syntax.vim
015.921 002.994 002.994: sourcing /home/sudokit/.config/nvim/plugged/tokyonight.nvim/colors/tokyonight-night.lua
423.544 000.478 000.478: sourcing /home/sudokit/.config/nvim/statusline.vim
423.553 419.214 410.648: sourcing /home/sudokit/.config/nvim/init.vim
423.557 000.300: sourcing vimrc file(s)
425.520 001.752 001.752: sourcing /home/sudokit/.config/nvim/plugged/vim-devicons/plugin/webdevicons.vim
425.610 000.030 000.030: sourcing /home/sudokit/.config/nvim/plugged/rainbow/plugin/rainbow_main.vim
425.761 000.082 000.082: sourcing /home/sudokit/.config/nvim/plugged/vim-MvVis/plugin/MvVis.vim
426.035 000.097 000.097: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/autoload/coc/rpc.vim
426.371 000.283 000.283: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/autoload/coc/util.vim
426.698 000.164 000.164: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/autoload/coc/client.vim
428.530 000.362 000.362: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/autoload/coc/highlight.vim
429.151 000.499 000.499: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/autoload/coc/color.vim
435.061 009.254 007.849: sourcing /home/sudokit/.config/nvim/plugged/coc.nvim/plugin/coc.vim
435.901 000.751 000.751: sourcing /home/sudokit/.config/nvim/plugged/fzf/plugin/fzf.vim
436.909 000.923 000.923: sourcing /home/sudokit/.config/nvim/plugged/fzf.vim/plugin/fzf.vim
437.031 000.043 000.043: sourcing /home/sudokit/.config/nvim/plugged/vim-snippets/plugin/vimsnippets.vim
437.462 000.353 000.353: sourcing /home/sudokit/.config/nvim/plugged/semshi/plugin/semshi.vim
437.726 000.182 000.182: sourcing /home/sudokit/.config/nvim/plugged/vim-commentary/plugin/commentary.vim
437.927 000.127 000.127: sourcing /home/sudokit/.config/nvim/plugged/vim-startify/plugin/startify.vim
439.415 001.414 001.414: sourcing /home/sudokit/.config/nvim/plugged/vim-fugitive/plugin/fugitive.vim
440.285 000.782 000.782: sourcing /home/sudokit/.config/nvim/plugged/vim-smoothie/plugin/smoothie.vim
440.455 000.088 000.088: sourcing /home/sudokit/.config/nvim/plugged/tmux-complete.vim/plugin/tmuxcomplete.vim
441.183 000.639 000.639: sourcing /home/sudokit/.config/nvim/plugged/vim-eunuch/plugin/eunuch.vim
441.824 000.411 000.411: sourcing /home/sudokit/.config/nvim/plugged/vim-sandwich/plugin/operator/sandwich.vim
442.251 000.404 000.404: sourcing /home/sudokit/.config/nvim/plugged/vim-sandwich/plugin/sandwich.vim
442.453 000.183 000.183: sourcing /home/sudokit/.config/nvim/plugged/vim-sandwich/plugin/textobj/sandwich.vim
442.603 000.073 000.073: sourcing /home/sudokit/.config/nvim/plugged/vim-tmux-navigator/plugin/tmux_navigator.vim
442.872 000.203 000.203: sourcing /home/sudokit/.config/nvim/plugged/markdown-preview.nvim/plugin/mkdp.vim
443.406 000.219 000.219: sourcing /usr/share/nvim/runtime/plugin/gzip.vim
443.436 000.011 000.011: sourcing /usr/share/nvim/runtime/plugin/health.vim
443.537 000.086 000.086: sourcing /usr/share/nvim/runtime/plugin/man.vim
444.278 000.292 000.292: sourcing /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
444.388 000.835 000.544: sourcing /usr/share/nvim/runtime/plugin/matchit.vim
444.568 000.164 000.164: sourcing /usr/share/nvim/runtime/plugin/matchparen.vim
444.610 000.020 000.020: sourcing /usr/share/nvim/runtime/plugin/netrwPlugin.vim
444.781 000.012 000.012: sourcing /home/sudokit/.local/share/nvim/rplugin.vim
444.791 000.166 000.155: sourcing /usr/share/nvim/runtime/plugin/rplugin.vim
444.930 000.124 000.124: sourcing /usr/share/nvim/runtime/plugin/shada.vim
444.970 000.024 000.024: sourcing /usr/share/nvim/runtime/plugin/spellfile.vim
445.152 000.167 000.167: sourcing /usr/share/nvim/runtime/plugin/tarPlugin.vim
445.268 000.099 000.099: sourcing /usr/share/nvim/runtime/plugin/tohtml.vim
445.303 000.019 000.019: sourcing /usr/share/nvim/runtime/plugin/tutor.vim
445.532 000.214 000.214: sourcing /usr/share/nvim/runtime/plugin/zipPlugin.vim
445.648 000.019 000.019: sourcing /usr/share/vim/vimfiles/plugin/fzf.vim
445.781 000.115 000.115: sourcing /usr/share/vim/vimfiles/plugin/redact_pass.vim
446.715 003.180: loading rtp plugins
446.894 000.179: loading packages
448.004 000.476 000.476: sourcing /home/sudokit/.config/nvim/plugged/indentLine/after/plugin/indentLine.vim
448.083 000.713: loading after plugins
448.099 000.016: inits 3
448.373 000.274: reading ShaDa
449.006 000.633: opening buffers
449.061 000.055: BufEnter autocommands
449.063 000.002: editing files in windows
449.799 000.649 000.649: sourcing /home/sudokit/.config/nvim/plugged/vim-startify/autoload/startify.vim
865.216 410.551 410.551: sourcing /usr/share/nvim/runtime/autoload/provider/clipboard.vim
867.466 000.180 000.180: sourcing /home/sudokit/.config/nvim/plugged/vim-startify/syntax/startify.vim
868.082 000.158 000.158: sourcing /home/sudokit/.config/nvim/plugged/rainbow/autoload/rainbow_main.vim
868.355 000.092 000.092: sourcing /home/sudokit/.config/nvim/plugged/rainbow/autoload/rainbow.vim
871.970 011.277: VimEnter autocommands
871.975 000.005: UIEnter autocommands
871.979 000.004: before starting main loop
875.610 003.630: first screen update
875.613 000.004: --- NVIM STARTED ---`

Discussion on removing ale

Great setup, am a big fan of the config choice.

Based on the readme, 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!. Is there a need for ale at all considering coc.nvim could do the exact same. Do you think ale has some advantage over coc.nvim?

Can use bat command --line-range option instead of head

Saw your floating window thing on reddit. Nice work. I've used your init.nvim to customize some stuff for myself :)

I saw this line:

let l:fzf_files_options = '--preview "bat --theme="OneHalfDark" --style=numbers,changes --color always {2..-1} | head -'.&lines.'"'

You can also use --line-range option of bat command to achieve the same thing. Just something I wanted to share.

It should then look like this:

let l:fzf_files_options = '--preview "bat --line-range :'.&lines.' --theme="OneHalfDark" --style=numbers,changes --color always {2..-1}"'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.