Skip to content

Latest commit

 

History

History
127 lines (93 loc) · 6.03 KB

README.en.md

File metadata and controls

127 lines (93 loc) · 6.03 KB

Neovim Config

This is MysticalDevil's neovim config, containing some commonly used plugins and custom configs

This config mainly uses lazy.nvim for plugin management

The code editing configuration here mainly targets go, rust, javascript, typescript, lua, with basic nvim-lsp functionality for other languages

Installation

  1. Install neovim: I mainly use Arch, Gentoo, Debian for Linux, please check the official docs for other distros. Neovim version needs to be 0.10.0(nightly) or above, since inlay hints does not work properly before 0.10.0

    # Arch
    sudo pacman -S neovim
    
    # Gentoo
    sudo emerge -vj app-editors/neovim
    
    # Debian
    sudo apt install neovim
    
    # Windows
    scoop install neovim
    
    # macOS
    brew install neovim

    For Debian, it's recommended to build from source, since the latest neovim version in Debian official repo is 0.7.2. Build steps:

    # Install necessary library
    sudo apt install git cmake ninja-build gettext unzip curl
    # Clone neovim repository
    git clone https://github.com/neovim/neovim.git
    # Enter neovim source directory
    cd neovim
    # Build neovim
    make CMAKE_BUILD_TYPE=RelWithDebInfo
    # Package as deb
    cd build && cpack -G DEB
    # Install
    sudo dpkg -i nvim-linux64.deb
  2. Clone this repo:

    git clone https://github.com/MysticalDevil/nvim ~/.config/nvim/
  3. Open neovim to install plugins

    Lazy install

Directory Structure

If using pure lua config for neovim, all config files will be under ./lua. So by default the root here means ./lua/devil to avoid namespace collisions

  • init.lua Entry file for pure lua config
  • ginit.vim Additional config loaded when using GUI frontend, supports neovide and neovim-qt
  • configs/core Core configs, includes basic options, keybindings, plugin list, custom commands, autocmds and core plugin setup for initial launch
  • configs/colorscheme Colorscheme configs, contains various themes, can switch via setup.lua
  • configs/gui GUI related configs like font, animations etc
  • configs/plugin Configs for most plugins, excluding completion, formatting, DAP, LSP
  • plugins Default installed plugins, separated into common(common.lua), colorschemes(colorscheme.lua), git(git.lua) and programming(prog.lua)
  • complete Completion plugins config, using nvim-cmp by default, with coq_nvim as alternative. Snippets provided by LuaSnip, icons by lspkind
  • dap Debug Adapter Protocol configs, powered by nvim-dap
  • format Formatting configs, using none-ls.nvim, conform.nvim, formatter.nvim and efm as alternatives, configurable via setup.lua
  • lint Linting configs, using none-ls.nvim, nvim-lint and efm as alternatives, configurable via setup.lua
  • lsp Language Server Protocol related configs, using mason for dependency management, nvim-lspconfig and mason-lspconfig for LSP setup
  • utils Common utils like global functions, generic configs etc

Usage

Keybindings

Main keybindings are in keybindings.lua and which-key.lua

Some common bindings:

  • <leader> is ,
  • <leader>w + ... Save file and derivatives (like save and quit)
  • <leader>q + ... Quit and derivatives (like force quit)
  • Ctrl-j/k Scroll down/up 5 lines
  • Ctrl-d/u Scroll down/up 10 lines
  • gcc/gcb Quick comment
  • sv Vertical split sh Horizontal split sc Close current so Close others
  • Alt-h/j/k/l Navigate between windows
  • ts New tab th/l/j/k Tab navigate tc Close tab
  • Z Open fold zz Close fold Leader-f Format code
  • Check keybindings config for more

Plugins

Some major plugins used:

Screenshots

Main screen:

main-screen

Code edit:

code-edit

Contributing

Contributions are welcome! Feel free to open PRs to add new plugins or modify existing config.