diff --git a/.config/nvim/profiles b/.config/nvim/profiles new file mode 100644 index 0000000..344255f --- /dev/null +++ b/.config/nvim/profiles @@ -0,0 +1,144 @@ +" vim: set foldmethod=marker foldlevel=1 nomodeline: +" ================================================================================ +" .init.vim / .vimrc of Marty Oehme {{{ +" ================================================================================ +" +" - stolen from many different sources including +" Steve Losh +" Junegunn Choi +" Tim Pope + +" this config does not set nocompatible - neovim does this automatically +" this config does not set filetype plugin - vim-sensible does this +" }}} +" 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 academia.vim | q +endif + +" automatically install any missing plugins +autocmd VimEnter * + \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | q + \| endif +" +" set truecolor (neovim) +set termguicolors + +" 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 + +" 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 + +" highlight everything that goes over 80 columns +highlight ColorColumn ctermbg=magenta +call matchadd('ColorColumn', '\%81v', 100) + +" set our leader key to space since with hjkl, space is largely useless +let mapleader = "\" +" maps the leader for buffer local mappings (e.g. vim-waikiki for files under +" the root dir to the same key -- might lead to incompatibilities, will have +" to test) +let maplocalleader = "\" +" set jk to escape, in case capslock is not mapped to escape on the system +inoremap jk + +" remove search highlights by pressing space+/ - the key for searching the +" first place +nnoremap / :noh + +" quickly edit vimrc with leader+V +nnoremap V :vsp academia.vim +" automatically source the vimrc file whenever it is saved (causes slowdown +" when done in MANY successions) +" au BufWritePost init.vim so ~/.config/nvim/init.vim +" source vimrc with keystroke combination +nnoremap VV :source academia.vim + + +" 'open new buffer' with leader-t (opens new buffer and switches to it) +" open actual new tab with leader-T +nnoremap t :vsp . +nnoremap T :tabedit . + +" stronger versions of left,right - move all the way +nnoremap H ^ +nnoremap L $ + +" }}} +" CUSTOMIZATION {{{ + +" defines plugin directory +" Install plugins from vim with :PlugInstall +silent! if plug#begin('~/.local/share/nvim/plugged') +Plug 'christoomey/vim-tmux-navigator' +" automatically switch between relative and absolute numbers as buffers move +" into / out of focus (requires number & relativenumber to be set) +Plug 'jeffkreeftmeijer/vim-numbertoggle' +Plug 'rakr/vim-one' + +" CUSTOM STUFF BEGINS HERE +Plug 'Shougo/unite.vim' +Plug 'rafaqz/citation.vim' + + +call plug#end() +endif + +call unite#filters#matcher_default#use(['matcher_fuzzy']) +let g:unite_source_grep_command = "rg" + +" Custom mappings for the unite buffer +autocmd FileType unite call s:unite_settings() +function! s:unite_settings() + " Enable navigation with control-j and control-k in insert mode + imap (unite_select_next_line) + imap (unite_select_previous_line) + " control s to split into new buf + imap unite#do_action('split') + " simple esc to exit when in insert mode + imap (unite_exit) +endfunction + +" citation.vim bibtex citations +let g:citation_vim_bibtex_file="academia.bib" +let g:citation_vim_mode="bibtex" +let g:citation_vim_cache_path='~/.cache/' +" insert a citation under cursor (using bibref) +nnoremap c :Unite -buffer-name=citation-start-insert -default-action=append citation/key + +" }}} +colo one