Files
dotfiles/.vimrc

252 lines
6.3 KiB
VimL
Raw Normal View History

2019-02-06 17:12:59 -08:00
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
"/usr/share/vim/vim81/defaults.vim, normally sourced in default arch linux vim
source ~/.config/nvim/defaults.vim
"https://wiki.archlinux.org/index.php/Neovim
"ln -s ~/.vimrc ~/.config/nvim/init.vim
"set rtp^=/usr/share/vim/vimfiles/
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
2019-04-03 19:38:20 -07:00
"Setup vim-plugin
2019-02-06 17:12:59 -08:00
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug '/usr/bin/fzf'
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-sensible'
Plug 'chriskempson/base16-vim'
2019-04-03 19:38:20 -07:00
" Writing mode toggle `:Goyo` and `:Limelight`
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
"Comments
2019-02-06 17:12:59 -08:00
"use \cc \cl c<space>, \cm \ci for commenting lines blocks in vis, norm modes
"use ,c<space> to comment out line(s)
Plug 'scrooloose/nerdcommenter'
Plug 'majutsushi/tagbar'
2019-04-03 19:38:20 -07:00
" Plug 'tpope/vim-commentary'
" Plug 'tpope/surround'
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"Commonly used vim helpers
" Plug 'jedi-vim'
" Plug 'bling/vim-airline'
" Plug 'vim-airline/vim-airline-themes'
"Denite, like emacs 'Helm' app
" Plug 'Shougo/denite.nvim'
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"Search
" Plug 'ctrlpvim/ctrlp.vim'
" Plug 'vim-grepper'
" Plug 'vim-netranger'
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"Git integration
" Plug 'tpope/vim-fugitive'
" Plug 'airblade/vim-gitgutter'
"Linting
2019-02-06 17:12:59 -08:00
" Plug 'neomake/neomake'
" Plug 'w0rp/ale'
2019-04-03 19:38:20 -07:00
"Syntax
" Plug 'sheerun/vim-polyglot'
" Plug 'matthewbdaly/vim-filetype-settings'
" Plug 'rhysd/vim-grammarous' "cmd :GrammarousCheck, req java
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"External languages
2019-02-06 17:12:59 -08:00
" Plug 'Vigemus/iron.nvim'
" Plug 'bfredl/nvim-ipy'
" Plug 'jalvesaq/Nvim-R'
2019-04-03 19:38:20 -07:00
" Plug 'python-mode/python-mode', { 'branch': 'develop' }
2019-02-06 17:12:59 -08:00
"latex
2019-04-03 19:38:20 -07:00
" Plug 'lervag/vimtex'
" Plug 'vim-pandoc'
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"Markdown
" Plug 'vimwiki/vimwiki'
" Plug 'suan/vim-instant-markdown' " Markdown preview instant-markdown-d
2019-02-06 17:12:59 -08:00
"next one uses a rust lib for fast async md, requires rust/cargo install
2019-04-03 19:38:20 -07:00
" Plug 'euclio/vim-markdown-composer'
" Plug 'aaren/notedown'
2019-02-06 17:12:59 -08:00
"https://github.com/iamcco/markdown-preview.nvim
2019-04-03 19:38:20 -07:00
"if have nodejs and yarn, this is markdown-it js lib based
2019-02-06 17:12:59 -08:00
" Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
call plug#end()
filetype plugin indent on
"Syntax highlighting in Markdown
"au BufNewFile,BufReadPost *.md set filetype=markdown
"let g:polyglot_disabled = ['markdown']
let g:markdown_fenced_languages = ['html','r', 'javascript', 'python', 'sh', 'bash=sh', 'css', 'js=javascript', 'json=javascript']
2019-04-03 19:38:20 -07:00
"Tagbar config
nmap <F8> :TagbarToggle<CR>
2019-02-06 17:12:59 -08:00
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'kinds' : [
\ 'h:Heading_L1',
\ 'i:Heading_L2',
\ 'k:Heading_L3'
\ ]
\ }
let g:tagbar_type_bib = {
\ 'ctagstype' : 'bib',
\ 'kinds' : [
\ 'a:Articles',
\ 'b:Books',
\ 'L:Booklets',
\ 'c:Conferences',
\ 'B:Inbook',
\ 'C:Incollection',
\ 'P:Inproceedings',
\ 'm:Manuals',
\ 'T:Masterstheses',
\ 'M:Misc',
\ 't:Phdtheses',
\ 'p:Proceedings',
\ 'r:Techreports',
\ 'u:Unpublished',
\ ]
\ }
2019-04-03 19:38:20 -07:00
"Python repl config
2019-02-06 17:12:59 -08:00
let g:python_host_prog = '/usr/bin/python3'
let g:loaded_python3_provider = 1
":vertical terminal ipython
"set updatetime=100
"nnoremap yr :IronRepl<cr>
"nmap ,r <Plug>(iron-send-motion)
"xmap ,r <Plug>(iron-send-motion)
"nmap yR V,r
2019-04-03 19:38:20 -07:00
"Neomake config
2019-02-06 17:12:59 -08:00
" Full config: when writing or reading a buffer, and on changes in insert and
" normal mode (after 1s; no delay when writing).
"call neomake#configure#automake('nrwi', 500)
2019-04-03 19:38:20 -07:00
"General vim config
2019-02-06 17:12:59 -08:00
set tabstop=4
set shiftwidth=4
set expandtab
" set number
" set relativenumber
" set hlsearch
" set spell
2019-04-03 19:38:20 -07:00
"Mouse/trackpad pointer config
2019-02-06 17:12:59 -08:00
" set mouse=a "already set by defaults.vim
set mouse=n
" OR try set mouse=r mouse=&
2019-04-03 19:38:20 -07:00
" Shortcuts for next or prev file like after vim *.py
2019-02-06 17:12:59 -08:00
" :map v :n<enter>
" :map V :N<enter>
" or just use :n or :N followed by the dot . cmd!
2019-04-03 19:38:20 -07:00
"Quick save config
imap ;s <ESC>:update<enter>
2019-02-06 17:12:59 -08:00
imap jjw <ESC>:update<enter>
"<CR> vs <enter> and running code
2019-04-03 19:38:20 -07:00
"Quick mode exit config
2019-02-06 17:12:59 -08:00
" Two semicolons are easy to type. The `^ fixes the cursor position.
2019-04-03 19:38:20 -07:00
imap ;; <ESC>`^
2019-02-06 17:12:59 -08:00
inoremap <Tab> <Esc>`^
2019-04-03 19:38:20 -07:00
" imap jk <ESC>`^
" Just press Space to enter insert mode while in normal mode.
2019-02-06 17:12:59 -08:00
nmap <Space> i
" On gvim and Linux console Vim, you can also use ctrl-Space.
" :imap <C-Space> <>
2019-04-03 19:38:20 -07:00
"Clipboard config
" copy with ctrl-c in visual highlight mode
2019-02-06 17:12:59 -08:00
vmap <C-c> "+y
"use system clipboard: Now yank y, delete d, or paste p work to/from system
set clipboard=unnamedplus
2019-04-03 19:38:20 -07:00
"Auto fix common spelling errors
2019-02-06 17:12:59 -08:00
:ab teh the
:ab Teh The
:ab adn and
:ab Adn And
let mapleader = ','
if filereadable(expand("~/.vimrc_background"))
let base16colorspace=256
source ~/.vimrc_background
endif
augroup resCur
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
set title
2019-04-03 19:38:20 -07:00
"latex settings
" let g:tex_flavor="latex"
" let g:Tex_DefaultTargetFormat =" pdf"
" let g:Tex_IgnoredWarnings =''
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"make vimtex work with neovim
" let g:vimtex_compiler_progname='nvr'
" let g:vimtex_view_use_temp_files=2
" let g:vimtex_view_method='zathura'
" let g:vimtex_quickfix_mode=0 " do not open the quickfix window automatically
2019-02-06 17:12:59 -08:00
2019-04-03 19:38:20 -07:00
"Allow commenting and inverting empty lines (useful when commenting a region
2019-02-06 17:12:59 -08:00
let g:NERDCommentEmptyLines = 1
2019-04-03 19:38:20 -07:00
"Add spaces after comment delimiters by default
2019-02-06 17:12:59 -08:00
let g:NERDSpaceDelims = 1
2019-04-03 19:38:20 -07:00
"Use compact syntax for prettified multi-line comments
2019-02-06 17:12:59 -08:00
let g:NERDCompactSexyComs = 1
2019-04-03 19:38:20 -07:00
"gvim options
" if &t_Co > 2 || has("gui_running")
if has("gui_running")
" Switch on highlighting the last used search pattern.
set hlsearch
" Set font
set gfn=Inconsolata\ 13
" Can toggle gui toolbar with `T` and menu with `m` in guioptions:
" default is go=aegimrLtT
set go=aegLt
":set go+=m or go-=m to toggle menu
colorscheme base16-ocean
autocmd VimEnter * Goyo
autocmd VimEnter * Limelight0.8
"Switch cursor blink rate to 0msec
set guicursor+=a:blinkon0
endif