Repository navigation
Expand file tree
/
Copy pathvimrc_example
More file actions
118 lines (96 loc) · 3.38 KB
/
Copy pathvimrc_example
File metadata and controls
118 lines (96 loc) · 3.38 KB
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
" Place this file into your $HOME directory and edit at your will
" This should be included to enable some common setups
source ~/.vim/vimrc_global
" I prefer dark backgrounds
set background=dark
"display tabs and trailing spaces
set list
set listchars=tab:»-,extends:>,precedes:<,trail:·
set formatoptions-=o "dont continue comments when pushing o/O
"indent settings
set shiftwidth=2
set softtabstop=2
set expandtab
set autoindent
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
set nofoldenable "dont fold by default
set foldcolumn=1 "columns to show point of folding
set wildmode=list:longest "make cmdline tab completion similar to bash
set wildmenu "enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
"vertical/horizontal scroll off settings
set scrolloff=3
set sidescrolloff=7
set sidescroll=1
set number "show line numbers
"set nowrap "dont wrap lines
set linebreak "wrap lines at convenient points
"only status line setup open to details
source ~/.vim/status_line_setup.vim
"mark syntax errors with :signs
let g:syntastic_enable_signs=1
" set default colorscheme
" Use :SCROLLCOLOR to see all colors
colorscheme vibrantink
" Setting ctermbg to none so the transparent background from gnome-terminal works for vibrantink
highlight Normal ctermbg=none
function ClearTrailingSpaces() range
let number_of_trailing_spaces = search('\s\+$', 'nw')
let has_trailing_spaces = number_of_trailing_spaces != 0
if has_trailing_spaces
if a:firstline == a:lastline
let rang = '%'
else
let rang = a:firstline .','. a:lastline
endif
let save_cursor = getpos(".")
execute rang . 's/\s\+$//g'
echo "lines cleared"
call setpos('.', save_cursor)
else
echo "no trailing spaces found"
endif
endfunction
command -range ClearTrailingSpaces <line1>,<line2>call ClearTrailingSpaces()
function! ChangeFileencoding()
" Add more encodings here
let encodings = ['latin1', 'utf8']
let prompt_encs = []
let index = 0
while index < len(encodings)
call add(prompt_encs, index.'. '.encodings[index])
let index = index + 1
endwhile
let choice = inputlist(prompt_encs)
if choice >= 0 && choice < len(encodings)
execute 'e ++enc='.encodings[choice].' %:p'
endif
endf
nmap <F8> :call ChangeFileencoding()<CR>
" Enable Specky
let g:speckyBannerKey = "\sb"
let g:speckyQuoteSwitcherKey = "\sq"
let g:speckyRunRdocKey = "\sd"
let g:speckySpecSwitcherKey = "\sx"
let g:speckyRunSpecKey = "\ss"
let g:speckyRunSpecCmd = "spec -cfs"
"-r loadpath.rb"
let g:speckyRunRdocCmd = "ri -L -f plain"
let g:speckyWindowType = 2
"##############################################################################
"### M A P P I N G S
"##############################################################################
" Mapping leader_key (defaults to \) + p to show NERDTree.
" \p -> toggle NERDTree
map <silent> <Leader>p <Esc>:NERDTreeToggle<CR>
" Mapping CTRL + F; in normal, visual, insert and command modes;
" to show Command-T
map <silent> <C-F> <Esc>:CommandT<CR>
map! <silent> <C-F> <Esc>:CommandT<CR>
" Mapping CTRL + B to show BufferExplorer
nmap <silent> <C-B> :BufExplorer<CR>
" Mapping gb to work like gt(switch tabs) but with buffers
map gb :bn<cr>
set runtimepath^=~/.vim/bundle/ctrlp.vim