1 " use our new vim dir primarily
2 let x = ($XDG_CONFIG_HOME??($HOME.'/.config')).'/vim'
3 execute 'set runtimepath='.x.','.&runtimepath.','.x.'/after'
4 execute 'set packpath='.x.','.&packpath.','.x.'/after'
7 " neovim doesn't have defaults to load explicitly
8 source $VIMRUNTIME/defaults.vim
10 " neovim does this stuff already
17 " define and create a centralized dir to keep transient state files in
18 let x = ($XDG_STATE_HOME??($HOME.'/.local/state')).'/vim'
20 call mkdir(x, 'p', 0700)
25 call mkdir(y, 'p', 0700)
27 execute 'set backupdir='.y.'//'
28 set backup backupcopy=yes
31 " NOTE: neovim uses ShaDa (SHAred DAta) format for viminfo and swap, and uses a
32 " different version for undo files, so these types of files when created
33 " by vim cannot be used with neovim, and the 'viminfofile', 'directory',
34 " and 'undodir' directories cannot be shared.
35 " NOTE: neovim has a nice default for these directories and files so
36 " customizing them is not necessary for it.
38 " NOTE: 'viminfofile' is a deprecated alias for 'shada' in neovim
39 execute 'set viminfofile='.x.'/.viminfo'
43 call mkdir(y, 'p', 0700)
45 execute 'set directory='.y.'//'
49 call mkdir(y, 'p', 0700)
51 execute 'set undodir='.y.'//'
54 autocmd BufNew * set undofile
60 autocmd VimEnter,WinNew * set number
61 autocmd VimEnter,WinNew * set relativenumber
62 autocmd InsertEnter * set norelativenumber
63 autocmd InsertLeave * set relativenumber
64 autocmd FocusLost * set norelativenumber
65 autocmd FocusGained * set relativenumber
67 autocmd VimEnter,WinNew * set colorcolumn=80
68 autocmd VimEnter,WinNew * set cursorline
71 autocmd VimEnter,WinNew * set list
72 set listchars=tab:├─,extends:»,precedes:«,space:·,trail:∙,nbsp:■
75 highlight ColorColumn term=NONE ctermbg=0
77 highlight WhiteSpaceMol ctermfg=Black
78 autocmd VimEnter,WinNew * match WhiteSpaceMol / /
79 highlight WhiteSpaceBol ctermfg=DarkBlue
80 autocmd VimEnter,WinNew * 2match WhiteSpaceBol /\(^ \+\)\|\( \+$\)/
83 autocmd FileType python set softtabstop=4 shiftwidth=4 expandtab
84 autocmd FileType markdown set softtabstop=4 shiftwidth=4 expandtab
85 autocmd FileType javascript set softtabstop=2 shiftwidth=2 expandtab
86 autocmd FileType json set softtabstop=2 shiftwidth=2 expandtab
87 autocmd FileType html set softtabstop=2 shiftwidth=2 expandtab
88 let g:EditorConfig_enable_for_new_buf = 1
91 autocmd FileType todo set colorcolumn=0