Skip to content

400 Software Development


nvim

VIM Commands

See all modules (g, opt, cmd, api ...):

:lua print(vim.inspect(vim))

Changing vim global variables:

vim.g.mapleader = " "

Changing vim options:

vim.o.tabstop = true
vim.opt.tabstop = true

See :help options for a list of options

Execute a vim command:

vim.cmd("colorscheme gruvbox")

Accessing the vim api:

vim.api.nvim_set_hl(0, "Normal", { bg = "none"})

:help api-global

Changing keymaps:

vim.keymap.set("i", "jk", "<Esc>")

Mappings to learn:

<C-d> and <C-u>     | down and up on screen 
<leader>y           | yank to clipboard 
<leader>u           | undo tree toggle
<leader>fh          | grep the help files
<leader>gg          | fugitive git toggle (go-git)

<leader>q           | quit window

<M-w>               | autopairs wrap

<C-q>               | add telescope search to quickfix

<C-s>               | save

<leader>a           | add file to harpoon list (add)
<C-e>               | open harpoon files ()
<C-htn>             | quick jump to file

<leader>c           | open config for lua

LSP bindings
<C-f>               | scroll in lsp docs
<C-d>               | scroll in lsp docs
<C-y>               | confirm autocomplete
<C-space>           | autocomplete
K                   | open hover inofrmation
gd                  | go to definition
<leader>vrr         | view references
<leader>vrn         | view rename
<leader>vca         | view code action

<leader>vd          | view diagnostic
[d                  | move to the previous diagnostic 
]d                  | move to the next diagnostic

<C-h>               | help with signature completion

Learn LUA: https://github.com/nanotee/nvim-lua-guide

:help lua-guide
[Neovim Spaghetti - LSP Servers, Linters, Formatters, and Treesitter – roobert](https://roobert.github.io/2022/12/03/Extending-Neovim/)

How to setup lsp in neovim. In this tutorial we will learn how to… | by Rishav Raj | Medium