/BetterNvim

Coding in Neovim elegently

Primary LanguageLua

BetterNvim

GitHub repo size GitHub last commit GitHub top language

📦 Installation

Preview

BetterNvim Dashboard BetterNvim Coding BetterNvim HoverDoc BetterNvim Errors BetterNvim FloatTerm

Introduction

This repo is to setup a modern IDE style coding experience in Neovim. It has been tested both on the latest macOS and Debian GNU/Linux 12(Bookworm).

  • Features:
    • VSCode-like Auto-completion setup
    • Plugin Manager: Lazy.nvim
    • Mason for native Neovim LSP management
    • Tree-sitter for syntax highlighting
    • Plugins: Lspsaga, Barbar, Lualine, Nvim-tree, Nvim-cmp, Todotree, Neogit ...
    • Neovide recommended for much smoother GUI animation

Installation

Prerequisites

  • Neovim >= 0.10.0
  • CMake
  • Make
  • fzf
  • ripgrep
  • fd
  • node
  • python3

Glyphs

To show glyphs properly, please install Nerd Fonts first, and set your terminal to use it

Optional: Backup existing nvim config

mv $HOME/.config/nvim $HOME/.config/nvim.old

Clone the repository

git clone --depth 1 https://github.com/ye-junzhe/BetterNvim.git $HOME/.config/nvim
  • IF ON LINUX
git clone --depth 1 https://github.com/ye-junzhe/BetterNvim.git -b linux $HOME/.config/nvim

Plugins and Lsps and Highlighting

Plugins

Initialization

  • Enter :Lazy, then press U to update all the plugins
  • Enter :MasonUpdate else there won't be any packages showing in the Mason panel
  • Enter TSUpdate to update all Tree-sitter parsers

Lsps

  • :Mason => Install Lsps(g? for help)
  • All configs in this folder
  • special setup for Rust development using rust-tools

Syntax highlighting

  • :TSInstall => Install Tree-sitter highlighting for specific language
  • Configs in treesitter.lua

Keybindings 🎥

Keybindings at keymaps.lua And the rest of are in the corresponding *.lua file of the plugin

<D-> = Command on macOS

The <leader> key has been changed to <space>

Basic

<leader>e => nvim-tree (g? for help)

# Telescope
<leader>ff => File search
<leader>fr => Recent file search
<leader>fw => Word search in current buffer
<leader>fs => Word search in all files
<leader>ft => Todo-Tree

# Lspsaga
gh => Hover doc
gd => Definition(In definition window, o/i => edit)
gf => Find definition and references
<leader>oo => show symbols(silimar to tagbar)
<leader>a => Code actions
<leader>t(open)/tt(close) || ctrl-t => Float Term
<leader>dw => Work space diagnostics
<leader>db => Buf diagnostics

# Barbar
Shift+h => Switch left
Shift+l => Switch right
mp => BufferPick
ctrl-p => BufferPin
ctrl-c => BufferCloseAllButCurrentOrPinned

# Navigation
ctrl + h/j/k/l => navigate windows

# Hop
<leader>j => jump lines
ml => jump words

# Save and quit
W => Save
Q => Quit

# Bookmark
mm => Create and delete
mi => Add annotation
mc => Clear bookmarks
mx => Clear in all buffers
mn => Next bookmark
ma => Show all

# Neogit(Magit clone for Neovim)
<leader>gg => Open Neogit