-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathve.vimrc
224 lines (181 loc) · 7.43 KB
/
ve.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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
" colorscheme codeschool
" colorscheme jellybeans
" colorscheme clearance
colorscheme molokai
set number " linenumber at start of line
" set relativenumber " relative numbers above and below
set cursorline " highlight current line
set ruler " current position at lower right
set laststatus=2 " status line for each window
set virtualedit=all " move cursor anywhere
set t_Co=256 " 256 colors
set scrolloff=5 " start scrolling on 5 lines left
set sidescrolloff=1 " scroll side step by step
set tabpagemax=30 " max 30 tab-pages on initial open of multiple files
set switchbuf=usetab " on switchbuffer also switch to other tab
set splitright " create split right
set splitbelow " create split below
set showcmd " show size of selection
set showmatch " show matching bracket
set wildmenu " show menu on cmdline-completion
set hidden " hide abandoned buffers
set smartindent " automatically indent more or less in certain cases
set autoindent " automatically insert indent
set cindent " indent-settings for c-style-code
set expandtab " insert spaces instead of tab
set tabstop=4 " <Tab> looks like 4 spaces
set softtabstop=4 " in insert-mode: <Tab> is 4 spaces
set shiftwidth=4 " shifting (<<, >>, ...) with is 4 spaces
set wrap " wrap text at end of line
" set colorcolumn=80,120 " show mark the 80 and 120 width
set textwidth=80 " try breaking text at 80
set ignorecase " ignore case on search
set smartcase " ignore case on search if all lower-case
set hlsearch " highlight search-results
set incsearch " search while inserting search-string
" Use :nohlsearch<C-R> to clear the highlighting
set backspace=indent,eol,start " make backspace more usable
set history=100 " keep 100 lines of command line history
" set undofile " save undo-history in file for reuse on re-open
set clipboard+=unnamed " use +-register for ydcp
" Change appearance of char in :list
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+,eol:$
" set formatoptions+=j " on joining comments remove comment-character
" set sessionoptions-=curdir " don't use current-directory for save&load of session
" set sessionoptions+=sesdir " use session-directory for save&load of session
" let g:session_directory=getcwd() " set session-directory to current directory (where vim started)
" let g:session_autosave='no' " do not automatically save sessions
set diffopt+=filler " on diff: include filler-lines
set diffopt+=iwhite " on diff: ignore whitespace-changes
set diffopt+=vertical " on diff: use vertical split
set encoding=utf-8 " UTF-8 encoding for files
set spelllang=en " spellcheck language is englisch
" set foldcolumn=2 " show line before linenumber with fold-info
" set foldmethod=indent " use indent as fold-indicator
" set foldlevel=0 " close all folds
" " open all folds on file open
" au BufRead * normal zR
" set concealcursor=vin " visual, insert, normal -- conceal/hide things
" set conceallevel=2 " concealed text is concealed
" on completion: show menu with options and only include longest matches
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>
" Ctrl-Space for completion-menu
inoremap <C-Space> <c-x><c-u>
" Ctrl-Space for completion-menu
inoremap <C-@> <c-x><c-u>
set autoread " reread file on external change
" Ctrl-PageUp for previous buffer
map <C-PAGEUP> :bp<CR>
" Ctrl-PageDown for next buffer
map <C-PAGEDOWN> :bn<CR>
" 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
" make % match more then brackets
runtime! macros/matchit.vim
" <leader> F aka \F continuously reload file and goto last line
" nmap <silent> F :e!<CR>G:sleep 500m<CR>:redraw<CR>F
nmap <silent> <leader>F :e!<CR>G:sleep 500m<CR><leader>F
set nottimeout " do not timeout on key sequence insertion
" toggle mouse usage
function! ToggleMouse()
if &mouse == 'a'
:silent! setlocal mouse=
:silent! setlocal nonumber
:silent! setlocal syntax=off
:echo 'Mouse off'
else
:silent! setlocal mouse=a
:silent! setlocal number
:silent! setlocal syntax=on
:echo 'Mouse on'
endif
endfunction
syntax off
syntax manual
set mouse=
set nonumber
set syntax=off
setlocal mouse=
setlocal nonumber
setlocal syntax=off
" toggle mouse usage with Ctrl-m
noremap <silent> <C-m> :call ToggleMouse()<CR>
" copy selection to new tab and new buffer and go back
function! DiffOne() range
:'<,'>yank
:tabnew
:normal P
:normal gg
:tabprevious
endfunction
" copy selection next tab new split and diff both splits
function! DiffTwo() range
:'<,'>yank
:tabnext
:diffthis
:vnew
:normal P
:diffthis
:normal gg
endfunction
function! InstallColorScheme()
if filereadable(glob("~/.vim/colors/molokai.vim"))
" :echo 'molokai already installed'
else
:!wget https://bitbucket.org/Urfoex/std-yvim/raw/default/colors/molokai.vim -x -O ~/.vim/colors/molokai.vim
:echo 'molokai installed'
endif
endfunction
call InstallColorScheme()
" select first part for diff
vnoremap <leader>d1 :call DiffOne()<CR>
" select second part for diff and make diff
vnoremap <leader>d2 :call DiffTwo()<CR>
noremap <C-l> :tabnew /var/log/payment/frontend/
noremap <C-n> :tabnew<CR>
noremap <C-Right> gt
noremap <C-Left> gT
inoremap <C-Right> <ESC>gt
inoremap <C-Left> <ESC>gT
function! UpdateVIMRC()
:!wget https://bitbucket.org/Urfoex/std-yvim/raw/default/ve.vimrc -x -O ~/.vimrc
:source $MYVIMRC
:echo 'vimrc updated'
endfunction
" Do following command to update the vimrc
" :call UpdateVIMRC()
function! ChangeCursorShapes()
" 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"
endfunction
" Uncomment following line to have changing cursor shapes based on mode
" call ChangeCursorShapes()
" vim:set ft=vim et sw=2: