-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
executable file
·152 lines (121 loc) · 3.74 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
151
152
set nocompatible " use vim defaults instead of vi
" Encoding
set encoding=utf-8
set path+=/usr/include/c++/6
set runtimepath+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
"Put your non-Plugin stuff after this line
Plugin 'scrooloose/nerdtree' " File Explorer
Plugin 'jlanzarotta/bufexplorer' " Buffer Explorer :BufExplore
Plugin 'godlygeek/tabular' " Text alignment
Plugin 'majutsushi/tagbar' " Display tags in a window
"Plugin 'scrooloose/syntastic' " Syntax checking on write
Plugin 'tpope/vim-fugitive' " Git wrapper
Plugin 'tpope/vim-surround' " Manipulate quotes and brackets
Plugin 'terryma/vim-multiple-cursors' " Multiple cursors work
Plugin 'jiangmiao/auto-pairs' " Auto Brackets
Plugin 'easymotion/vim-easymotion' " Easy motion
" All of your Plugins must be added before the following line
call vundle#end()
if has("win32")
set runtimepath+=~/.vim
endif
" Turn on syntax highlighting
syntax on
" For plugins to load correctly
filetype on
filetype plugin indent on
" General
set number " Show line numbers
set backspace=2 " enable <BS> for everything
set completeopt=longest,menuone " Autocompletion options
set mouse=a " enable mouse in all modes
set hidden " hide when switching buffers, don't unload
set laststatus=2 " always show status line
set lazyredraw " don't update screen when executing macros
set showmatch " show bracket matches
set textwidth=0 " don't break lines after some maximum width
set ttyfast " increase chars sent to screen for redrawing
set title " use filename in window title
set wildmenu " enhanced cmd line completion
set wildchar=<TAB> " key for line completion
set noerrorbells " no error sound
set splitright " Split new buffer at right
set clipboard=unnamedplus " Register to clipboard
" Last line
set noshowmode
set showcmd
" Show file stats
set ruler
" Update file change
set autoread
set autowrite
" Blink cursor on error instead of beeping (grr)
set visualbell
set t_vb=
" Tabs
set autoindent " copy indent from previous line
set si " smart indent
set expandtab " no replace tabs with spaces
set shiftwidth=4 " spaces for autoindenting
" set softtabstop=4 " spaces for editing, e.g. <Tab> or <BS>
set tabstop=4 " spaces for <Tab>
" Searching
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
" Mappings {{{
" Map leader
let mapleader = "\<Space>"
" out bracket
inoremap <C-e> <esc>la
" Move up/down editor lines
nnoremap j gj
nnoremap k gk
" Save file
nnoremap <Leader>w :w<CR>
nnoremap <Leader>wq :wq<CR>
nnoremap <Leader>q :q<CR>
" Copy paste from clipboard
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
" Open nerdtree
map <Leader>n :NERDTreeToggle<CR>
" Format
nnoremap <Leader>fm gg=G
" New func
inoremap <C-j> <ESC>jo<CR><BS>
" Tabs
nnoremap <C-Left> :tabp<CR>
nnoremap <C-Right> :tabn<CR>
" Clear buffer
nnoremap <C-X> :bd<CR>
" Open terminal
map <F6> :let $VIM_DIR=expand('%:p:h')<CR>:shell<CR>cd $VIM_DIR<CR>
" rename file
map <Leader>rnf :call RenameFile()<cr>
" Toggle search
nnoremap <Leader>os :noh<CR>
" NERDTree
let g:NERDTreeShowHidden = 1
" Plugin Settings {{{
" -----------------------------------------------------------------------------
" Rename current file
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction