summaryrefslogtreecommitdiff
path: root/.vimrc
blob: 57731d58839f06244b0b257efce2df3e00dc5d30 (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
set nocompatible        " be iMproved, required
filetype on             " required

set timeoutlen=1000
set ttimeoutlen=5

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

" Keep Plugin commands between vundle#begin/end.
" Coding
Plugin 'dense-analysis/ale'
" Plugin 'jiangmiao/auto-pairs'
Plugin 'Shougo/deoplete.nvim'
Plugin 'preservim/nerdcommenter'
Plugin 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plugin 'nvim-lua/plenary.nvim'
Plugin 'nvim-telescope/telescope.nvim'
Plugin 'tpope/vim-surround'
Plugin 'puremourning/vimspector'
Plugin 'ilyachur/cmake4vim'
" File types
Plugin 'rust-lang/rust.vim'
Plugin 'neovimhaskell/haskell-vim'
Plugin 'peterhoeg/vim-qml'
Plugin 'lervag/vimtex'
" Utilities
Plugin 'kyazdani42/nvim-web-devicons'
Plugin 'kyazdani42/nvim-tree.lua'
Plugin 'reedes/vim-pencil'
Plugin 'thaerkh/vim-workspace'
" Appearance
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Music
Plugin 'azadkuh/vim-cmus'
" Fun
Plugin 'Eandrju/cellular-automaton.nvim'
Plugin 'tamton-aquib/duck.nvim'

" All of your Plugins must be added before the following line
call vundle#end()               " required
filetype plugin indent on       " required

" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

syntax on
set encoding=utf-8 fileformat=unix
set number
set mouse=nvi

set splitright splitbelow

set foldmethod=indent foldlevel=99

autocmd BufRead,BufNewFile *.qml setfiletype qml

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
autocmd FileType json,toml,yaml     set ts=2 sw=2 sts=2 expandtab
autocmd FileType html,htmldjango    set ts=2 sw=2 sts=2 expandtab
autocmd FileType css                set ts=2 sw=2 sts=2 expandtab
autocmd FileType ocaml              set ts=2 sw=2 sts=2 expandtab
autocmd FileType python             set ts=4 sw=4 sts=4 expandtab
autocmd FileType markdown           set ts=4 sw=4 sts=4 expandtab
autocmd FileType tex                set ts=4 sw=4 sts=4 expandtab
autocmd FileType haskell            set ts=4 sw=4 sts=4 expandtab
autocmd FileType rust               set ts=4 sw=4 sts=4 expandtab
autocmd FileType qml                set ts=4 sw=4 sts=4 expandtab
autocmd FileType c,cpp,asm          set ts=8 sw=8 sts=8 noexpandtab
autocmd FileType javascript         set ts=8 sw=8 sts=8 noexpandtab
set autoindent smartindent

" Force 2 spaces, 4 spaces or 1 tab
nnoremap <leader>2 :set ts=2 sw=2 sts=2 expandtab<CR>
nnoremap <leader>4 :set ts=4 sw=4 sts=4 expandtab<CR>
nnoremap <leader>8 :set ts=8 sw=8 sts=8 noexpandtab<CR>

set background=dark
colorscheme vim
let g:airline_theme='onedark'

" Popup menu colors
set termguicolors
highlight Pmenu     guibg=#282C34
highlight PmenuSel  guibg=#61AFEF

" Generic shortcuts
inoremap <C-s> <esc>:w<CR>a
nnoremap <leader>\ :noh<CR>

" Autoformat
autocmd FileType python nnoremap <leader>b :!black %<CR>:e<CR>
autocmd FileType c,cpp  nnoremap <leader>b :pyf /usr/share/clang/clang-format.py<CR>
autocmd FileType rust   nnoremap <leader>b :!rustfmt %<CR>:e<CR>

" ale
nnoremap <leader>a :ALEToggle<CR>
nnoremap <F12> :ALEGoToDefinition<CR>
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_virtualtext_cursor = 'disabled'

" telescope
nnoremap <leader>f :Telescope find_files<CR>
nnoremap <leader>g :Telescope live_grep<CR>
nnoremap <leader>fb :Telescope buffers<CR>
nnoremap <leader>fh :Telescope help_tags<CR>

" deoplete
let g:deoplete#enable_at_startup = 1
nnoremap <leader>d :call deoplete#toggle()<CR>

" NERDCommenter
let g:NERDCreateDefaultMappings = 1
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDCustomDelimiters = { 'c': { 'left': '/*','right': '*/' } }
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:NERDToggleCheckAllLines = 1

" Vimspector
nmap <F2> <Plug>VimspectorToggleBreakpoint
nmap <F3> <Plug>VimspectorStop
nmap <F4> <Plug>VimspectorRestart
nmap <F5> <Plug>VimspectorContinue
nmap <F6> <Plug>VimspectorPause
nmap <F7> <Plug>VimspectorUpFrame
nmap <F8> <Plug>VimspectorDownFrame
nmap <F10> <Plug>VimspectorStepOver
nmap <F11> <Plug>VimspectorStepInto
nmap <F12> <Plug>VimspectorStepOut
nmap <leader>di <Plug>VimspectorBalloonEval
xmap <leader>di <Plug>VimspectorBalloonEval
nmap <leader>B <Plug>VimspectorBreakpoints
nmap <leader>D <Plug>VimspectorDisassemble

" vimtex
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let g:vimtex_compiler_method = 'latexmk'
let g:vimtex_compiler_latexmk = {'options': ['-shell-escape']}

" nvim-tree
nnoremap <leader>e :NvimTreeToggle<CR>
nnoremap <leader>t :NvimTreeFocus<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>
" a list of groups can be found at `:help nvim_tree_highlight`
highlight NvimTreeFolderIcon guibg=blue

" vim-pencil
nnoremap <leader>p :PencilToggle<CR>
let g:pencil#map#suspend_af = 'K'
let g:pencil#textwidth = 74
augroup pencil
	autocmd!
	autocmd FileType markdown,mkd   call pencil#init()
	" autocmd FileType text           call pencil#init()
augroup END

" vim-workspace
nnoremap <leader>s :ToggleWorkspace<CR>
let g:workspace_session_directory = $HOME . '/.vim/sessions/'
let g:workspace_session_disable_on_args = 1
let g:workspace_autosave = 0

" vim-cmus
nnoremap <leader>c :Cmus<CR>

" duck.nvim
nnoremap <leader>dd :lua require("duck").hatch()<CR>
nnoremap <leader>dk :lua require("duck").cook()<CR>