1 Star 0 Fork 0

FLDPMpnag / Neovim_config

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

FLDPM_Neovim

Forked by ayamir . A colemakuser dotfiles

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Structure
  4. Plugins
  5. Keybindings
  6. Issues
  7. Credit
  8. TODO

Introduction

Dashboard

Telescope

Coding

Gitui

This is my neovim's configuration.

I use packer.nvim to manage plugins.

I use nvim-lspconfig and nvim-cmp to realize code complete.

Chinese introduction is here.

Pros:

  • Fast. Less than 50ms to start(Depends on SSD, tested on Sumsung 970 evo).
  • Simple. Run out of the box.
  • Modern. Pure lua to config.
  • Modular. Easy to customize.
  • Powerful. Full functionality to code.

startup_with_light

startup_with_dark

(Tested with rhysd/vim-startuptime)

Prerequisites

  1. Neovim base installation for archlinux
# gitui required by tui git operations
# ripgrep required by telescope word search engine
# ripgrep required by telescope-zoxide
# sqlite required by telescope-frecency
# fd required by telescope file search engine
# yarn required by markdown preview
# nerd-fonts-ibm-plex-mono required by devicons
sudo pacman -S git gitui zoxide ripgrep sqlite fd yarn nerd-fonts-ibm-plex-mono

# nodejs, neovim-git required by copilot.
# neovim version >= 0.6
yay -S nodejs neovim-git

# for neovim python module
pip install neovim --user

# clone
git clone https://github.com/ayamir/nvimdots ~/.config/nvim
  1. Recommended Terminals:

    alacritty, kitty, wezterm

sudo pacman -S alacritty kitty wezterm
  1. Recommended GUI applications:

    neovide, goneovim

paru neovide
paru goneovim
  1. Tools for plugins
  • For nvim-lsp-installer, you need to install corresponding language server use it.

  • For nvim-treesitter, all maintained parser will be installed by default.

  • For format.nvim, you need to install corresponding formatter manually:

# clangformat for c/cpp etc
sudo pacman -S clang
# gofmt and goimports for golang
go get -u golang.org/x/tools/...
# luafmt for lua
npm install -g lua-fmt
# yapf and autopep8 for python
pip install autopep8 yapf --user
# rustfmt
sudo pacman -S rustup
# on the stable toolchain
rustup component add rustfmt
# on the nightly toolchain
rustup component add rustfmt --toolchain nightly
# prettier for markdown/html etc
sudo pacman -S prettier
# jq for json
sudo pacman -S jq
# shfmt for shell
sudo pacman -S shfmt

Structure

init.lua is the kernel config file. It requires configuration in lua directory.

  • lua directory contains 3 parts.

    • core directory contains base configuration of neovim.

    • keymap directory contains keybindings of plugins.

    • modules directory contains 5 parts.

      • completion directory contains code completion's configuration.

      • editor directory contains plugins' configuration about editing.

      • lang directory contains plugins' configuration about specific language.

      • tools directory contains telescope and its extensions' configuration.

      • ui directory contains plugins' configuration about ui.

How to customize

  • Add plugin

    1. Determine this plugin belongs to what kind(completion, editor, lang, tools, ui).

    2. Add a list item in corresponding plugins.lua.

      For example, I want to add rmagatti/auto-session to editor category.

      Then I need to modify lua/modules/editor/plugins.lua:

      add_plugin

      (You should learn how to use packer.nvim install and configure plugin on your own)

      I also need to modify lua/modules/editor/config.lua:

      add_config

      Then press <leader>ps:

      packer_sync

      Then try its command: SaveSession

      sync_success1

      Then restart nvim and execute RestoreSession.

      sync_success2

      So this plugin is added successfully!

  • Remove plugin

    1. Determine this plugin belongs to what kind(completion, editor, lang, tools, ui).

    2. Remove its config located in corresponding plugins.lua and config.lua.

    3. Remove corresponding keymap if exists.

    4. Press <leader>ps to recompile.

  • Modify keymap

    • For vanilla nvim's keymap

      modify lua/core/mapping.lua

    • For specific plugin's keymap

      modify lua/keymap/init.lua

  • Modify event defined by autocmd

    modify lua/core/event.lua

  • Modify vanilla nvim's options

    modify lua/core/options.lua

  • Switch light/dark theme

# To light
    sed -i "s/\=dark/\=light/g" ~/.config/nvim/lua/modules/ui/config.lua
    sed -i "s/onedark/onelight/g" ~/.config/nvim/lua/modules/ui/config.lua
