-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxvimrc
143 lines (105 loc) · 5.13 KB
/
xvimrc
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
autocmd InsertEnter * : silent exec "!printf '\033]50;CursorShape=2\x7'" | exec ":redraw!"
autocmd InsertLeave * : silent exec "!printf '\033]50;CursorShape=0\x7'" | exec ":redraw!"
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" " On-demand loading
" Plug 'scrooloose/nerdtree'
" Plug 'tpope/vim-surround' " Vim surround
" Plug 'berdandy/ansiesc.vim' "Ansiesc to conceal ANSI escape sequences
" Plug 'tomtom/tcomment_vim' "Commenting
" Plug 'tpope/vim-unimpaired' "Using it currently for paste toggle
" PlugInstall and PlugUpdate will clone fzf in ~/.fzf and run the install script
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Auto complete
" Plug 'davidhalter/jedi-vim' "Python autocomplete
" Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries'} " Go autocomplete
" Plug 'Blackrush/vim-gocode' " vim go-code
call plug#end()
filetype plugin indent on " required
" Encoding
set termencoding=utf-8
set encoding=utf-8
" Indent
set cindent " enable C-type indenting.
set smartindent " Do smart indenting when starting a new line
set autoindent " Copy current line's indent to new line
" Functions
function! SetTabWidth(width)
" Define all tab width specific options to the passed value
" Number of spaces to be used while indenting using '>>'/'<<'/'='.
exec 'set shiftwidth=' .a:width
" Number of spaces to be used against <Tab> in files.
exec 'set tabstop=' .a:width
" Number of spaces to be used corresponding to '<Tab>' insert.
exec 'set softtabstop='.a:width
endfunction
function! ReplaceBuffer(bang, newfile)
let curbuf = bufnr('%')
exec "e " . a:newfile
exec "bd" . a:bang . " " . curbuf
endfunction
" character
call SetTabWidth(2)
set shiftround " Round indent to multiple of 'shiftwidth'
set expandtab " Expand tab to spaces while indenting
set smarttab " This does some tab magic!
" Search
set incsearch " Search as you type
set ignorecase
set smartcase " Search case-sensitively if there's at least one capitalized letter
set nohlsearch " Do not highlight searches
" Text width
" set tw=120 " Textwidth
" set wrap " Wrap around textwidth
" set cc=+1 " Display vertical colorcolumn at `tw`+1
" Appearance
set cul " Highlight cursor line
set list " Display special chars
set listchars=tab:»\ ,trail:«,nbsp:«
" Display these chars in place of special chars
set relativenumber number " Display line no. relative to current line.
" Display abs line no. for current line.
set lazyredraw
set title " change the terminal's title
set showcmd " show (partial) command in the last line of the screen
" this also shows visual selection info
set scrolloff=2 " Always keep 4 lines off the edges when scrolling up/down
" Folding
syntax enable
set foldenable
set foldmethod=syntax " Fold based on syntax levels
set foldlevelstart=2 " Start folding from the 10th innermost block
" Which commands open a fold
set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo
" Colors
syntax on " enable syntax based highlighting
" Behaviour
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set history=1000 " remember more commands and search history
set splitright " split new windows on current window's right side
set splitbelow " split new windows below the current window
set undolevels=1000 " use many muchos levels of undo
if v:version >= 730
set undofile " keep a persistent backup file
set undodir=~/.vim/.undo,~/tmp,/tmp
endif
set nobackup " do not keep backup files, it's 70's style cluttering
set noswapfile " do not write annoying intermediate swap files,
set directory=~/.vim/.tmp,~/tmp,/tmp " store swap files in one of these directories
" Read/write a .viminfo file; retaining command-line history, registers, and many
" more things from the last session.
set viminfo='20,\"80
set wildmode=longest,list,full " Match longest substr, list all matches, complete next full
set wildmenu " make tab completion for files/buffers act like bash
set wildignore=*.swp,*.bak,*.pyc,*.class
set noerrorbells " don't beep
set timeoutlen=500 " wait time(ms) for mapped key sequence to finish
set modeline " enable file-specific vim settings e.g. `# vim: set tw=0:`
set modelines=5 " look for file-specific settings in these many lines
"Key Remaps
" Standard Keys
nnoremap ; :
nnoremap : ;
" Leader key maps
" Use ',' as leader key instead of '\'
let mapleader = ","