dotfiles/nvim/.config/nvim/init.vim
Marty Oehme 12beacac19
nvim: Fix 'vim:' modeline, add paragraph highlights
Fixed bug when line in todo dropdown starts with `vim:`, `vi:`, or `:ex`
which would automatically be read by vim and tried to be set in the
editor. Removed modeline reading from vim to fix the bug, and since it
provides quite an attack vector anyway.

Added Limelight to its startup procedure to highlight the current to-do
paragraph.
2020-09-08 14:58:36 +02:00

194 lines
6.7 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'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'justinmk/vim-sneak'
Plug 'RRethy/vim-illuminate'
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'
" ultimately the only thing left here should be a
Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'Shougo/echodoc.vim', {}
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'
Plug 'lervag/wiki.vim'
Plug 'alok/notational-fzf-vim'
" 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 'reedes/vim-pencil', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
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 '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)
" 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
" }}}
" 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 2019 Marty Oehme, all rights reserved.
"
" }}}
" END
" ================================================================================