Migrate remaining neovim config to nix

This commit is contained in:
Donovan Glover 2023-05-11 16:29:37 -04:00
parent a47c056439
commit 7f4eac5446
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
4 changed files with 60 additions and 218 deletions

View File

@ -4,12 +4,24 @@
programs.neovim = {
enable = true;
extraConfig = ''
filetype plugin indent on
set undofile
set spell
set number
set clipboard=unnamedplus
set fileencoding=utf-8 " Ensure that we always save files as utf-8
set fileencodings=utf-8,sjis " Automatically open shiftjis files with their proper encoding
set spelllang=en_us,cjk " Don't show errors for CJK characters
set noshowmode " Disable the --MODE-- text (enable if not using the status line)
set mouse=a
set ignorecase " By default use case-insensitive search (combine with smartcase)
set smartcase " Make search case-sensitive when using capital letters
set scrolloff=1 " The minimal number of rows to show when scrolling up/down
set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right
set tabstop=4 " Show a tab character as 4 spaces
set softtabstop=0 " Edit soft tabs as if they're regular spaces
set shiftwidth=4 " Make autoindent appear as 4 spaces
autocmd VimLeave * set guicursor=a:block-blinkon1
map <MiddleMouse> <Nop>
imap <MiddleMouse> <Nop>
@ -19,6 +31,27 @@
imap <3-MiddleMouse> <Nop>
map <4-MiddleMouse> <Nop>
imap <4-MiddleMouse> <Nop>
highlight Search ctermbg=240 ctermfg=255
highlight IncSearch ctermbg=255 ctermfg=240
let mapleader = ' '
nnoremap <silent> <leader>e :set nu!<CR>
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
nnoremap <silent> <leader>a :Vexplore<CR>
nnoremap <silent> <leader>s :Sexplore<CR>
nnoremap <silent> <leader>d :Explore<CR>
nnoremap <silent> <leader>f :Files<CR>
nnoremap <silent> <leader>g :set hlsearch!<CR>
nnoremap <silent> <leader>j :Buffers<CR>
nnoremap <silent> <leader>k :NERDTreeToggleVCS<CR>
nnoremap <silent> <leader>l :Rg<CR>
nnoremap <silent> <leader>; <C-w>w
vnoremap <C-s> y:silent !notify-send -t 4000 "" "$(tango '<C-r>0')"<CR>:<Esc>
autocmd BufNewFile,BufRead *.ecr setlocal syntax=html
autocmd BufWritePre,FileWritePre * silent! call mkdir(expand('<afile>:p:h'), 'p')
'';
plugins = with pkgs.vimPlugins; [
{
@ -59,11 +92,6 @@
plugin = nvim-web-devicons;
type = "lua";
}
{
plugin = autoclose-nvim;
type = "lua";
config = ''require("autoclose").setup()'';
}
{
plugin = nvim-scrollbar;
type = "lua";
@ -112,6 +140,32 @@
plugin = clipboard-image-nvim;
type = "lua";
}
{
plugin = vimtex;
config = ''
" Disable all keybinds so we can define our own
let g:vimtex_mappings_enabled = 0
let g:vimtex_imaps_enabled = 0
let g:vimtex_view_method = 'zathura'
let g:vimtex_compiler_latexmk = {'build_dir': '.tex'}
" Set the normal keybinds
nnoremap <localleader>f <plug>(vimtex-view)
nnoremap <localleader>g <plug>(vimtex-compile)
nnoremap <localleader>d <plug>(vimtex-env-delete)
nnoremap <localleader>c <plug>(vimtex-env-change)
'';
}
vim-caddyfile
vim-graphql
vim-pug
vim-prisma
vim-javascript
vim-jsx-pretty
vim-vue
vim-over
vim-endwise
rust-vim
];
};
editorconfig = {

View File

View File

@ -1,178 +0,0 @@
let g:ale_disable_lsp = 1
autocmd FileType javascript let g:ale_linters = {
\ 'javascript': glob('.eslintrc*', '.;') != '' ? [ 'eslint', 'flow' ] : [ 'standard', 'flow' ],
\}
call plug#begin('~/.vim/plugged')
Plug 'dense-analysis/ale' " Syntax checker
Plug 'lunarWatcher/auto-pairs' " {Pair} completion
Plug 'tpope/vim-endwise' " 'End' completion
Plug 'reedes/vim-pencil' " Word wrap
Plug 'junegunn/goyo.vim' " Distraction-free writing
Plug 'jparise/vim-graphql' " GraphQL support
Plug 'osyo-manga/vim-over'
Plug 'maksimr/vim-jsbeautify'
Plug 'pangloss/vim-javascript'
Plug 'rhysd/vim-crystal'
Plug 'rust-lang/rust.vim'
Plug 'baskerville/vim-sxhkdrc'
Plug 'dag/vim-fish'
Plug 'slim-template/vim-slim'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'plasticboy/vim-markdown'
Plug 'posva/vim-vue'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'digitaltoad/vim-pug'
Plug 'leafgarland/typescript-vim'
Plug 'lervag/vimtex'
Plug 'pantharshit00/vim-prisma'
Plug 'wuelnerdotexe/vim-astro'
Plug 'isobit/vim-caddyfile'
Plug 'preservim/nerdcommenter'
call plug#end()
" ============================
" ========= settings =========
" ============================
filetype plugin indent on " Attempt to determine the file type of extensionless files
syntax enable " Turn syntax highlighting on
set nocompatible " Use vim defaults (i.e. ignore vi compatibility)
set backspace=indent,eol,start " Make the backspace key function as you would expect
set encoding=utf-8 " Always show files as utf-8
set fileencoding=utf-8 " Ensure that we always save files as utf-8
set fileencodings=utf-8,sjis " Automatically open shiftjis files with their proper encoding
set autoindent " Automatically indent new lines
set ignorecase " By default use case-insensitive search (combine with smartcase)
set smartcase " Make search case-sensitive when using capital letters
set showcmd " Always show the current keybinding being executed
set spell " Enable spell check by default
set spelllang=en_us,cjk " Don't show errors for CJK characters
set hidden " Switch between buffers without saving them
set incsearch " Automatically move to text as you search for it
set wildmenu " Show a menu of the different options when you tab in command mode
set display+=lastline " Show as much of a long line as possible
set laststatus=2 " Enable the status line (set to 0 to remove)
set noshowmode " Disable the --MODE-- text (enable if not using the status line)
set history=100 " Only keep the last 100 commands
set tabpagemax=50 " Set the maximum number of tabs to be opened in any window to 50
set viminfo^=! " Use viminfo to store workspace and other data automatically
set sessionoptions-=options " When you explicitly save a workspace, save the entire environment
set t_Co=256 " Tell vim that we want to use 256 colors
set scrolloff=1 " The minimal number of rows to show when scrolling up/down
set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right
set undofile " Keep track of undos even after you close a file
set undodir=~/.vim/undo " Save the undo history here (not that the directory must exist)
set undolevels=1000 " We can undo this many times
set undoreload=10000 " The maximum number of lines to keep in the undo file
set tabstop=4 " Show a tab character as 4 spaces
set softtabstop=0 " Edit soft tabs as if they're regular spaces
set shiftwidth=4 " Make autoindent appear as 4 spaces
set expandtab " When using <Tab>, replace the tab character with 4 spaces
set smarttab " Always indent based on column number to align things easier
set mouse=a " Enable mouse support in (a)ll modes
set number " Show numbers by default
" ==========================
" ========= colors =========
" ==========================
" Don't show the separator for vertical splits
highlight vertsplit ctermfg=0 ctermbg=none
" Finally, an easier way to read search results
highlight Search ctermbg=240 ctermfg=255
highlight IncSearch ctermbg=255 ctermfg=240
" Easily show lines that go past the character count
" highlight OverLength ctermbg=240 ctermfg=230
" call matchadd('OverLength', '\%80v')
autocmd BufNewFile,BufRead *.ecr setlocal syntax=html
autocmd BufNewFile,BufRead *.slang setlocal filetype=slim
" ============================
" ========= keybinds =========
" ============================
" Use space as the global leader
let mapleader = ' '
" Top row
nnoremap <silent> <leader>e :set nu!<CR>
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
" Middle row
nnoremap <silent> <leader>a :Vexplore<CR>
nnoremap <silent> <leader>s :Sexplore<CR>
nnoremap <silent> <leader>d :Explore<CR>
nnoremap <silent> <leader>f :Files<CR>
nnoremap <silent> <leader>g :set hlsearch!<CR>
nnoremap <silent> <leader>j :Buffers<CR>
nnoremap <silent> <leader>k :NERDTreeToggleVCS<CR>
nnoremap <silent> <leader>l :Rg<CR>
nnoremap <silent> <leader>; <C-w>w
" Bottom row
autocmd FileType javascript nnoremap <silent> <leader>b :call JsBeautify()<CR>
autocmd FileType json nnoremap <silent> <leader>b :call JsonBeautify()<CR>
autocmd FileType jsx nnoremap <silent> <leader>b :call JsxBeautify()<CR>
autocmd FileType html nnoremap <silent> <leader>b :call HtmlBeautify()<CR>
autocmd FileType css nnoremap <silent> <leader>b :call CSSBeautify()<CR>
" Experimental yomichan-like command with tango
vnoremap <C-s> y:silent !notify-send -t 4000 "成果" "$(tango '<C-r>0')"<CR>:<Esc>
" Easily enter 'zen mode' with Goyo and Pencil (Note: Goyo resets the color scheme)
nnoremap <silent> <leader>2 :PencilSoft<CR>:Goyo<CR>:hi vertsplit ctermfg=0 ctermbg=none<CR>
" Save and load vim sessions
nnoremap <silent> <leader>3 :mksession! ~/.vim/.session<CR>
nnoremap <silent> <leader>4 :source ~/.vim/.session<CR>
" Never worry about a directory not being created before saving
autocmd BufWritePre,FileWritePre * silent! call mkdir(expand('<afile>:p:h'), 'p')
" ==========================
" ========= vimtex =========
" ==========================
" Disable all keybinds so we can define our own
let g:vimtex_mappings_enabled = 0
let g:vimtex_imaps_enabled = 0
let g:vimtex_view_method = 'zathura'
let g:vimtex_compiler_latexmk = {'build_dir': '.tex'}
" Set the normal keybinds
nnoremap <localleader>f <plug>(vimtex-view)
nnoremap <localleader>g <plug>(vimtex-compile)
nnoremap <localleader>d <plug>(vimtex-env-delete)
nnoremap <localleader>c <plug>(vimtex-env-change)
" ================================
" ========= vim-markdown =========
" ================================
" Disable vim-markdown folding
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_math = 1
let g:vim_markdown_frontmatter = 1
autocmd BufNewFile,BufRead *.md set conceallevel=2
" Ignore syntax concealing for markdown files
let g:vim_markdown_conceal = 0
let g:tex_conceal = ""
let g:vim_markdown_math = 1

View File

@ -1,34 +0,0 @@
# vim
[vim][vim] is the standard text editor.
## Use Cases
vim can be used to:
- Edit source files efficiently
You should not use vim if:
- You should use vim.
## Dependencies
- [pywal][pywal] - Changing color schemes support
- [fzf][fzf] - Fuzzy search support
- [ripgrep][ripgrep] - Jump between lines in files
- [git][git] - Git diff support
- [texlive][texlive] - TeX support
## Usage
The first time you start vim, my plugins will be automatically installed with [vim-plug][vim-plug] (unless you already have the wal plugin, in which case you'd need to run `:PlugInstall` manually).
[vim-plug]: https://github.com/junegunn/vim-plug
[vim]: https://github.com/vim/vim
[neovim]: https://github.com/neovim/neovim
[pywal]: https://github.com/dylanaraps/pywal
[fzf]: https://github.com/junegunn/fzf
[ripgrep]: https://github.com/BurntSushi/ripgrep
[git]: https://github.com/git/git
[texlive]: https://github.com/TeX-Live/texlive-source