V2 of my Neovim configuration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Taylor Bockman eb39f01491 Merge branch 'master' of git.xchg.sh:angrygoats/neovim-config 9 months ago
autoload Initial commit. 2 years ago
font Initial commit. 2 years ago
lua/conf Merge branch 'master' of git.xchg.sh:angrygoats/neovim-config 9 months ago
.gitignore Initial commit. 2 years ago
README.md Remove `vim-pyenv` in favor of new LSP/pyright approach. 10 months ago
init.lua Swap LSP to mason and fix a major bug 10 months ago
screenshot.png Screenshot 10 months ago

README.md

Neovim Configuration

screenshot

This is V2 of my Vim configuration, designed for Neovim, broken out into it's own repository for easier cloning without pulling down the entire essentials repository.

I use the nord theme for both my terminal and Vim. You will need to adjust your theme and airline according to your tastes in plugins.lua and ui.lua.

The V2 repo aims to take full advantage of asynchronous code and a modularized configuration to make adaptation easier and the UI snappier. Additionally support for tmux has improved with this iteration through the use of vimux and vim-tmux-navigator.

If you are interested in the vimscript version please refer to the vimscript-final tag.

All future modifications will be done in lua.

Requirements

  1. Neovim
  2. vim-plug - You may need to install this even with the autoload directory.
  3. Monospaced Nerd Font - The /font directory has one I use.
  4. tmux

Updating

After running git pull you may need to run :PlugInstall and restart neovim to resolve any errors.

For Python editing:

  1. Neovim compiled with Python support.
  2. Python
  3. pip install neovim && pip3 install neovim in your global environment.

Structure

  • conf: Contains all configuration related files.
    • plugins.lua: General plugin definitions.
    • keybinds.lua: General keybinds such as leader key, etc.
    • config.lua: Dumping ground for general configurations.
    • ui.lua: General UI configurations.
    • search.lua: Search configurations (for example ctrl-p).
    • git.lua: Fugitive configurations.
    • langs: Language specific configurations and keybinds.

Installation

cd .config
git clone git@git.xchg.sh:angrygoats/vim-config nvim

If you have added/changed plugins remember to :PlugInstall after saving. There currently is no autodetect on a changed plugins.lua.

If you run into problems with pyenv on first start, insure that pyenv is installed and your pyenv has at least one installation available. For example, run pyenv install 3.9.1.

Language Support

Languages supported can be found in the conf/langs directory. To add more languages you can create a file in the same form as those found in conf/langs/ and place it in the conf/langs/ folder. It will be autoloaded.

The current loading script for languages does not check order before loading (so files can be loaded in any order based on directory structure). However, if you followed the structure and put all your configs in the correct files, those will be loaded BEFORE the languages and so you shouldn't run into (too many) order issues. This may be patched in the future.

Python

Support for python can be achieved through :MasonInstall pyright. Additionally, you can install this plugin into pyenv to help.

Generally, you need to create a pyrightconfig.json local to your project pointing at your pyenv. It looks like this:

{
    "venvPath": "$HOME/.pyenv/versions/",
    "venv": "YOUR_PYENV_NAME_HERE"
}

If you install the plugin you can open a terminal in your project directory and run pyenv pyright YOUR_PYENV_NAME_HERE and it will create the file for you. After this, you may need to reload vim and the LSP and autocompletion will work as expected.

The file conf/langs/python.lua contains formatting code typical of a Python project (4 space indents, etc). If you wish to adjust this you can do that here, or make modifications on a per-project basis.

Other Notes

Help

You can type :help <name_of_package> (for example :help vim-pyenv) to read the documentation.

Tmux Navigation

With Tmux activated you can use

<ctrl-h> => Left
<ctrl-j> => Down
<ctrl-k> => Up
<ctrl-l> => Right
<ctrl-\> => Previous split

To move seamlessly between splits.

Autocompletion

Autocomplete is provided by nvim-cmp.

Important commands:

  • <TAB>: Will attempt to autocomplete your current line.
  • <C-Space>: Will provide documentation and other details.

This is, of course, depending entirely on which LSP you have installed.

Default Leader

The default leader is the space key.

Git

vim-fugitive is installed. Bindings can be found in conf/keybinds.lua and documentation can be found here.

The following binds are set to help development:

<Leader>gs :Git<CR>
<Leader>gd :Git diff<CR>
<Leader>gb :Git blame<CR>
<Leader>gc :Git commit<CR>
<Leader>gp :Git push<CR>

Treesitter

Treesitter is installed as a plugin and syntax highlighting can be modified in conf/lang/general.lua. You can add languages you would like there. Alternatively, auto-loading is enabled which should handle most syntax highlighting cases.

LSP

Mason is the manager I use for LSP servers.

You can install LSPs you want to use by running :Mason, or :MasonInstall <lsps, debuggers, linters, formatters, etc> where each thing you want installed is separated by a space.

Org Mode

vim-orgmode is installed. The usage documentation can be found here.

Async Command Line

Asyncrun.vim is installed. You can use this to run shell commands asynchronously. To do this type :AsyncRun <command>.

ctrlp and telescope

It is highly recommended to install ripgrep with your favorite package manager.

are installed.

If you install fd telescope will be more feature complete.

The hotkeys are as follows:

<leader>ff find_files
<leader>fg live_grep
<leader>fb buffers
<leader>fh help_tags

<ctrl>p ctrlp search