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