dotfiles/nixos/dotfiles/neovim.nix

170 lines
5.5 KiB
Nix

#
# Neovim home-manager configuration.
#
# vim: et:ts=2:sw=2:
#
{ ... }:
{
imports = [
./neovim-lsp.nix
./neovim-ide.nix
./neovim-line.nix
];
home-manager.users.deprekated =
{ pkgs, ... }:
{
# Squish our whole neovim config into Nix, for some reason.
programs.neovim = {
enable = true;
# Make standard tools prefer neovim.
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
# Install the plugins we use via Nix.
plugins = with pkgs.vimPlugins; [
ctrlp-vim
editorconfig-nvim
lualine-nvim
nerdcommenter
nerdtree
nvim-fzf
rainbow
surround-nvim
vim-devicons
vim-easy-align
vim-eunuch
vim-solarized8
telescope-nvim
# CoC plugins
coc-diagnostic
coc-clangd
coc-rust-analyzer
coc-pyright
coc-tsserver
coc-spell-checker
coc-explorer
coc-json
coc-java
];
# Requirements for our vim.
extraPackages = with pkgs.tree-sitter-grammars; [
pkgs.tree-sitter
tree-sitter-bash
tree-sitter-c
tree-sitter-cmake
tree-sitter-cpp
tree-sitter-css
tree-sitter-go
tree-sitter-javascript
tree-sitter-json
tree-sitter-lua
tree-sitter-nix
tree-sitter-python
tree-sitter-rust
tree-sitter-typescript
tree-sitter-vim
];
extraConfig = ''
scriptencoding utf-8
syntax on
filetype plugin indent on
let mapleader=","
""" Options
set number " Show line numbers.
set modeline " Allow vim commands in text file comments.
set undofile " Persistent undo tree.
set incsearch " Incremental search.
set tabstop=4 " Number of visual spaces to be displayed per HT.
set expandtab " Expand tabs to spaces by default.
set shiftwidth=0 " Use tabstop value for indenting.
set lazyredraw " Only redraw when we need to.
set scrolloff=2 " Keep 2 lines between the end of the buffer and the cursor.
set sidescrolloff=2 " Keep 2 characters between the current column and the screen edge.
set mouse=n " Enable the mouse in normal mode.
set colorcolumn=120
set wildmenu " Tab-complete command menu.
set wildmode=longest:full,full " Most bash-like way.
set wildignorecase " Ignore case when completing.
set splitright " Make :vsplit put the new window on the right.
set splitbelow " Make :split put the new window on the bottom.
set foldlevel=5 " Don't fold almost anything by default.
set hidden " Allow for hidden, modified but not written buffers.
set bufhidden=hide " Hide buffers instead of deleting or unloading them.
set ignorecase
set smartcase
set gdefault
set cindent " A good basis/default for many languages, though this is usually overridden by the filetype plugin.
set cinoptions=l1,j1 " Indent case blocks correct, and indent Java anonymous classes correctly.
" Autowrap comments using textwidth, inserting the comment leader,
" and remove the comment leader when joining lines when it makes sense.
set formatoptions=cj
" Don't display . on folds.
set fillchars=fold:\
set diffopt=algorithm:patience
set fsync " Syncs the filesystem after :write.
set nowrap
set updatetime=1000 "Lets languageservers update faster, and shortens the time for CursorHold.
set noshowmode " We're using lualine, so showing the mode in the command line is redundant.
" Have the visual-selection indent commands re-highlight the last visual selection after indenting.
vnoremap > >gv
vnoremap < <gv
" Don't use backtick for anything, as it's our wezterm leader key and this leads
" to typos.
map ` <Nop>
" Leader Q should banish the current window.
map <leader>q :only<cr> \| :q<cr>
" Leader W should save and then banish the current window.
map <leader>q :only<cr> \| :wq<cr>
" Fold augroups, functions, Lua, and Python
let g:vimsyn_folding = 'aflP'
" Support embedded Lua and Python.
let g:vimsyn_embed = 'lP'
" Highlight whitespace errors.
let g:c_space_errors = 1
let g:python_space_error_highlight = 1
let g:python_highlight_builtins = 1
let g:python_highlight_builtin_funcs = 1
let g:python_highlight_builtin_types = 1
let g:python_highlight_exceptions = 1
let g:python_highlight_string_formatting = 1
let g:python_highlight_string_format = 1
let g:python_highlight_indent_errors = 1
let g:python_highlight_space_errors = 1
let g:python_highlight_class_vars = 1
let g:xsh_highlight_all = v:true
let g:NERDCustomDelimiters = { 'dosini': { 'left': '#' }, 'xonsh': { 'left': '#' } }
" Use truecolor.
set termguicolors
" Make Solaried8 a biiiit darker.
set background=dark
colorscheme solarized8
highlight Normal guibg=#001E27
highlight LineNR ctermfg=11 guibg=#0B262D
'';
};
};
}