-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
186 lines (145 loc) · 5.92 KB
/
init.vim
File metadata and controls
186 lines (145 loc) · 5.92 KB
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
call plug#begin()
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp-signature-help'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/cmp-emoji'
Plug 'vim-airline/vim-airline'
Plug 'jiangmiao/auto-pairs'
Plug 'scrooloose/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'dhruvasagar/vim-table-mode'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'sainnhe/everforest'
Plug 'godlygeek/tabular'
Plug 'nvim-lua/plenary.nvim'
Plug 'ibhagwan/fzf-lua'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
" nvim-cmp
lua require("config_nvim_cmp")
" vsnip
let g:vsnip_snippet_dir = stdpath('config') . "/vsnip"
" Jump forward or backward
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
" fzf-lua
lua require("config_fzf_lua")
inoremap <c-p> <cmd>lua FzfLua.files()<cr>
nnoremap <c-p> <cmd>lua FzfLua.files()<cr>
inoremap <c-s-p> <cmd>lua FzfLua.live_grep()<cr>
nnoremap <c-s-p> <cmd>lua FzfLua.live_grep()<cr>
inoremap <c-s-f> <cmd>lua FzfLua.lgrep_curbuf()<cr>
nnoremap <c-s-f> <cmd>lua FzfLua.lgrep_curbuf()<cr>
inoremap <c-o> <cmd>lua FzfLua.oldfiles()<cr>
nnoremap <c-o> <cmd>lua FzfLua.oldfiles()<cr>
nnoremap gr <cmd>lua FzfLua.lsp_references()<cr>
" lua require("config_telescope")
" treesitter
lua require("config_treesitter")
" nerdtree
map <silent> <C-n> :NERDTreeToggle<CR>
" jedi-vim:
" disable autocompletion, because we use deoplete for completion
let g:jedi#completions_enabled = 0
" open the go-to function in split, not another buffer
let g:jedi#use_splits_not_buffers = "right"
let g:jedi#show_call_signatures = "2"
" markdown-preview
" 1 means nvim will open preview when entering a markdown buffer
let g:mkdp_auto_start = 0
" 1 means nvim will automatically close preview when opening non markdown
" buffer
let g:mkdp_auto_close = 1
let g:mkdp_refresh_slow = 0
let g:mkdp_open_to_the_world = 0
let g:mkdp_open_ip = ''
let g:mkdp_browser = ''
let g:mkdp_filetpyes = ['markdown']
let g:mkdp_preview_options = {
\ 'mkit': {},
\ 'katex': {},
\ 'uml': {},
\ 'maid': {},
\ 'disable_sync_scroll': 1,
\ 'sync_scroll_type': 'middle',
\ 'hide_yaml_meta': 1,
\ 'sequence_diagrams': {},
\ 'flowchart_diagrams': {},
\ 'content_editable': v:false,
\ 'disable_filename': 0,
\ 'toc': {}
\ }
" vim-markdown
let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_folding_level = 3
let g:vim_markdown_auto_insert_bullets = 0
let g:vim_markdown_new_list_item_indent = 0
" VIM-config
set number relativenumber
set nu rnu
" use ctrl+Enter as "make" command
nnoremap <C-CR> :make!<CR>
autocmd FileType markdown nnoremap <buffer> <C-CR> :MarkdownPreview<CR>
autocmd FileType nerdtree nnoremap <buffer> <C-CR> :NERDTreeCWD<CR>
autocmd FileType python nnoremap <buffer> <C-CR> :make!<CR>
" use ctrl+shift+enter to build markdown with pandoc and copy result as html
" to clipboard
if has("win32")
" The hoops with writing pandoc to a file and then having a second run
" with pandoc with the --ascii flag is necessary as I did not get
" the encoding wit hSet-Clipboard -AsHtml right. (It works however without
" -AsHtml)
autocmd FileType markdown nnoremap <buffer> <C-S-CR> :w !powershell.exe -Command "$TempFile = New-TemporaryFile; pandoc --embed-resources -f gfm --webtex='https://latex.codecogs.com/png.image?\%5Cdpi{300}' -t html -o $TempFile.FullName; pandoc --ascii -f html $TempFile.FullName \| Set-Clipboard -AsHtml; Remove-Item $TempFile"<CR>
autocmd FileType markdown vnoremap <buffer> <C-S-CR> :'<,'>w !powershell.exe -Command "$TempFile = New-TemporaryFile; pandoc --embed-resources -f gfm --webtex='https://latex.codecogs.com/png.image?\%5Cdpi{300}' -t html -o $TempFile.FullName; pandoc --ascii -f html $TempFile.FullName \| Set-Clipboard -AsHtml; Remove-Item $TempFile"<CR>
else
autocmd FileType markdown nnoremap <buffer> <C-S-CR> :w !pandoc --embed-resources -f gfm -t html --webtex='https://latex.codecogs.com/png.image?\%5Cdpi{300}' \| xclip -t text/html -sel c<CR><CR>
autocmd FileType markdown vnoremap <buffer> <C-S-CR> :'<,'>w !pandoc --embed-resources -f gfm -t html --webtex='https://latex.codecogs.com/png.image?\%5Cdpi{300}' \| xclip -t text/html -sel c<CR><CR>
endif
" Enable spell-check in Markdown and Git commit
autocmd FileType markdown setlocal spell
autocmd FileType gitcommit setlocal spell
" recognize markdown files as markdown
autocmd BufNewFile,BufFilePre,BufRead \c*.md set filetype=markdown
" make python scripts with python
autocmd FileType python setlocal makeprg=python3\ \"%\"
autocmd BufRead,BufNewFile *.py setlocal makeprg=python3\ \"%\"
" Set new empty buffers to markdown filetype
autocmd BufEnter {} set filetype=markdown
let mapleader = " "
nnoremap <Leader>cd :cd %:p:h<CR>
" disable autofolding when a file is opened
set nofoldenable
" don't show current mode in command line (this is done by airline)
set noshowmode
" Tab as 4 spaces
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set softtabstop=0
set expandtab
set smarttab
" 80 char line
set colorcolumn=80,100
" allow incrementing/decrementing alphabetical characters
set nrformats+=alpha
" Update title
set title
" key maps for increasing split size
nnoremap <silent> <C-w>+ :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
nnoremap <silent> <C-w>- :exe "vertical resize " . (winwidth(0) * 2/3)<CR>
" colorscheme
let g:everforest_better_performance = 1
colorscheme everforest
" Navigate splits with ctrl+hjkl
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>