dotfiles/nvim/.config/nvim/init.vim

227 lines
10 KiB
VimL

" vim: set foldmethod=marker foldlevel=0 nomodeline:
" ================================================================================
" .init.vim / .vimrc of Marty Oehme {{{
" ================================================================================
"
" - stolen from many different sources including
" Steve Losh
" Junegunn Choi
" Tim Pope
" }}}
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
" ================================================================================
"
" automatically install vim-plug if it does not exist
" Note: this installs it in the neovim folder, not the vim folder
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | q
endif
" automatically install any missing plugins
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
" defines plugin directory
" Install plugins from vim with :PlugInstall
silent! if plug#begin('~/.local/share/nvim/plugged')
" base
Plug 'christoomey/vim-tmux-navigator' " allow seamless navigation between vim buffers and tmux splits
Plug 'jeffkreeftmeijer/vim-numbertoggle' " toggles numbers to absolute for all buffers but the current which is relative
Plug 'justinmk/vim-sneak' " jump between letters with improved fFtT quicksearch
Plug 'RRethy/vim-illuminate' " highlight other occurences of the word under cursor
" filedrawer
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs
" editing
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc
Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add)
Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch
Plug 'jiangmiao/auto-pairs' " Auto close brackets and ''
Plug 'junegunn/vim-easy-align' " Align tables and other alignable things
Plug 'junegunn/vim-peekaboo' " Show the contents of regiseters on pasting from '', @, <C-R>
" Fuzzy matching
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
Plug 'neovim/nvim-lspconfig' " some commong language server configurations
Plug 'nvim-lua/completion-nvim' " simple completion engine built specifically for nvim and lsp
Plug 'steelsojka/completion-buffers' " completion source from words found in current buffers
Plug 'desmap/ale-sensible' | Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
" statusline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'edkolev/tmuxline.vim'
" Colorschemes
Plug 'chriskempson/base16-vim'
Plug 'reedes/vim-colors-pencil'
" RMarkdown & LaTeX workflow
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'vim-pandoc/vim-pandoc'
" Notes and Wiki
Plug 'dyng/ctrlsf.vim' " search-and-edit of many wiki files at once
Plug 'lervag/wiki.vim' " foundational wiki system, allowing links between plaintext files
Plug 'alok/notational-fzf-vim' " quickly search through the wiki
" Prose Workflow
Plug 'micarmst/vim-spellsync' " personal dict improvements for git sync
Plug 'ron89/thesaurus_query.vim' " find thesaurus backed synonyms for word under cursor
Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
" and allows you to jump to the *end* of this <g)> or last <g(> sentence.
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
" Language Integration
Plug 'tjdevries/nlua.nvim' " lua lsp integration
Plug 'euclidianAce/BetterLua.vim' " better syntax highlighting for lua
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
Plug 'stephpy/vim-yaml'
Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'}
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'aliou/bats.vim'
if !has('nvim')
Plug 'tpope/vim-sensible'
endif
" Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] } ->
" instructions: http://liuchengxu.org/vim-which-key/, needs setup tp become
" useful. TODO enable when setup is more settled down
call plug#end()
endif
" }}}
" VIM SETTINGS {{{
" ================================================================================
"
" set truecolor (neovim)
set termguicolors
" load colorscheme from dynamic file
" first one is here to make airline behave correctly without reload
runtime colorscheme.vim
" this one is here to override anything set by default in colorscheme plugin
" loading
autocmd VimEnter * runtime colorscheme.vim
" sets tabs to be 2 characters, expanded into spaces, but still removable with
" one press of backspace.
" great explanation: http://vimcasts.org/transcripts/2/en/
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" set cursor line highlighting, esp useful when using with bracket
" highlighting and you don't know which side of the brace the cursor is on
set cursorline
" shows linenumbers relative to the one you are on, for easy movement and
" dNUMBERd deletions
set number relativenumber
" keeps an undofile next to files so that you can even undo if vim is closed
" in between
set undofile
" ignores case by default but will use case when search is specifically not
" all lowercased
set ignorecase
set smartcase
" shows previews of what substitute command will do (and a couple others)
set inccommand=split
" whenever vim loses focus, save
au FocusLost * :wa
" disables showing us the current mode in the command line since airline takes
" care of it
set noshowmode
" turn off modeline, to ensure security observation
set nomodeline
" i feel foldlevel 2 is generally pretty usable, for headlines and similar
set foldlevel=2
" highlight everything that goes over 80 columns
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" pump all clippings into the system clipboard
set clipboard+=unnamedplus
" Special setting for editing gopass files - make sure nothing leaks outside
" the directories it is supposed to
au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile nowritebackup viminfo=
au BufNewFile,BufRead /dev/shm/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
au BufNewFile,BufRead $TMPDIR/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
au BufNewFile,BufRead /tmp/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
" from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/init.vim
if has('nvim-0.4')
" make completion menu slightly transparent
set pumblend=17
set wildmode=longest:full
" Makes floating PopUpMenu for completing stuff on the command line.
" Very similar to completing in insert mode.
set wildoptions+=pum
else
set wildmode=longest,list,full
" Vim Galore recommended mappings
" Make next and previous use smart history
cnoremap <C-N> <Up>
cnoremap <C-P> <Down>
end
" turn of automatic resizing of individual splits
set noequalalways
" make sure there's always *some* context below cursor
set scrolloff=5
" in .tex files, default to latex over plaintext/context as syntax
let g:tex_flavor = "latex"
" }}}
" KEYBINDINGS {{{
" ================================================================================
"
" Begin mapping definitions
runtime! **/maps.vim
" }}}
" ABBREVIATIONS {{{
" Typos
iabbrev adn and
iabbrev waht what
iabbrev tehn then
iabbrev whit with
iabbrev whith with
iabbrev grwoth growth
iabbrev teh the
iabbrev projcets projects
" Text expansion
iabbrev mo@ marty.oehme@gmail.com
iabbrev mo.me@ <https://martyoeh.me/>
iabbrev mcc@ Copyright 2020 Marty Oehme, all rights reserved.
"
" }}}
" END
" ================================================================================