Add nvim support
This commit is contained in:
parent
7ad25b1983
commit
f3ba0c3ab8
3 changed files with 142 additions and 0 deletions
1
home.nix
1
home.nix
|
|
@ -15,6 +15,7 @@
|
||||||
./programs/fish
|
./programs/fish
|
||||||
./programs/nnn
|
./programs/nnn
|
||||||
./programs/rofi
|
./programs/rofi
|
||||||
|
./programs/nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|
|
||||||
74
programs/nvim/default.nix
Normal file
74
programs/nvim/default.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.neovim.enable = true;
|
||||||
|
programs.neovim.extraConfig = ''
|
||||||
|
${builtins.readFile ./init.vim}
|
||||||
|
'';
|
||||||
|
programs.neovim.plugins = with pkgs.vimPlugins; [
|
||||||
|
{ # Personal Wiki
|
||||||
|
plugin = vimwiki;
|
||||||
|
config = ''
|
||||||
|
let g:vimwiki_list = [{'path': '~/dox/wiki', 'links_space_char': '_',
|
||||||
|
\ 'ext': '.md', 'syntax': 'markdown'}]
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{ # NNN in vim
|
||||||
|
plugin = nnn-vim;
|
||||||
|
config = ''
|
||||||
|
let g:nnn#layout = { 'window': {
|
||||||
|
\ 'width': 0.35,
|
||||||
|
\ 'height': 0.5,
|
||||||
|
\ 'xoffset': 1.0,
|
||||||
|
\ 'highlight': 'Debug' } } " hover window
|
||||||
|
let g:nnn#action = {
|
||||||
|
\ '<c-t>': 'tab split',
|
||||||
|
\ '<c-s>': 'split',
|
||||||
|
\ '<c-v>': 'vsplit' }
|
||||||
|
let g:nnn#command = 'nnn -HoeT v'
|
||||||
|
let g:nnn#replace_netrw = 1
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{ # Fuzzy searches
|
||||||
|
plugin = fzf-vim;
|
||||||
|
config = ''
|
||||||
|
map <C-f> :Files<CR>
|
||||||
|
map <C-a> :Ag<CR>
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{ # Auto completions
|
||||||
|
plugin = coc-nvim;
|
||||||
|
config = ''
|
||||||
|
function! s:check_back_space() abort
|
||||||
|
let col = col('.') - 1
|
||||||
|
return !col || getline('.')[col - 1] =~# '\s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
inoremap <silent><expr> <TAB>
|
||||||
|
\ pumvisible() ? "\<C-n>" :
|
||||||
|
\ <SID>check_back_space() ? "\<TAB>" :
|
||||||
|
\ coc#refresh()
|
||||||
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
vim-commentary # multi-line comments
|
||||||
|
vim-fugitive # Git Plugin
|
||||||
|
vimtex # Latex support
|
||||||
|
tagbar # File tagging
|
||||||
|
|
||||||
|
# === LOOK AND FEEL ===
|
||||||
|
{ # Status Bar
|
||||||
|
plugin = vim-airline;
|
||||||
|
config = ''
|
||||||
|
let g:airline#extensions#tagbar#flags = 'fs'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{ # Rainbow Parenthesis
|
||||||
|
plugin = rainbow;
|
||||||
|
config = ''
|
||||||
|
let g:rainbow_actve = 1
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
vim-polyglot # Syntax Highlighting
|
||||||
|
];
|
||||||
|
}
|
||||||
67
programs/nvim/init.vim
Normal file
67
programs/nvim/init.vim
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
syntax on
|
||||||
|
let mapleader =" "
|
||||||
|
set encoding=utf-8
|
||||||
|
set nocompatible
|
||||||
|
filetype plugin on
|
||||||
|
set list
|
||||||
|
|
||||||
|
set updatetime=300
|
||||||
|
|
||||||
|
" Easy Split Navigation
|
||||||
|
nnoremap <C-J> <C-W><C-J>
|
||||||
|
nnoremap <C-K> <C-W><C-K>
|
||||||
|
nnoremap <C-L> <C-W><C-L>
|
||||||
|
nnoremap <C-H> <C-W><C-H>
|
||||||
|
|
||||||
|
" Indentation
|
||||||
|
set tabstop=2 softtabstop=0 shiftwidth=2 smarttab expandtab
|
||||||
|
|
||||||
|
" Searching
|
||||||
|
set smartcase
|
||||||
|
|
||||||
|
" Backups
|
||||||
|
set noswapfile
|
||||||
|
set nobackup
|
||||||
|
set undodir=~/.config/nvim/undodir
|
||||||
|
set undofile
|
||||||
|
|
||||||
|
" Right column at 80 lines for good coding practice.
|
||||||
|
set colorcolumn=80
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" QoL
|
||||||
|
set showmatch " Show matching Brackets
|
||||||
|
set number relativenumber " Side numbers
|
||||||
|
|
||||||
|
" Fuzzy finding by allowing searching into subfolders
|
||||||
|
set path+=**
|
||||||
|
set wildmenu
|
||||||
|
" use :find to find, and * to make it fuzzy.
|
||||||
|
" Also make use of :b.
|
||||||
|
|
||||||
|
" Delete trailing white space and newlines at end of file on save.
|
||||||
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
|
autocmd BufWritePre * %s/\n\+\%$//e
|
||||||
|
|
||||||
|
" Easy copy and pasting to external programs
|
||||||
|
map <C-y> "+yy
|
||||||
|
map <C-p> "+P
|
||||||
|
|
||||||
|
autocmd BufRead,BufNewFile *.md call WritingMode()
|
||||||
|
autocmd BufRead,BufNewFile *.tex call WritingMode()
|
||||||
|
autocmd BufRead,BufNewFile *.svx call WritingMode()
|
||||||
|
|
||||||
|
autocmd BufRead,BufNewFile *.py call PythonMode()
|
||||||
|
|
||||||
|
function! WritingMode()
|
||||||
|
setlocal textwidth=80
|
||||||
|
setlocal wrap linebreak nolist
|
||||||
|
setlocal whichwrap+=<,>,h,l
|
||||||
|
nnoremap j gj
|
||||||
|
nnoremap k gk
|
||||||
|
setlocal spell spelllang=en_us
|
||||||
|
endfunction
|
||||||
|
function! PythonMode()
|
||||||
|
setlocal foldmethod=indent
|
||||||
|
setlocal foldlevel=99
|
||||||
|
endfunction
|
||||||
Loading…
Add table
Add a link
Reference in a new issue