-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
151 lines (138 loc) · 4.73 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
"" dkeg vimrc
"" Environment {{
" Basics {
set nocompatible " must be first line
"set background=dark " Assume a dark background
call togglebg#map("<f5>")
"Jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"Automatic reloading of .vimrc
au BufWritePost .vimrc so ~/.vimrc
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,latin1
endif
scriptencoding utf-8
set encoding=utf-8
" }
"" }}
"" Color Options {{
colorscheme shblah
set background=dark
"" }}
"" General Settings {{
"set background=dark
set t_Co=16
"set tw=79 " Width of document
let mapleader=" "
"set nocompatible
"filetype plugin on
filetype off
syntax on
"set nonumber
set norelativenumber
set tabstop=2
set shiftwidth=2
set nowrap
set expandtab
set autoindent
set smartindent
set incsearch
set hlsearch
set cursorline
set novisualbell
set colorcolumn=80
"set list
set listchars=tab:»\ ,eol:¬,trail:·,extends:→,precedes:← "
"set showbreak=~
filetype plugin indent on
set noswapfile " Don't create a swap file
set smartcase " Search becomes case sensitive if caps used
set pastetoggle=<F10>
let g:Powerline_symbols = 'fancy'
"set showmatch
"When splitting windows, auto show num on focus
"au WinEnter * setlocal number
"au WinLeave * setlocal nonumber
"set statusline=\ %t\ %w%m%r%=[%{strlen(&ft)?&ft:'no\ ft'}]\ %l:%v\
"statusline
"" }}
"" Highlighting {{
let g:brightest#highlight = {"group": "BrightestUnderline"}
"highlight OverLength ctermbg=232 ctermfg=240
"match OverLength /\%81v.\+/ " Highlight text exceeding 80 character limit
" indent guide coloring
hi IndentGuidesOdd ctermbg=234
hi IndentGuidesEven ctermbg=231
"autocmd CursorMoved * exe printf('match WordUnder /\V\<%s\>/', escape(expand('<cword>'), '/\'))
"" }}
"" Code Folding {{{
set foldenable " Enable code folding
set foldmethod=manual " But do it manually
autocmd BufWinLeave * mkview " Auto save folds
autocmd BufWinEnter * silent loadview " Auto load saved folds
" }}}
"" Extras {{
inoremap qq <Esc> " remap the ESC key
nnoremap H :set cursorline! cursorcolumn!<CR>
map <C-t> :NERDTreeToggle<CR>
let g:NERDTreeDirArrows=0
"noremap <C-n> :call NumberToggle()<CR>
map <C-n> :set number!<CR>
map <C-m> :set relativenumber!<CR>
":au FocusLost * :set number
":au FocusGained * :set relativenumber
map <C-c> :%s/\s\+$//<CR>
map <tab> %
cmap w!! w !sudo tee % > /dev/null % " save read only files when forget to use sudo
"cmap w !sudo cat >% "save file without needed permissions
let $GROFF_NO_SGR=1
source $VIMRUNTIME/ftplugin/man.vim
nmap K :Man <cword><CR>
au BufLeave,FocusLost * silent! update " buffer auto save
"" Paren highlighting
" A massively simplified take on
" https://github.com/chreekat/vim-paren-crosshairs
" A massively simplified take on https://github.com/chreekat/vim-paren-crosshairs
func! s:matchparen_cursorcolumn_setup()
augroup matchparen_cursorcolumn
autocmd!
autocmd CursorMoved * if get(w:, "paren_hl_on", 0) | set cursorcolumn | else | set nocursorcolumn | endif
autocmd InsertEnter * set nocursorcolumn
augroup END
endf
if !&cursorcolumn
augroup matchparen_cursorcolumn_setup
autocmd!
" - Add the event _only_ if matchparen is enabled.
" - Event must be added _after_ matchparen loaded (so we can react to w:paren_hl_on).
autocmd CursorMoved * if exists("#matchparen#CursorMoved") | call <sid>matchparen_cursorcolumn_setup() | endif
\ | autocmd! matchparen_cursorcolumn_setup
augroup END
endif
"" }}
"" Plugins {{
call plug#begin('~/.vim/plugged') " use for plug.vim
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/goyo.vim'
Plug 'jaxbot/semantic-highlight.vim'
call plug#end()
" Panthogen
execute pathogen#infect()
"autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endi
" by default vim-airline only shows when split. This changes that setting
Plug 'itchyny/lightline.vim'
let g:lightline = {
\ 'colorscheme': 'genx',
\ }
"set laststatus=2
"" }}