/
vim_config
executable file
·159 lines (131 loc) · 3.16 KB
/
vim_config
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
syntax on
filetype plugin indent on
set belloff=all
" Snips path
"set runtimepath+=~/.vim/
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Vundle plugins
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'altercation/vim-colors-solarized'
Plugin 'git@github.com:ctrlpvim/ctrlp.vim.git'
Plugin 'itchyny/lightline.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'hashivim/vim-terraform'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'chrisbra/csv.vim'
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
call vundle#end()
filetype plugin indent on
" Vim terraform config
let g:terraform_align=1
let g:terraform_fmt_on_save=1
" Vim lightline config
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\ 'left': [ ['mode', 'paste'] ,
\ ['gitbranch', 'readonly', 'filename', 'modified'] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ }
" Vim teset configurations
nmap <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>
" Encoding
set encoding=utf-8
" Mouse usage
set mouse=a
" Disable Backup
set nobackup
set noswapfile
set nowb
" Theme
let g:solarized_termcolors=256
syntax enable
set background=dark
colorscheme solarized
" Disable visual and sound bell
set novisualbell
set noerrorbells
set nocompatible
let mapleader=","
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
set number
set backspace=indent,eol,start
set incsearch
set hlsearch
set scrolloff=3
set laststatus=2
set title
set nowrap
set history=1000
set undolevels=500
set ruler
" set cursorline
set synmaxcol=512
set list
" CtrlP
map <leader>cp :CtrlP <cr>
" Tab Mappings
map <leader>tt :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>to :tabonly<cr>
map <leader>tn :tabnext<cr>
map <leader>tp :tabprevious<cr>
map <leader>tf :tabfirst<cr>
map <leader>tl :tablast<cr>
map <leader>tm :tabmov
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" Map windows
map <leader>mv :vsplit <cr>
map <leader>ms :split <cr>
map <leader>wh <C-W>h <cr>
map <leader>wj <C-W>j <cr>
map <leader>wk <C-W>k <cr>
map <leader>wl <C-W>l <cr>
" Window resize
map + <c-w>+
map _ <c-w>-
imap <C-k> <Up>
imap <C-j> <Down>
imap <C-h> <Left>
imap <C-l> <Right>
nmap <F4> :NERDTreeToggle<cr>
map <Left> :echo "no!"<cr>
map <Right> :echo "no!"<cr>
map <Up> :echo "no!"<cr>
map <Down> :echo "no!"<cr>
set listchars=tab:▸\ ,trail:•,extends:❯,precedes:❮
set showbreak=↪\
au InsertEnter * :set listchars-=trail:•
au InsertLeave * :set listchars+=trail:•
" au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setupWrapping()
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|terraform)$',
\ }
function! RenameFile()
let old_name = expand('%')
let new_name = input('File Name: ', expand('%'))
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction
map <leader>j :call RenameFile()<cr>
set noshowmode
set number relativenumber