# To Dark
    sed -i "s/\=light/\=dark/g" ~/.config/nvim/lua/modules/ui/config.lua
    sed -i "s/onelight/onedark/g" ~/.config/nvim/lua/modules/ui/config.lua

You need to execute PackerSync or just press <leader>ps to compile the latest config if you modify the any config in lua directory.

Don't worry if you meet any error for your new config.

The old compiled file called bak_compiled.lua is located in $HOME/.local/share/nvim/site/lua directory.

If you just want to restore to old config:

cd $HOME/.local/share/nvim/site/lua
cp ./bak_compiled.lua ./_compiled.lua

Then you can figure out what modification makes error.

Plugins

UI

Name Effect
sainnhe/edge My light/dark theme
kyazdani42/nvim-web-devicons For nvim-tree's icons
hoob3rt/lualine.nvim Minimal, fast but customizable line
glepnir/dashboard-nvim Dashboard for Neovim
kyazdani42/nvim-tree.lua Replacement of Nerdtree
lewis6991/gitsigns.nvim Show git status in nvim
lukas-reineke/indent-blankline.nvim Show indent with different level
akinsho/bufferline.nvim Tab and buffer management
folke/zen-mode.nvim Focus on code only
folke/twilight.nvim Highlight current block and dim others

Tools

Name Effect
nvim-lua/popup.nvim Required by telescope.nvim
nvim-lua/plenary.nvim Required by telescope.nvim
tami5/sql.nvim Required by telescope-frecency.nvim
nvim-telescope/telescope.nvim Find, Filter, Preview, Pick
nvim-telescope/telescope-fzy-native.nvim Fzy search for telescope
nvim-telescope/telescope-project.nvim Manage projects with telescope
nvim-telescope/telescope-frecency.nvim Frequent and recent file cache
thinca/vim-quickrun Run code quickly
michaelb/sniprun Run code snippet quickly
folke/trouble.nvim Show code troubles etc
folke/which-key.nvim Help you learn keybindings
dstein64/vim-startuptime Profiling starup time quickly
gelguy/wilder.nvim More useful wild menu

Editor

Name Effect
itchyny/vim-cursorword Highlight cursor word
junegunn/vim-easy-align Easy alignment
terrortylor/nvim-comment Comment code quickly
simrat39/symbols-outline.nvim Display code structure
nvim-treesitter/nvim-treesitter Super powerful code highlighter
nvim-treesitter/nvim-treesitter-textobjects Select text objects quickly
romgrk/nvim-treesitter-context Show current context
p00f/nvim-ts-rainbow Rainbow brackets
JoosepAlviste/nvim-ts-context-commentstring Comment base on context
SmiteshP/nvim-gps Show current context in lualine
andymass/vim-matchup Better matchup for %
jdhao/better-escape.vim Replace esc with jk
lukas-reineke/format.nvim Format code asynchronously
windwp/nvim-ts-autotag Faster vim-closetag
norcalli/nvim-colorizer.lua Display detected color
rhysd/accelerated-jk Accelerated j/k
hrsh7th/vim-eft Enhanced f/t
phaazon/hop.nvim easymotion's replacement
karb94/neoscroll.nvim smooth scroll
vimlab/split-term Utilites around neovim's :terminal
akinsho/nvim-toggleterm.lua Toggled terminal
numtostr/FTerm.nvim Float terminal

Completion

Name Effect
neovim/nvim-lspconfig Neovim native LSP configuration
williamboman/nvim-lsp-installer Manage each LSP engine
ray-x/lsp_signature.nvim Show signature when completing function parameters
hrsh7th/nvim-cmp Auto completion plugin for nvim
hrsh7th/cmp-buffer buffer source for nvim-cmp
hrsh7th/cmp-path path source for nvim-cmp
tzachar/cmp-tabnine tabnine source for nvim-cmp
hrsh7th/cmp-nvim-lua lua source for nvim-cmp
hrsh7th/cmp-nvim-lsp lsp source for nvim-cmp
f3fora/cmp-spell spell source for nvim-cmp
andersevenrud/compe-tmux tmux source for nvim-cmp
saadparwaiz1/cmp_luasnip luasnip source for nvim-cmp
L3MON4D3/LuaSnip snippets completion engine for nvim-cmp
rafamadriz/friendly-snippets snippets source for LusSnip
windwp/nvim-autopairs Completion pairs
github/copilot Copilot neovim port

Lang

