394 lines
11 KiB
VimL
394 lines
11 KiB
VimL
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/
|
|
|
|
" change textwidth for mutt mail program text
|
|
" au BufRead /tmp/mutt-* set tw=72
|
|
|
|
" 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=0
|
|
|
|
augroup END
|
|
|
|
else
|
|
|
|
set autoindent " always set autoindenting on
|
|
|
|
endif " has("autocmd")
|
|
|
|
"Setup vim-plugin
|
|
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'
|
|
|
|
" Writing mode toggle `:Goyo` and `:Limelight`
|
|
Plug 'junegunn/goyo.vim'
|
|
Plug 'junegunn/limelight.vim'
|
|
|
|
"Comments
|
|
"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'
|
|
" Plug 'tpope/vim-commentary'
|
|
Plug 'tpope/vim-surround'
|
|
" https://github.com/tpope/vim-surround
|
|
" cs, ds, yss to change, delete surroundings and operate on a line
|
|
" with a selection in visual mode use S
|
|
|
|
" deoplete is for autocompletion
|
|
" if has('nvim')
|
|
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
|
" else
|
|
" Plug 'Shougo/deoplete.nvim'
|
|
" Plug 'roxma/nvim-yarp'
|
|
" Plug 'roxma/vim-hug-neovim-rpc'
|
|
" endif
|
|
" let g:deoplete#enable_at_startup = 1
|
|
"
|
|
|
|
"Commonly used vim helpers
|
|
" Plug 'ycm-core/YouCompleteMe'
|
|
" Plug 'jedi-vim'
|
|
" Plug 'bling/vim-airline'
|
|
" Plug 'vim-airline/vim-airline-themes'
|
|
"Denite, like emacs 'Helm' app
|
|
" Plug 'Shougo/denite.nvim'
|
|
" Plug 'mg979/vim-visual-multi', {'branch': 'master'}
|
|
|
|
"Search
|
|
" Plug 'ctrlpvim/ctrlp.vim'
|
|
" Plug 'vim-grepper'
|
|
" Plug 'vim-netranger'
|
|
|
|
"Git integration
|
|
" Plug 'tpope/vim-fugitive'
|
|
" Plug 'airblade/vim-gitgutter'
|
|
|
|
"Linting
|
|
" Plug 'neomake/neomake'
|
|
" Plug 'w0rp/ale'
|
|
|
|
"Syntax
|
|
" Plug 'sheerun/vim-polyglot'
|
|
" Plug 'matthewbdaly/vim-filetype-settings'
|
|
" Plug 'rhysd/vim-grammarous' "cmd :GrammarousCheck, req java
|
|
|
|
"todo.txt: https://github.com/freitass/todo.txt-vim
|
|
Plug 'freitass/todo.txt-vim'
|
|
" if localleader is '\' then for todo.txt files:
|
|
" <localleader>s sort
|
|
" <localleader>s+ sort on projects
|
|
" <localleader>j Decrease the priority of the current line
|
|
" <localleader>sd sort on dates
|
|
" <localleader>d set task's date
|
|
" <localleader>x mark task done
|
|
" see ':h todo.txt' for more
|
|
|
|
"External languages, interpreter/repl integration
|
|
" Plug 'kassio/neoterm'
|
|
"
|
|
" Plug 'jpalardy/vim-slime'
|
|
" #:IPython. F5 exec current line or visual selection
|
|
" Plug 'bfredl/nvim-ipy'
|
|
" Plug 'jalvesaq/Nvim-R'
|
|
" Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
|
|
" jupyter independent ipython repl and other languages too
|
|
" Plug 'Vigemus/iron.nvim'
|
|
Plug 'jupyter-vim/jupyter-vim'
|
|
|
|
"latex
|
|
" Plug 'lervag/vimtex'
|
|
" Plug 'vim-pandoc/vim-pandoc'
|
|
|
|
"Markdown
|
|
" Plug 'vimwiki/vimwiki'
|
|
" Plug 'suan/vim-instant-markdown' " Markdown preview instant-markdown-d
|
|
"next one uses a rust lib for fast async md, requires rust/cargo install
|
|
" Plug 'euclio/vim-markdown-composer'
|
|
" Plug 'aaren/notedown'
|
|
"https://github.com/iamcco/markdown-preview.nvim
|
|
"if have nodejs and yarn, this is markdown-it js lib based
|
|
" 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, *.mkd 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', 'sql']
|
|
|
|
|
|
"Tagbar config
|
|
nmap <F8> :TagbarToggle<CR>
|
|
|
|
" from Universal Ctags 0.0.0(a3c87ab5), ctags --list-kinds
|
|
let g:tagbar_type_markdown = {
|
|
\ 'ctagstype' : 'Markdown',
|
|
\ 'kinds' : [
|
|
\ 'c:Heading_L1',
|
|
\ 's:Heading_L2',
|
|
\ 'S:Heading_L3',
|
|
\ 't:Heading_L4',
|
|
\ 'T:Heading_L5',
|
|
\ 'u:Heading_L6'
|
|
\ ]
|
|
\ }
|
|
|
|
let g:tagbar_type_bib = {
|
|
\ 'ctagstype' : 'BibTex',
|
|
\ 'kinds' : [
|
|
\ 'a:Articles',
|
|
\ 'b:Books',
|
|
\ 'B:Booklets',
|
|
\ 'c:Conferences',
|
|
\ 'i:Inbook',
|
|
\ 'I:Incollection',
|
|
\ 'J:Inproceedings',
|
|
\ 'm:Manuals',
|
|
\ 'M:Masterstheses',
|
|
\ 'n:Misc',
|
|
\ 'p:Phdtheses',
|
|
\ 'P:Proceedings',
|
|
\ 't:Techreports',
|
|
\ 'u:Unpublished',
|
|
\ 's:string'
|
|
\ ]
|
|
\ }
|
|
|
|
|
|
"Python repl config
|
|
" let g:loaded_python_provider = 0
|
|
let g:python3_host_prog = '/usr/bin/python3'
|
|
" let g:slime_target = 'tmux'
|
|
" let g:slime_python_ipython = 1
|
|
"
|
|
"use C-c, C-c to send paragraph or selected text
|
|
":SlimeConfig
|
|
" https://github.com/jpalardy/vim-slime
|
|
|
|
" jupyter-vim config
|
|
let g:jupyter_cell_separators = ['##', '#%%', '# %%', '# <codecell>', '```']
|
|
nnoremap <buffer> <silent> <localleader>r :JupyterSendCell<CR>
|
|
" execute lines in visual mode: <localleader>e
|
|
" buffer local var for kernel can be python, ir, javascript, julia, rust
|
|
" b:jupyter_kernel_type =
|
|
"JupyterSendRange
|
|
|
|
":vertical terminal ipython
|
|
"set updatetime=100
|
|
|
|
"split navigations
|
|
" nnoremap <C-J> <C-W><C-J>
|
|
" nnoremap <C-K> <C-W><C-K>
|
|
" nnoremap <C-L> <C-W><C-L>
|
|
" nnoremap <C-H> <C-W><C-H>
|
|
|
|
"nnoremap yr :IronRepl<cr>
|
|
"nmap ,r <Plug>(iron-send-motion)
|
|
"xmap ,r <Plug>(iron-send-motion)
|
|
"nmap yR V,r
|
|
|
|
"R repl config
|
|
"" start R with F2 key
|
|
"" map <F2> <Plug>RStart
|
|
"" imap <F2> <Plug>RStart
|
|
"" vmap <F2> <Plug>RStart
|
|
"" R version can be specified like this:
|
|
"" let vimrplugin_r_path = '/opt/R/3.1.2-release/bin/R'
|
|
"" Send selection or line to R with space bar, respectively.
|
|
" vmap <Space> <Plug>RDSendSelection
|
|
" nmap <Space> <Plug>RDSendLine
|
|
|
|
"Neomake config
|
|
" 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)
|
|
|
|
"General vim config
|
|
set tabstop=8
|
|
set softtabstop=4
|
|
set shiftwidth=4
|
|
set expandtab
|
|
" set number
|
|
" set relativenumber
|
|
" set hlsearch
|
|
" set spell
|
|
|
|
augroup configgroup
|
|
autocmd!
|
|
autocmd FileType html setlocal tabstop=2
|
|
autocmd FileType html setlocal shiftwidth=2
|
|
autocmd FileType html setlocal softtabstop=2
|
|
autocmd FileType css setlocal tabstop=2
|
|
autocmd FileType css setlocal shiftwidth=2
|
|
autocmd FileType css setlocal softtabstop=2
|
|
autocmd FileType javascript setlocal tabstop=2
|
|
autocmd FileType javascript setlocal shiftwidth=2
|
|
autocmd FileType javascript setlocal softtabstop=2
|
|
" autocmd FileType html setlocal commentstring=#\ %s
|
|
autocmd BufEnter *.sh setlocal tabstop=2
|
|
autocmd BufEnter *.sh setlocal shiftwidth=2
|
|
autocmd BufEnter *.sh setlocal softtabstop=2
|
|
augroup END
|
|
|
|
" au BufNewFile,BufRead *.js, *.html, *.css set tabstop=2 softtabstop=2 set shiftwidth=2 expandtab
|
|
|
|
"Mouse/trackpad pointer config
|
|
" set mouse=a "already set by defaults.vim
|
|
set mouse=n
|
|
" OR try set mouse=r mouse=&
|
|
|
|
" Shortcuts for next or prev file like after vim *.py
|
|
" :map v :n<enter>
|
|
" :map V :N<enter>
|
|
" or just use :n or :N followed by the dot . cmd!
|
|
|
|
|
|
"Quick save config
|
|
imap ;s <ESC>:update<enter>
|
|
nmap ;s <ESC>:update<enter>
|
|
" imap jjw <ESC>:update<enter>
|
|
"<CR> vs <enter> and running code
|
|
|
|
"Quick mode exit config
|
|
" Two semicolons are easy to type. The `^ fixes the cursor position.
|
|
imap ;; <ESC>`^
|
|
inoremap <Tab> <Esc>`^
|
|
|
|
" Just press Space to enter insert mode while in normal mode.
|
|
nmap <Space> i
|
|
" On gvim and Linux console Vim, you can also use ctrl-Space.
|
|
" :imap <C-Space> <>
|
|
|
|
"Clipboard config
|
|
" copy with ctrl-c in visual highlight mode
|
|
vmap <C-c> "+y
|
|
"use system clipboard: Now yank y, delete d, or paste p work to/from system
|
|
set clipboard=unnamedplus
|
|
" link yanking and pasting to system clipboard under Wayland
|
|
" from https://github.com/vim/vim/issues/5157
|
|
xnoremap "+y y:call system("wl-copy", @")<cr>
|
|
nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
|
|
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
|
|
|
|
"Auto fix common spelling errors
|
|
:ab teh the
|
|
:ab Teh The
|
|
:ab adn and
|
|
:ab Adn And
|
|
|
|
let mapleader = ','
|
|
|
|
augroup resCur
|
|
autocmd!
|
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
|
augroup END
|
|
|
|
set title
|
|
|
|
" Triger `autoread` when files changes on disk
|
|
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
|
|
" https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode
|
|
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
|
|
\ if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
|
|
|
|
" Notification after file change
|
|
" https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread
|
|
autocmd FileChangedShellPost *
|
|
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
|
|
"
|
|
"latex settings
|
|
" let g:tex_flavor="latex"
|
|
" let g:Tex_DefaultTargetFormat =" pdf"
|
|
" let g:Tex_IgnoredWarnings =''
|
|
|
|
" vim-pandoc settings
|
|
" let g:pandoc#filetypes#handled = ["pandoc", "markdown"]
|
|
" let g:pandoc#filetypes#pandoc_markdown = 0
|
|
" let g:pandoc#completion#bib#mode = "citeproc"
|
|
" let g:pandoc#modules#disabled = ["folding"]
|
|
|
|
" vim-pandoc with deoplete autocomplete for nvim
|
|
" if !exists('g:deoplete#omni#input_patterns')
|
|
" let g:deoplete#omni#input_patterns = {}
|
|
" endif
|
|
" let g:deoplete#omni#input_patterns.pandoc = ['@']
|
|
"
|
|
" vim-pandoc with youcompleteme
|
|
" if !exists('g:ycm_semantic_triggers')
|
|
" let g:ycm_semantic_triggers = {}
|
|
" endif
|
|
" let g:ycm_semantic_triggers.pandoc = ['@']
|
|
" let g:ycm_filetype_blacklist = {}
|
|
|
|
|
|
"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
|
|
|
|
" use <ctrl-x><ctrl-o> with fzf in insert mode to insert project file name
|
|
" inoremap <expr> <c-x><c-o> fzf#vim#complete#path('git ls-files $(git rev-parse --show-toplevel)')
|
|
" Insert mode completion
|
|
imap <c-x><c-k> <plug>(fzf-complete-word)
|
|
imap <c-x><c-f> <plug>(fzf-complete-path)
|
|
imap <c-x><c-j> <plug>(fzf-complete-file)
|
|
|
|
|
|
"Allow commenting and inverting empty lines (useful when commenting a region
|
|
let g:NERDCommentEmptyLines = 1
|
|
"Add spaces after comment delimiters by default
|
|
let g:NERDSpaceDelims = 1
|
|
"Use compact syntax for prettified multi-line comments
|
|
let g:NERDCompactSexyComs = 1
|
|
|
|
" set background=dark
|
|
if filereadable(expand("~/.vimrc_background"))
|
|
let base16colorspace=256
|
|
source ~/.vimrc_background
|
|
endif
|
|
|
|
colorscheme base16-gruvbox-dark-hard
|
|
|
|
"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\ 19
|
|
" 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-atelier-dune
|
|
autocmd VimEnter * Goyo
|
|
autocmd VimEnter * Limelight0.8
|
|
"Switch cursor blink rate to 0msec
|
|
set guicursor+=a:blinkon0
|
|
endif
|
|
|