summaryrefslogtreecommitdiff
path: root/vimrc
blob: 3b9970d17df4ef3c12c981be3ad368bd8f0d5c9a (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

set shell=/bin/zsh

set t_Co=256
colorscheme cobalt2
set ruler  " show the cursor position all the time
set showcmd " display incomplete commands
set number "show line numbers
set laststatus=2 "show status bar
set foldmethod=syntax
set background=dark

" allow backspacing over everything in insert mode
set nocompatible
set backspace=indent,eol,start
set backupdir=~/.vim/swaps//
set viminfo+=n~/.vim/info
set history=200
set hidden "allow switching buffers without saving

set incsearch " do incremental searching
set hlsearch

filetype plugin indent on
syntax on

set list
set listchars=tab:\|\ 
set tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab

" latex settings
let g:vimtex_view_method = 'zathura'

" cpp coloraton settings
let g:cpp_class_scope_highlight = 1
let g:cpp_member_variable_highlight = 1
let g:cpp_class_decl_highlight = 1
let g:cpp_experimental_template_highlight = 1
let g:cpp_concepts_highlight = 1
let g:cpp_named_requirements_highlight = 1

autocmd BufNewFile,BufRead *.wl set syntax=wl
autocmd BufNewFile,BufRead *.wls set syntax=wl
autocmd BufNewFile,BufRead *.m set syntax=wl

" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~ '\s'
endfunction

inoremap <silent><expr> <Tab>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<Tab>" :
      \ coc#refresh()

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

let g:mma_candy = 2

vmap <leader>p  <Plug>(coc-format-selected)
nmap <leader>p  <Plug>(coc-format-selected)
nmap <leader>P  <Plug>(coc-format)
nmap <leader>f  <Plug>(coc-fix-current)
nmap <leader>r  <Plug>(coc-rename)
nmap <leader>d  <Plug>(coc-definition)
nmap <leader>h  <Plug>(coc-action-doHover)

nmap [g <Plug>(coc-git-prevchunk)
nmap ]g <Plug>(coc-git-nextchunk)
" show chunk diff at current position
nmap gs <Plug>(coc-git-chunkinfo)
" show commit contains current position
nmap gc <Plug>(coc-git-commit)
" create text object for git chunks
omap ic <Plug>(coc-text-object-inner)
xmap ic <Plug>(coc-text-object-inner)
omap ic <Plug>(coc-text-object-outer)
xmap ic <Plug>(coc-text-object-outer)

nmap ga :CocCommand git.chunkStage<cr>
nmap gu :CocCommand git.chunkUndo<cr>

call plug#begin()

Plug 'lervag/vimtex'
Plug 'rhysd/vim-clang-format'
Plug 'neovimhaskell/haskell-vim'
Plug 'alx741/vim-hindent' 
Plug 'tpope/vim-fugitive'
Plug 'neoclide/coc.nvim'
Plug 'voldikss/vim-mma'

call plug#end()

" Add format option 'w' to add trailing white space, indicating that paragraph
" continues on next line. This is to be used with mutt's 'text_flowed' option.
augroup mail_trailing_whitespace " {
    autocmd!
    autocmd FileType mail setlocal formatoptions+=w
augroup END " }