-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
executable file
·184 lines (147 loc) · 5.87 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
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
set encoding=UTF-8 nobomb " Set encodig
set shortmess=atI "Disable the short message on vim start.
set relativenumber " Show relative numbers in normal mode
set number
set wildmenu " Better command-line completion
set completeopt=longest,menu " Setting for wildmenu
set autoindent " Autoindent line
set clipboard=unnamed " Use the OS clipboard
set noerrorbells " Disable error beeps
set nostartofline " Don't reset the cursor
set title " Show filename in titlebar
set display+=lastline " Always try yo display paragraph last line
set autoread " Re-read files if unmodified inside Vim
set confirm " Display confirm dialog when close unsaved file
set wrap " wrap long line
set visualbell " Use visualbell instead of 'beep' when doing something wrong
set lazyredraw " Don't redraw while executing macros
set autochdir " auto change work directory
set ttimeoutlen=0 " toggle between modes almost instantly
set numberwidth=3 " How many column to use for the line number
set showmode " Show current mode
set diffopt=filler " Add vertical spaces to keep right and left aligned
set diffopt+=iwhite " Ignore whitespace changes (focus on code changes)
set report=0 " Report the number of lines changed
set t_Co=256
set linebreak " Break line by words not by char
set splitbelow " Opens new windows below, not above
set splitright " Open new vertical split windows to the right of the current one, not the left
set title " Set titlestring
set titlestring=%{split(getcwd(),'\/')[-1]}
set statusline=\ %y%w%r\ %f\ %m%=%l/%L\ \|%3.c%(\ %)
" Show absolute line numbers in insert mode
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
syntax on
" Set filettype to text for filetypes ending with .txt
autocmd BufNewFile,BufRead *.txt setfiletype text
" ref: http://stackoverflow.com/questions/158968/changing-vim-indentation-behavior-by-file-type
autocmd FileType html set shiftwidth=2|set expandtab
autocmd FileType htmljinja setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd FileType css setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType sh setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
autocmd FileType python setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
autocmd FileType vim setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
autocmd FileType text,markdown,html,xhtml,eruby setlocal wrap linebreak nolist
" Enable use of the mouse for all modes
if has('mouse')
set mouse=a
set selection=exclusive "Mouse can only selects the block where ths cursor is on.
set selectmode=mouse,key
set mousehide "Hide mouse cursor on keyboard typing.
set mousemodel=popup "Right mouse button pops up a menu.
endif
" Backup, swap, undo
set backupdir=/tmp
set directory=/tmp
set undodir=/tmp
" Auto add head info
" .py file auto add header
function HeaderPython()
call setline(1, "#!/usr/bin/env python")
call append(1, "# -*- coding: utf-8 -*-")
call append(2, "# Mirko Rovere @ " . strftime('%Y-%m-%d', localtime()))
normal G
normal o
endf
autocmd bufnewfile *.py call HeaderPython()
" .sh file auto add header
function HeaderBash()
call setline(1, "#!/bin/bash")
call append(1, "# Mirko Rovere @ " . strftime('%Y-%m-%d', localtime()))
normal G
normal o
endf
autocmd bufnewfile *.sh call HeaderBash()
set nocompatible " be iMproved, required
filetype off " required
set rtp+=/etc/vim/Vundle.vim
call vundle#begin('/etc/vim/')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Whenever cursor jumps some distance or moves between windows, it will flash so you can see where it is.
Plugin 'danilamihailov/beacon.nvim'
"C support
Plugin 'WolfgangMehner/c-support'
"Enable C suppport
let g:C_UseTool_cmake = 'yes'
let g:C_UseTool_doxygen = 'yes'
" Markdown
Plugin 'sjl/badwolf'
Plugin 'plasticboy/vim-markdown'
" .csv file support
Plugin 'chrisbra/csv.vim'
" Detect .csv files
if exists("did_load_csvfiletype")
finish
endif
let did_load_csvfiletype=1
augroup filetypedetect
au! BufRead,BufNewFile *.csv,*.dat setfiletype csv
augroup END
" PHP Support
"Plugin 'phpvim/phpcd.vim'
Plugin 'tobyS/pdv'
" Autocolosing brackets
Plugin 'Raimondi/delimitMate'
"Wakatime
Plugin 'wakatime/vim-wakatime'
"Coloscheme
Plugin 'b4skyx/serenade'
" Minimap
Plugin 'wfxr/minimap.vim'
let g:minimap_width = 25
let g:minimap_auto_start = 1
let g:minimap_auto_start_win_enter = 1
let g:minimap_highlight_range = 1
"Tree explorer
Plugin 'preservim/nerdtree'
" Start NERDTree. If a file is specified, move the cursor to its window.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif
let NERDTreeShowHidden=1
" When there are only nerdtree and minimap, close all
autocmd bufenter * if (winnr("$") == 2 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | qa | endif
"NerdTree devicons
Plugin 'ryanoasis/vim-devicons'
" loading the plugin
let g:webdevicons_enable = 1
" adding the flags to NERDTree
let g:webdevicons_enable_nerdtree = 1
" whether or not to show the nerdtree brackets around flags
let g:webdevicons_conceal_nerdtree_brackets = 1
let g:WebDevIconsOS = 'Linux'
"All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
colorscheme serenade