Skip to content

Hdoc1509/nvim-config

Repository files navigation

Neovim configuration

This repository hosts my Neovim configuration that I'm using for Linux and Windows.

Features

Requirements

Installation

Before cloning

  1. Backup your current configuration
  2. Remove your ~/.config/nvim folder

Once you installed this configuration you will be able to integrate your older configuration. You can see it in Customization section

Cloning

Clone repository in neovim config path:

git clone --depth 1 https://github.com/Hdoc1509/nvim-config.git ~/.config/nvim

Or start a new repo with tiged:

tiged Hdoc1509/nvim-config ~/.config/nvim

IF YOU ARE A WINDOWS USER, set the environment variable XDG_CONFIG_HOME with cmd:

setx XDG_CONFIG_HOME %USERPROFILE%\.config

Install plugins

  1. To suppress git messages about detached HEAD, run:

    git config --global advice.detachedHead false
  2. To install plugins, run:

    nvim --headless +'Lazy! restore' +quit
  3. Due to headless mode, some tree-sitter parsers can not be successfully installed. All you need to do is open Neovim.

Mappings

Used mapleader is space key.

Mapping Mode Description
<F1> Normal Toggle nvim-tree with focus in current file
<F2> Normal Toggle nvim-tree
<leader>w Normal Save file
<leader>W Normal Save all files
<leader>q Normal Save and close file
<leader>Q Normal Save all files and close Neovim
<leader>tq Normal Close current tab
<leader>to Normal Close all other tabs
<leader>th Normal Move tab to left
<leader>tH Normal Move tab to first position
<leader>tl Normal Move tab to right
<leader>tL Normal Move tab to last position
<leader>tj Normal Go to previous tab
<leader>tJ Normal Go to first tab
<leader>tk Normal Go to next tab
<leader>tK Normal Go to last tab
<leader>[ Normal Jump to tag under cursor in a split
<leader>] Normal Jump to tag under cursor in a new tab
<leader>j Normal / Visual Scroll down 10 lines
<leader>J Normal / Visual Scroll down 20 lines
<leader>k Normal / Visual Scroll up 10 lines
<leader>K Normal / Visual Scroll up 20 lines
<leader>sb Normal Toggle scrollbind in windows of current tab
<leader>> Normal Resize current split 10 pixels to left
<leader>< Normal Resize current split 10 pixels to right
<leader>chh Normal Run :checkhealth
<c-h> Normal Jump to left split
<c-j> Normal Jump to bottom split
<c-k> Normal Jump to top split
<c-l> Normal Jump to right split
<leader>H Normal Move window to previous tab
<leader>L Normal Move window to next tab
<leader>gaa Normal Execute git add --all
<leader>gd Normal Execute git diff
<leader>gp Normal Execute git push
<leader>gl Normal Execute git pull
<leader>gs Normal Execute git status
<leader>gc Normal Execute git commit
<c-u> Normal / Insert Toggle Uppercase of word under cursor
<c-t> Normal / Insert Toggle Title Case of word under cursor
<c-d> Normal / Insert Remove current line
<leader>ya Normal Copy all text of current file to clipboard
<leader>e Normal Search files with fzf
]t Normal Jump to next TODO comment
[t Normal Jump to previous TODO comment
<leader>/ Normal Clear search highlighting
<leader>rr Normal Run HTTP request under the cursor
<leader>rl Normal Re-run the last HTTP request
vh Command Open help window in vertical split
th Command Open help window in new tab
<leader>mo Normal (*) Start Markdwon preview
<leader>mc Normal (*) Stop Markdown preview
<leader>mt Normal Toggle Markdown renderer
<leader>f Normal Format current file
<leader>F Normal Format and save current file
H Normal Preview folded lines
<leader>o Normal [N] Add blanklines below current line
<leader>O Normal [N] Add blanklines above current line
]c Normal Jump to next hunk
[c Normal Jump to previous hunk
<leader>hs Normal Stage hunk
<leader>hs Visual Stage selected hunk(s)
<leader>hr Normal Reset hunk
<leader>hr Visual Reset selected hunk(s)
<leader>hS Normal Stage buffer
<leader>hu Normal Unstage hunk
<leader>hR Normal Reset buffer
<leader>hp Normal Preview hunk
<c-a> Insert Insert supermaven suggestion
<c-j> Insert Accept supermaven word suggestion
<c-q> Insert Clear/Cancel supermaven suggestion
- Normal Open mini.files explorer in current file
_ Normal Open mini.files explorer
<F3> Insert / Normal Toggle spell checking
<F5> Normal Reload (re-edit) file
<leader>r Visual Replace selected text in current file
<leader>R Visual Replace selected text in all files
<leader>z Normal Toggle Zen Mode
<leader>fs Normal Enable Fullscreen. Only for nvim-qt
<leader>Fs Normal Disable Fullscreen. Only for nvim-qt
<F11> Normal Toggle Fullscreen. Only for neovide

(*): Mappings that show a notify window.

[N]: Mappings that can receive a count.

Markdown mappings

The following mappings just run on *.md files:

Mapping Mode Description
<leader>sat Visual Line Create a table from shell aliases definitions and run FormatWrite

Git integration

This configuration provides a minimal configuration file for integration with git.

To use it, run the following command:

git config --global core.editor "nvim -u ~/.config/nvim/minimal.lua"

Customization

If you want to integrate your older configuration or want to extend this configuration, follow next indications:

If you want to integrate more LSP servers, see the list of all available LSP servers. Once you have all software requirements for desired LSP server, you need to:

Troubleshooting

Fail to install treesitter parser

If you are a Windows user and have problems to install treesitter parser, install zig and retry to install.

Fail to use rest.nvim

If you are a Windows user and have problems to use rest.nvim because of curl --compressed option, you need to prepend the path of the curl binary that comes bundled with git-for-windows to your system PATH.

Run the following commands with powershell as admin:

  • Git 64-bit version:

    $GIT_PATH = "C:\Program Files\Git\mingw64\bin"
  • Git 32-bit version:

    $GIT_PATH = "C:\Program Files (x86)\Git\mingw64\bin"
  • Finally, run:

    [Environment]::SetEnvironmentVariable(
      "Path",
      "$GIT_PATH;" + [Environment]::GetEnvironmentVariable("PATH", "MACHINE"),
      "MACHINE"
    )

Fail to use with astro files

If you have problems to use astro files, follow instructions in:

My dotfiles

My dotfiles