]> git.sev.monster Git - dotfiles.git/blame - etc/vim/.vimrc
zsh: fix fzf options for history search
[dotfiles.git] / etc / vim / .vimrc
CommitLineData
58a8dbcc 1" use our new vim dir primarily
afd175d7 2let x = ($XDG_CONFIG_HOME??($HOME.'/.config')).'/vim'
8d4a98e1 3execute 'set runtimepath='.x.','.&runtimepath.','.x.'/after'
4execute 'set packpath='.x.','.&packpath.','.x.'/after'
1b8a4102 5
58a8dbcc 6if !has('nvim')
7 " neovim doesn't have defaults to load explicitly
8 source $VIMRUNTIME/defaults.vim
9
10 " neovim does this stuff already
11 packadd matchit
12 packadd editorconfig
13
14 set autoindent
15endif
fef7b7c4 16
58a8dbcc 17" define and create a centralized dir to keep transient state files in
afd175d7 18let x = ($XDG_STATE_HOME??($HOME.'/.local/state')).'/vim'
4850f4c2 19if !isdirectory(x)
afd175d7 20 call mkdir(x, 'p', 0700)
21endif
afd175d7 22
23let y = x.'/backup'
24if !isdirectory(y)
25 call mkdir(y, 'p', 0700)
8d4a98e1 26endif
afd175d7 27execute 'set backupdir='.y.'//'
58a8dbcc 28set backup backupcopy=yes
afd175d7 29
58a8dbcc 30
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.
37if !has('nvim')
38 " NOTE: 'viminfofile' is a deprecated alias for 'shada' in neovim
39 execute 'set viminfofile='.x.'/.viminfo'
40
41 let y = x.'/swap'
42 if !isdirectory(y)
43 call mkdir(y, 'p', 0700)
44 endif
45 execute 'set directory='.y.'//'
46
47 let y = x.'/undo'
48 if !isdirectory(y)
49 call mkdir(y, 'p', 0700)
50 endif
51 execute 'set undodir='.y.'//'
8d4a98e1 52endif
58a8dbcc 53
54autocmd BufNew * set undofile
afd175d7 55
4850f4c2 56unlet x
afd175d7 57unlet y
1b8a4102 58
58a8dbcc 59" options
60autocmd VimEnter,WinNew * set number
61autocmd VimEnter,WinNew * set relativenumber
62autocmd InsertEnter * set norelativenumber
63autocmd InsertLeave * set relativenumber
64autocmd FocusLost * set norelativenumber
65autocmd FocusGained * set relativenumber
66
67autocmd VimEnter,WinNew * set colorcolumn=80
68autocmd VimEnter,WinNew * set cursorline
1b8a4102 69set hlsearch
58a8dbcc 70
71autocmd VimEnter,WinNew * set list
1b8a4102 72set listchars=tab:├─,extends:»,precedes:«,space:·,trail:∙,nbsp:■
58a8dbcc 73
74" styles
75highlight ColorColumn term=NONE ctermbg=0
76
fab483dd 77highlight WhiteSpaceMol ctermfg=Black
58a8dbcc 78autocmd VimEnter,WinNew * match WhiteSpaceMol / /
79highlight WhiteSpaceBol ctermfg=DarkBlue
80autocmd VimEnter,WinNew * 2match WhiteSpaceBol /\(^ \+\)\|\( \+$\)/
ddcfe43c 81
58a8dbcc 82" indent
83autocmd FileType python set softtabstop=4 shiftwidth=4 expandtab
84autocmd FileType markdown set softtabstop=4 shiftwidth=4 expandtab
85autocmd FileType javascript set softtabstop=2 shiftwidth=2 expandtab
86autocmd FileType json set softtabstop=2 shiftwidth=2 expandtab
87autocmd FileType html set softtabstop=2 shiftwidth=2 expandtab
e69caf64 88let g:EditorConfig_enable_for_new_buf = 1
58a8dbcc 89
90" syntax
91autocmd FileType todo set colorcolumn=0
This page took 0.089916 seconds and 4 git commands to generate.