47f1b02681858d46e10257210c6d4261f4d9cdde
[khome.git] / home / .config / nvim / init.vim
1 "==============================================================================
2 " Plugins
3 "==============================================================================
4
5 " Alternative plugin managers to try:
6 " - https://github.com/Shougo/dein.vim
7
8 " BEGIN Vim-Plug (https://github.com/junegunn/vim-plug)
9 " Run :PlugInstall after adding a new plugin
10 call plug#begin()
11
12 Plug 'dense-analysis/ale' " Syntastic's spiritual succesor
13 Plug 'preservim/nerdtree'
14 "Plug 'nvim-tree/nvim-web-devicons' " Needs patched fonts: https://www.nerdfonts.com/
15 Plug 'phha/zenburn.nvim'
16 Plug 'itchyny/lightline.vim'
17 Plug 'numToStr/Comment.nvim'
18 Plug 'rust-lang/rust.vim'
19 Plug 'neoclide/coc.nvim', {'branch': 'release'}
20 " Plug 'neovim/nvim-lspconfig'
21
22 " Plug 'hrsh7th/cmp-nvim-lsp', {'branch': 'main'}
23 " Plug 'hrsh7th/cmp-buffer', {'branch': 'main'}
24 " Plug 'hrsh7th/cmp-path', {'branch': 'main'}
25 " Plug 'hrsh7th/nvim-cmp', {'branch': 'main'}
26 "
27 " " Only because nvim-cmp _requires_ snippets
28 " Plug 'hrsh7th/cmp-vsnip', {'branch': 'main'}
29 " Plug 'hrsh7th/vim-vsnip'
30
31 " Plug 'simrat39/rust-tools.nvim'
32
33 call plug#end()
34 " END Vim-Plug
35
36 lua require('Comment').setup()
37 " luafile ~/.config/nvim/setup-rust-tools.lua
38 "luafile ~/.config/nvim/setup-lsp-rust-jonhoo.lua
39 source ~/.config/nvim/setup-coc.vim
40
41 " NERDTree
42 let NERDTreeShowLineNumbers=1
43
44 " rust.vim
45 let g:rustfmt_autosave = 1
46
47 "==============================================================================
48 " Defaults
49 "==============================================================================
50
51 "------------------------------------------------------------------------------
52 " General
53 "------------------------------------------------------------------------------
54 set nocompatible " Because plain vi is a bit annoying
55 set nu " Line numbers in gutter
56 "set rnu " Relative number. relativenumber rnu norelativenumber nornu
57 set ruler " Line and column numbers in status
58 set splitright splitbelow " Split window order
59 set bs=2 " Enable backspace key
60 set history=1000 " Bump history from default of 20
61 set modeline
62 set modelines=3
63 set ttimeoutlen=100 " Reduce delay when addinng libe above ("O")
64 "set fileformats=unix
65 filetype on
66 filetype plugin on
67 set mouse=a " To scroll Coc tooltips. https://github.com/neoclide/coc.nvim/issues/1405
68 set spellfile=~/.vim/spell/en.utf-8.add
69 set spelllang=en,ru
70
71 " lightline
72 set laststatus=2
73 set noshowmode
74 let g:lightline = {'colorscheme': 'seoul256'}
75
76 "------------------------------------------------------------------------------
77 " Color
78 "------------------------------------------------------------------------------
79 set t_Co=256
80 syntax enable
81 set background=dark
82 colorscheme zenburn
83
84 au TextYankPost * lua vim.highlight.on_yank {higroup="IncSearch", timeout=250, on_visual=true, on_macro=true}
85
86 "hi Normal guibg=NONE " Transparency
87 "hi Normal ctermbg=NONE " Transparency
88
89 "------------------------------------------------------------------------------
90 " Search
91 "------------------------------------------------------------------------------
92 set hlsearch
93 set incsearch
94 set noignorecase
95 set smartcase
96
97 "------------------------------------------------------------------------------
98 " Text format / indentation
99 "------------------------------------------------------------------------------
100 filetype indent on
101 set autoindent
102 set smartindent
103 set expandtab
104 set tabstop=8
105 set softtabstop=4
106 set shiftwidth=4
107 set textwidth=0 " What is the point of this again? Prevent auto-wrapping?
108
109 "------------------------------------------------------------------------------
110 " Code folding
111 "------------------------------------------------------------------------------
112 set foldmethod=indent
113 set nofoldenable
114
115 "------------------------------------------------------------------------------
116 " Style enforcement
117 "------------------------------------------------------------------------------
118 " Lines too-long
119 let &colorcolumn=join(range(80,80),",")
120 "match ErrorMsg '\%>79v.\+'
121
122 match ErrorMsg '\s\+$' " Trailing whitespace
123 "2match ErrorMsg '\t' " Tabs
124
125 " TODO: How to match more than 2 things? 3match is reserved for brackets.
126
127 "==============================================================================
128 " Per FileType overrides
129 "==============================================================================
130
131 " C
132 autocmd FileType c set noexpandtab | set shiftwidth=8 | set tabstop=8 | set softtabstop=8
133
134 " TypeScript
135 autocmd FileType typescript set noexpandtab | set shiftwidth=8 | set tabstop=8 | set softtabstop=8
136
137 " R
138 autocmd FileType r set tabstop=2 | set softtabstop=2 | set shiftwidth=2
139
140 " Python
141 autocmd FileType python set omnifunc=pythoncomplete#Complete
142
143 " Git commit
144 autocmd FileType gitcommit set spell
145
146 " Markdown
147 "autocmd FileType markdown set spell
148 autocmd FileType markdown set expandtab | set tabstop=2 | set softtabstop=2 | set shiftwidth=2
149
150 " HTML
151 autocmd FileType html set spell
152
153 " MediaWiki
154 autocmd FileType mediawiki set spell
155 autocmd FileType mediawiki set tabstop=2 | set softtabstop=2 | set shiftwidth=2
156
157 " Tiger
158 autocmd BufNewFile,BufRead *.tig set filetype=tiger
159
160 " SML
161 autocmd BufNewFile,BufRead *.sig set filetype=sml
162
163 " Mathematica
164 autocmd BufNewFile,BufRead *.m set filetype=mma
165 autocmd BufNewFile,BufRead *.mt set filetype=mma
166 autocmd FileType mma set tabstop=2 | set softtabstop=2 | set shiftwidth=2
167
168 " F#
169 autocmd FileType fsharp set tabstop=4 | set softtabstop=4 | set shiftwidth=4
170
171 " twtxt.txt
172 autocmd BufNewFile,BufRead twtxt.txt set filetype=conf | set noexpandtab
173
174 " Scheme
175 autocmd FileType scheme set tabstop=2 | set softtabstop=2 | set shiftwidth=2
176
177 " Racket
178 autocmd FileType racket setlocal equalprg=scmindent.rkt
179 "autocmd FileType racket setlocal equalprg=raco\ fmt
180
181 " Erlang
182 "autocmd FileType erlang setlocal equalprg=erlfmt
183 autocmd FileType erlang set tabstop=4 | set softtabstop=4 | set shiftwidth=4
184
185 " -----------------------------------------------------------------------------
186 " TypeScript
187 " -----------------------------------------------------------------------------
188 "let g:tsuquyomi_completion_detail = 1
189 "let g:tsuquyomi_use_local_typescript = 0
190 "let g:syntastic_typescript_checkers = ['tsuquyomi']
191
192 " -----------------------------------------------------------------------------
193 " Racket
194 " -----------------------------------------------------------------------------
195 let g:syntastic_enable_racket_racket_checker = 0
196
197 " -----------------------------------------------------------------------------
198 " OCaml
199 " -----------------------------------------------------------------------------
200 autocmd FileType ocaml set tabstop=2 | set softtabstop=2 | set shiftwidth=2
This page took 0.072728 seconds and 3 git commands to generate.