-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.vimrc
126 lines (103 loc) · 3.3 KB
/
.vimrc
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
" Install vim-plug if not already installed
set encoding=utf-8
if empty(glob('~/.vim/autoload/plug.vim'))
"silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
"\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" PLUGINS (vim-plug)
" =================================================================================
"
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'ycm-core/YouCompleteMe'
Plug 'Yggdroot/indentLine'
let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_semantic_triggers = {
\ 'python': [ 're!\w{2}' ],
\ 'c': [ 're!\w{2}' ],
\ 'c++': [ 're!\w{2}' ],
\ 'rust': [ 're!\w{2}' ]
\ }
map <C-n> :NERDTreeToggle<CR>
call plug#end()
" KEY BINDINGS
" ==================================================================================
let mapleader="\<space>"
imap jj <Esc>
set timeoutlen=2000
set laststatus=2
set nocompatible
filetype on
syntax on
filetype plugin indent on
set modelines=0
set number
set ruler
set visualbell
set wrap
set textwidth=79
set formatoptions=tcqrn1
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set noshiftround
set hidden
set ttyfast
set laststatus=2
set showmode
set showcmd
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
map <leader>q :q!<CR>
map <leader>w :wq<CR>
map <leader>s :w<CR>
" Colorscheme
set t_Co=256
"set termguicolors
set background=dark
colorscheme patine
"hi Normal guibg=NONE ctermbg=NONE guifg=NONE
"hi Comment term=italic guibg=NONE guifg=#888888
set cursorline
"hi LineNr term=bold cterm=NONE ctermfg=Darkgrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
"hi CursorLineNr cterm=NONE ctermfg=Grey ctermbg=NONE gui=underline guibg=#22222a guifg=#ff9999
"hi CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=#22222a
" python run code within vim
nnoremap <F9> :exec 'w !python' shellescape(@%, 1)<cr>
" shell
nnoremap <F5> :shell<cr>
" switch between tabs with F8
nnoremap <F8> :tabn<cr>
" generate pdf from md using pandoc and open it using zathura using F6
nnoremap <F6> :!pandoc -o out.pdf % --template eisvogel --highlight-style=breezedark --listings;mv out.pdf "$(basename "%" .md).pdf";zathura "$(basename "%" .md).pdf" &<cr>
" Create new files with custom headers
autocmd bufnewfile *.py 0r ~/.vim/headers/head.py
autocmd bufnewfile *.c 0r ~/.vim/headers/head.c
autocmd bufnewfile *.html,*.php 0r ~/.vim/headers/head.html
autocmd bufnewfile Makefile 0r ~/.vim/headers/Makefile
" highlight current line
" statusline
set statusline=%1*\ fmash16\ %3*\ %f\ %4*
set statusline+=%h%m%r%w " flags
set statusline+=%=
set statusline+=%3*\ %l\/\%L\ %2*\ line\
hi user1 ctermbg=234 ctermfg=6
hi user2 ctermbg=234 ctermfg=6
hi user3 ctermbg=235 ctermfg=NONE
hi user4 ctermbg=NONE ctermfg=NONE
" Expand opening-brace followed by ENTER to a block and place cursor inside
inoremap {<CR> {<CR>}<Esc>O
" Auto-insert closing parenthesis/brace
inoremap ( ()<Left>
inoremap { {}<Left>
" Skip over closing parenthesis/brace
inoremap <expr> ) getline('.')[col('.')-1] == ")" ? "\<Right>" : ")"
inoremap <expr> } getline('.')[col('.')-1] == "}" ? "\<Right>" : "}"