summaryrefslogtreecommitdiff
path: root/init.vim
blob: 01f3b1ff065abe848ebc725619ddd17741b765ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
let &t_ZM = "\e[3m"

call plug#begin('~/.local/share/nvim/plugged')

Plug 'airblade/vim-gitgutter'
Plug 'godlygeek/tabular'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'vimwiki/vimwiki'

" tpope
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-fugitive'

" syntax and friends
" Plug 'rust-lang/rust.vim', {'for': 'rust'}
Plug 'lervag/vimtex', {'for': 'tex'}
Plug 'neovimhaskell/haskell-vim', {'for': ['haskell', 'cabal']}
Plug 'elmcast/elm-vim'
Plug 'LnL7/vim-nix'

" my stuff
Plug 'git@ferrn:vim/vim-colors-plain'
Plug 'git@ferrn:vim/better-text-objs'

" nvim only
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

call plug#end()


" augroups

augroup plaintext
    autocmd!
	autocmd FileType text,markdown setlocal ts=2 sts=2 sw=2 expandtab textwidth=60
augroup END

augroup webdev
    autocmd!
	autocmd FileType less,css,html,js?,ts? setlocal ts=2 sts=2 sw=2 expandtab
	autocmd FileType less,css,html nnoremap <Leader>s viB:sort<cr>
augroup END

augroup lisp_stuff
    autocmd!
	autocmd BufReadPost *.lisp set filetype=scheme
augroup END

augroup restorecursor
	autocmd BufReadPost *
				\ if line("'\"") > 1 && line("'\"") <= line("$") |
				\   execute "normal! g`\"" |
				\ endif
augroup END

augroup fzfstatus
    if has('nvim') && !exists('g:fzf_layout')
      autocmd! FileType fzf
      autocmd  FileType fzf set laststatus=0 noshowmode noruler
        \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
    endif
augroup END

augroup completions
    " Use completion-nvim in every buffer
    autocmd!
    autocmd BufEnter * lua require'completion'.on_attach()
augroup END

" general settings
set nobackup
set nowritebackup
set noswapfile " get rid of swapfiles everywhere
set dir=/tmp

syntax on

set omnifunc=syntaxcomplete#Complete
set completefunc=LanguageClient#complete
set list
filetype off
filetype plugin indent on
set laststatus=2
set nowrap
set noshowmode
set listchars=tab:┊\ ,nbsp:␣,trail:·,extends:>,precedes:<
set fillchars=vert:\│,stl:\ ,stlnc:\ 
set ignorecase
set smartcase
set sidescroll=40
set incsearch
set hlsearch
set undofile
set undodir=~/tmp
set path+=**
set backspace=indent,eol,start
set hidden
set wildmenu
set complete=.,w,b,i,u,t,
set background=dark
set mouse=a
set conceallevel=0
set nonumber
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat=%f:%l:%c:%m,%f:%l:%m
set cmdheight=2
set shortmess+=c
set updatetime=300
set signcolumn=yes
set inccommand=split
set showmatch
set diffopt+=vertical
set completeopt=menuone,noinsert,noselect

let g:netrw_browsex_viewer= "xdg-open"

colorscheme plain

set shiftwidth=4     " indent = 4 spaces
set expandtab
set tabstop=4        " tab = 4 spaces
set softtabstop=4    " backspace through spaces

" Functions
function! GetTabber()  " a lil function that integrates well with Tabular.vim
	let c = nr2char(getchar())
	:execute 'Tabularize /' . c
endfunction

" Ugh
command! WQ wq
command! Wq wq
command! Wqa wqa
command! WQa wqa
command! W w
command! Q q

" abbreviations
abclear
iab #i #include
iab #d #define
cab dst put =strftime('%d %a, %b %Y')<cr>
cab vg vimgrep
cab vga vimgrepadd
cab bfd bufdo

" man pages
let g:ft_man_open_mode = 'tab'

let g:gitgutter_override_sign_column_highlight = 0
let g:gitgutter_sign_added                     = '+'
let g:gitgutter_sign_modified                  = '~'
let g:gitgutter_sign_removed                   = '-'
let g:gitgutter_sign_removed_first_line        = '-'
let g:gitgutter_sign_modified_removed          = '~'

let g:fzf_colors =
            \ { 'fg':      ['fg', 'Noise'],
            \ 'bg':      ['bg', 'Noise'],
            \ 'hl':      ['fg', 'Statement'],
            \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
            \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
            \ 'hl+':     ['fg', 'Statement'],
            \ 'info':    ['fg', 'PreProc'],
            \ 'border':  ['fg', 'Ignore'],
            \ 'prompt':  ['fg', 'Conditional'],
            \ 'pointer': ['fg', 'Exception'],
            \ 'marker':  ['fg', 'Keyword'],
            \ 'spinner': ['fg', 'Label'],
            \ 'header':  ['fg', 'Comment'] }
let g:fzf_layout = { 'down': '40%' }
let g:fzf_preview_window = []

highlight GitGutterAdd    ctermfg=8
highlight GitGutterChange ctermfg=8
highlight GitGutterDelete ctermfg=8

let g:rustfmt_autosave = 1

let g:latex_view_general_viewer = "zathura"
let g:vimtex_view_method = "zathura"
let g:tex_flavor = 'latex'

let g:elm_setup_keybindings = 0

let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy', 'all']
let g:completion_trigger_on_delete = 1

sign define LspDiagnosticsSignError       text=×  texthl=LspDiagnosticsSignError         linehl=   numhl=
sign define LspDiagnosticsSignWarning     text=\! texthl=LspDiagnosticsSignWarning       linehl=   numhl=
sign define LspDiagnosticsSignInformation text=i  texthl=LspDiagnosticsSignInformation   linehl=   numhl=
sign define LspDiagnosticsSignHint        text=\~ texthl=LspDiagnosticsSignHint          linehl=   numhl=

lua << EOF
require 'lsp'
require 'treesitter'
EOF