Name Effect
fatih/vim-go Most powerful plugin for go
rust-lang/rust.vim Plugin for rust
simrat39/rust-tools.nvim Plugin for rust
kristijanhusak/orgmode.nvim Org mode in nvim
iamcco/markdown-preview.nvim Markdown-preview out of box

Keybindings

The leader key is ,.

Effect shortcut
sync config and compile <leader>ps
install plugins <leader>pi
update plugins <leader>pu
clean plugins <leader>pc
toggle nvim-tree <C-n>
toggle tagbar <A-t>
open horizontal terminal <C-w>t or <F5>
toggle vertical terminal <C-\>
quit terminal <C-d>
toggle floating terminal <A-d>
force quit floating terminal <A-S-d>
open gitui in current directory <leader>g
pick buffer n(nmeans No) <A-n>
right buffer <A-j>
left buffer <A-k>
move current buffer to right <A-S-k>
move current buffer to left <A-S-k>
close current buffer <A-q>
force close current buffer <A-S-q>
split buffer vertically <C-w>v
split buffer horizontally <C-w>s
navigate down <C-j>
navigate up <C-k>
navigate left <C-h>
navigate right <C-l>
operaions in nvim-tree
new file a
remove file/directory d
rename file/directory r
open directory o/Enter
close directory o/Backspace
copy filename y
copy relative path Y
copy absolute path gy
toggle file/directory begin with dot H
toggle hidden file/directory configured in nvim-tree I
find file in recently opened <leader>fr
find file in history <leader>fe
find file in current work directory <leader>ff
find directory recorded by zoxide <leader>fz
find project <leader>fp
add project <leader>fpthen<C-A>
delete project <leader>fpthen<C-D>
find one word <leader>w
find one character <leader>c
find two characters <leader>cc
jump to one line <leader>j/<leader>k
escape insert mode jk
neoformat <C-A-l>
back to last cursor's place <C-O>
preview definition gd
jump to definition gD
smart rename gr
toggle last diagnostics gt
toggle lsp references gR
show signature help gs
show current function/variable's definition or references gh
show hover doc K
show code action <leader>ca
toggle lsp document diagnostics <leader>cd
toggle lsp workspace diagnostics <leader>cw
toggle code quickfix <leader>cq
toggle code loclist <leader>cl
next snippet's block <C-l>
prev snippet's block <C-h>
select current () block vab
select current {} block vaB
select current outer function block vaf
select current outer class block vac
select current inner function block vif
select current inner class block vic
move to next function begin ][
move to prev function begin [[
move to next function end ]]
move to prev function end []
toggle one line's comment gcc
toggle selected lines' comment <S-V>, select area then gc
toggle MarkdownPreView <F12>
Save current session <leader>ss
Restore last session <leader>sr
Delete last session <leader>sd
Debug mode only supports golang&python now
Debug continue(run) <leader>dr/F6
Debug run last <leader>drl
Debug run to cursor <leader>drc
Debug toggle breakpoint <leader>db
Debug set breakpoint with condition <leader>dB
Debug list breakpoint <leader>dbl
Debug open repl <leader>dl
Debug step over <leader>dv/F9
Debug step into <leader>di/F10
Debug step out <leader>do/F11
Debug disconnect <leader>dd
Git management
Prev hunk [g
Next hunk ]g
Stage hunk <leader>hs(n and v mode)
Reset hunk <leader>hr(n and v mode)
Undo stage hunk <leader>hu
Reset buffer <leader>hR
Preview hunk <leader>hp
Blame hunk <leader>hb

You can see more keybinds in lua/core/mapping.lua and lua/keymap/init.lua.

Issues

  1. Clipboard for WSL2 users

Please refer to it and add win32yank.exe to your path.

Then uncomment this line.

  1. Wrong configuration may invoke the dialog asking for deleting all plugins

Input n and <CR>

  1. LSP servers don't autostart.

Please check this to make sure your directory can be detected as a working directory.

For example (gopls):

Your root directory need a go.mod and your .go file need to be created first. Then LSP will autostart when you edit .go file next time.

  1. Copilot setup

Make sure your github account is signed up for copilot.

Then use Copilot setup command to setup.

Credit

TODO

  • More documentation for how to customize.
  • Backup old compiled configuration when error occurs.

About

my neovim editor config files expand collapse
Vim script and 2 more languages
MIT
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
1
https://gitee.com/fldpmpang/Neovim_config.git
git@gitee.com:fldpmpang/Neovim_config.git
fldpmpang
Neovim_config
Neovim_config
main

Search