-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
164 lines (127 loc) · 4.47 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
" ----------------------------------------------------------------------------
" vimrc - configure VIM editor
"
" vim:ts=4:sw=4:sts=4:et:ft=vim
" ----------------------------------------------------------------------------
execute pathogen#infect()
set nocompatible
" Check for 256 colors and set colorscheme appropriatelt
if (&term =~ "-256color")
set t_Co=256
colorscheme xoria256-lrm
else
colorscheme vividchalk
endif
set encoding=utf8
set backspace=indent,eol,start
set textwidth=78
set wrap
set number
set ruler
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set formatoptions=tcroqn
let c_no_curly_error=1
function! MyGitBranchStyle()
let branch = GitBranch()
if branch == ''
let branchStyle = ''
else
let branchStyle = 'git:' . branch
end
return branchStyle
endfunction
set statusline=%F%m%r%h%w\ (%{&ff}\ %Y\ pos=%l,%v\ %p%%\ of\ %L)\ [%n]
set laststatus=2
let g:tex_flavor = "latex"
let g:is_bash = 1
"set comments=fb:-,fb:*
"set formatlistpat=^\\s*(\\d\\+[.\\t\ ]\|[-*]\ )\\s*
"set flp=^\\(\\d\\+[.\\t\ ]\\\|[-*]\ \\\|\ \ \\)\\s* " and also recognizes two-space blockquoting
syntax on
filetype on
filetype indent on
filetype plugin on
" ---------------------------------------------------------------------------
" Keyboard mappings
" ---------------------------------------------------------------------------
" Format a line or a paragraph
nnoremap fl ^gq$
nnoremap fp {gq}
" Align text on some centering string
vnoremap fc !align -c:
" Insert the current RFC 2822 compliant date time string
inoremap \now <C-R>=strftime("%a, %d %b %Y %H:%M:%S %z")<CR>
noremap \now "=strftime("%a, %d %b %Y %H:%M:%S %z")<CR>p
noremap <silent> \slist <ESC>:SessionList<CR>
noremap <silent> \ssave <ESC>:call LRM_session_save(0)<CR>
noremap <silent> \ssaveas <ESC>:call LRM_session_save(1)<CR>
nnoremap <silent> <F2> <ESC>:NERDTreeToggle<CR>
nnoremap <silent> <F3> <ESC>:NERDTreeFind<CR>
nmap _Y :.w! ~/.vitmp<CR>
vmap _Y :w! ~/.vitmp<CR>
nmap _P :r ~/.vitmp<CR>
" ---------------------------------------------------------------------------
" Auto commands
" ---------------------------------------------------------------------------
augroup filetype
au BufRead,BufNewFile *fetchmailrc* setfiletype fetchmail
au BufRead,BufNewFile *.proto setfiletype proto
au BufRead,BufNewFile svn-commit.* setfiletype svn
au BufRead,BufNewFile wscript* setfiletype python
augroup end
au BufRead,BufNewFile *.py set autoindent ts=4 sw=4 sts=4 expandtab
au BufRead,BufNewFile *.rb set autoindent
au SessionLoadPost * call LRM_session_autoload()
au BufReadPost * call LRM_set_cursor_last_edit()
" Auto-insert file-type specific skeleton templates when creating new files.
autocmd BufNewFile *diary/*.wiki TSkeletonSetup diary.template
" Session management
set sessionoptions=blank,buffers,curdir,folds,help,localoptions,tabpages,winsize
let sessionman_save_on_exit=0
" go to the last location in the file if one exists
function! LRM_set_cursor_last_edit()
if line("'\"") > 0 && line("'\"") <= line("$")
exe "normal g'\""
endif
endfunction
function! LRM_session_save(saveas)
call LRM_wikidiary_calendar_close()
if a:saveas == 1
:SessionSaveAs
else
:SessionSave
endif
call LRM_wikidiary_calendar_open()
endfunction
" Use to auto-execute commands for specific sessions that are loaded.
function! LRM_session_autoload()
call LRM_wikidiary_calendar_open()
endfunction
function! LRM_wikidiary_calendar_open()
if v:this_session !~ 'wikidiary$'
return
endif
:CalendarH " open a horizontal calendar
:wincmd t " go to top left window
:0 " go to first line of buffer
endfunction
function! LRM_wikidiary_calendar_close()
if v:this_session !~ 'wikidiary$'
return
endif
:wincmd b " go to bottom right window
:close " close the calendar that should be there
endfunction
" Calendar Plugin
let g:calendar_weeknm = 1
" Vim Wiki
let g:vimwiki_list = [{'path': '~/Dropbox/wiki', 'path_html': '~/public_html/'}]
" Highlight lines > 80 characters
" highlight OverLength ctermbg=52 ctermfg=166
" match OverLength '\%>80v.\+'
" tSkeleton
let g:tskelDateFormat = '%a, %d %b %Y'