This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
forked from nycksw/ocd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
142 lines (119 loc) · 5.33 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
set nocompatible " Use Vim defaults
function PackInit() abort
if empty(glob('~/.vim/pack/minpac/opt/minpac'))
silent !git clone --quiet https://github.com/k-takata/minpac.git ~/.vim/pack/minpac/opt/minpac
endif
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('spf13/vim-autoclose') " close opened parantheses and '\"
call minpac#add('tpope/vim-repeat') " make repetition work well with plugins
call minpac#add('tpope/vim-surround') " handle surroundings
call minpac#add('tpope/vim-speeddating') " use <c-a>/<c-x> on dates
call minpac#add('junegunn/fzf.vim') " use fzf for file management
if executable('ctags') " use tagbar if ctags is available
call minpac#add('majutsushi/tagbar')
endif
call minpac#add('SirVer/ultisnips')
call minpac#add('honza/vim-snippets')
call minpac#add('vim-airline/vim-airline-themes')
endfunction
command! PackUpdate source $MYVIMRC | call PackInit() | call minpac#update()
command! PackClean source $MYVIMRC | call PackInit() | call minpac#clean()
command! PackStatus packadd minpac | call minpac#status()
set nobackup " Keep no backup file, use version control
set modelines=2 " Enable modelines in files
set matchpairs+=<:> " Add pointy brackets to matchpairs
set viminfo='20,\"50,h " Read/write a .viminfo file, don't store more
" Than 50 lines of registers
set viminfofile=~/.vim/viminfo " Store info under ~/.vim
set title " set Terminals Title.
set nostartofline " don't jump cursor around. Stay in one column
set vb t_vb= " turn the bell off.
set autowrite " Save before :make :suspend, etc
set encoding=utf-8 " use utf-8 as default encoding.
set updatetime=100 " default updatetime 4000ms is not good
" for async update
let mapleader="," " my custom mappings are introduced by ','
" Persistent Undo
if !isdirectory(glob('~/.vim/undodir'))
call mkdir($HOME."/.vim/undodir","p")
endif
set undodir=~/.vim/undodir " Store undo history in this directory
set undofile " Enable persistent undo
" Whitespace
set backspace=indent,eol,start " Backspacing over everything in insert mode
set wrap " Enable line Wrapping
set autoindent " take indent for new line from previous line
set linebreak " Wrap at word
set tabstop=4 " Tabwidth
set shiftwidth=4 " Indention
set softtabstop=4 " Make sure all tabs are 4 spaces
set expandtab " Expand tabs to spaces
set smarttab " Backspace at line beginning removes indention
" Searching
set incsearch " Incremental search. Search while typing
set ignorecase " Searches are case insensitive
set smartcase " Unless they contain at least one capital letter
set hlsearch " highlight search
" Ctags
set tags=./tags;/,~/.vimtags
" Make tags placed in .git/tags file available in all levels of a repository
let gitroot = substitute(system('git rev-parse --show-toplevel'), '[\n\r]', '', 'g')
if gitroot != ''
let &tags = &tags . ',' . gitroot . '/.git/tags'
endif
" Tagbar and switch to that window.
nnoremap <silent> <leader>tt :TagbarToggle<CR><C-w><C-w>
" User Interface
syntax enable " Syntax highlight on.
set cursorline " Highlight the line the cursor's in
set showcmd " Show (partial) commands in status line.
set ruler " Show cursorposition
set showmatch " Show matching brackets
set wildmenu " Show lists instead of just completing
set laststatus=2 " Always show a status line
set noshowmode " Get rid of default mode indicator
set termguicolors
" color and status line
let g:solarized_visibility="high"
colorscheme solarized8
" Make signcolumn look better.
highlight SignColumn ctermbg=235 guibg=#eee8d5
if has('gui_running')
set background=light
set linespace=1
else
set background=dark
endif
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
" Window management
" split window vertically with <leader> v
nmap <leader>v :vsplit<CR> <C-w><C-w>
" split window horizontally with <leader> s
nmap <leader>s :split<CR> <C-w><C-w>
" Switch between windows with <leader> w
nmap <leader>w <C-w><C-w>_
if has("autocmd")
" Makefiles have real Tabs
au FileType make set noexpandtab
" In text files, always limit the width of text to 78 characters
au BufNewFile,BufRead *.txt,*markdown,*md,*asciidoc,*adoc set tw=78
" Yaml uses tabsize of two
au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
au BufNewFile,BufRead *.go set ft=go
endif " has("autocmd")
" My mappings
map <F5> :set number<CR> " Turn on linenumbers.
map <F6> :set nonumber<CR> " Turn off linenumbers.
" Press Space to turn off highlighting and clear any message already
" displayed.
:noremap <silent> <Space> :silent noh<Bar>echo<CR>
if filereadable(expand("~/.vimrc-local"))
source ~/.vimrc-local
endif