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, \cm \ci for commenting lines blocks in vis, norm modes "use ,c 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: " s sort " s+ sort on projects " j Decrease the priority of the current line " sd sort on dates " d set task's date " 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 :TagbarToggle " 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 = ['##', '#%%', '# %%', '# ', '```'] nnoremap r :JupyterSendCell " execute lines in visual mode: e " buffer local var for kernel can be python, ir, javascript, julia, rust " :JupyterConnect " b:jupyter_kernel_type = "JupyterSendRange ":vertical terminal ipython "set updatetime=100 "split navigations " nnoremap " nnoremap " nnoremap " nnoremap "nnoremap yr :IronRepl "nmap ,r (iron-send-motion) "xmap ,r (iron-send-motion) "nmap yR V,r "R repl config "" start R with F2 key "" map RStart "" imap RStart "" vmap 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 RDSendSelection " nmap 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 title 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 see :help mouse " set mouse=a "already set by defaults.vim " set mouse=nv "Disable mouse set mouse= " Shortcuts for next or prev file like after vim *.py " :map v :n " :map V :N " or just use :n or :N followed by the dot . cmd! "Quick save config with output message silencing imap ;s :silent:update nmap ;s :silent:update nmap ;q :quit " imap jjw :update " vs and running code "Quick mode exit config " Two semicolons are easy to type. The `^ fixes the cursor position. imap ;; `^ inoremap `^ " Just press Space to enter insert mode while in normal mode. nmap i " On gvim and Linux console Vim, you can also use ctrl-Space. " :imap <> "Clipboard config " copy with ctrl-c in visual highlight mode vmap "+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", @") nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')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 " Trigger `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 with fzf in insert mode to insert project file name " inoremap fzf#vim#complete#path('git ls-files $(git rev-parse --show-toplevel)') " Insert mode completion imap (fzf-complete-word) imap (fzf-complete-path) imap (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 " Configure status bar toggle let s:hidden_all = 0 function! ToggleHiddenAll() if s:hidden_all == 0 let s:hidden_all = 1 set noshowmode set noruler set laststatus=0 set noshowcmd "set cmdheight=0 else let s:hidden_all = 0 set showmode set ruler set laststatus=2 set showcmd endif endfunction nnoremap :call ToggleHiddenAll() " Configure color set background=dark if filereadable(expand("~/.vimrc_background")) let base16colorspace=256 source ~/.vimrc_background endif " Set color manually " colorscheme base16-gruvbox-dark-hard 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-gruvbox-dark-hard " colorscheme base16-gruvbox-dark-hard autocmd VimEnter * Goyo autocmd VimEnter * Limelight0.8 "Switch cursor blink rate to 0msec set guicursor+=a:blinkon0 set noshowmode endif