-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.vimrc
150 lines (117 loc) · 3.05 KB
/
basic.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
set nocompatible
filetype plugin indent on
syntax on
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" set background=light
colorscheme molokai
hi NonText ctermbg=none
hi Normal guibg=NONE ctermbg=NONE
" set termguicolors
" set number
set relativenumber
set cursorline
set cursorcolumn
set laststatus=2
set virtualedit=all
set t_Co=256
set scrolloff=5
set sidescrolloff=1
set tabpagemax=30
set switchbuf=usetab
set splitright
set splitbelow
" works with Konsole
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
" let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
set t_SH =
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set visualbell t_vb=
endif
set showcmd
set showmatch
set wildmenu
set hidden
set smartindent
set autoindent
set cindent
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set wrap
set colorcolumn=80,120
set textwidth=120
set ignorecase
set smartcase
set hlsearch
set incsearch
runtime! macros/matchit.vim
set backspace=indent,eol,start
set history=100 " keep 100 lines of command line history
set undofile
set clipboard+=unnamed
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+,eol:$
set formatoptions+=j
set formatoptions-=t
set sessionoptions-=curdir
set sessionoptions-=options
"set ssop-=curdir
set sessionoptions+=sesdir
"set ssop+=sesdir
let g:session_directory=getcwd()
let g:session_autosave='no'
set diffopt+=filler
set diffopt+=iwhite
set diffopt+=vertical
set encoding=utf-8
set spelllang=en
set foldcolumn=2
set foldmethod=indent
set foldlevel=0
" open all folds on file open
au BufRead * normal zR
"
set concealcursor=vin
set conceallevel=2
set complete+=t
set completeopt=menu,menuone,longest
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
inoremap <C-Space> <c-x><c-u>
inoremap <C-@> <c-x><c-u>
set autoread
nnoremap <silent> <Leader>r :checktime<CR>
map <C-PAGEUP> :bp<CR>
map <C-PAGEDOWN> :bn<CR>
nmap <silent> <leader>F :e!<CR>G:sleep 500m<CR><leader>F
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
" Remove all trailing whitespaces on write.
" Probably not always wanted...
autocmd BufWritePre * %s/\s\+$//e
" format json-objects
" :%!python -m json.tool
"
" set ttymouse=sgr