| 1 |
" To use it, copy it to |
|---|
| 2 |
" for Unix and OS/2: ~/.vimrc |
|---|
| 3 |
" for Amiga: s:.vimrc |
|---|
| 4 |
" for MS-DOS and Win32: $VIM\_vimrc |
|---|
| 5 |
" for OpenVMS: sys$login:.vimrc |
|---|
| 6 |
|
|---|
| 7 |
" When started as "evim", evim.vim will already have done these settings. |
|---|
| 8 |
if v:progname =~? "evim" |
|---|
| 9 |
finish |
|---|
| 10 |
endif |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
" Use Vim settings, rather then Vi settings (much better!). |
|---|
| 15 |
" This must be first, because it changes other options as a side effect. |
|---|
| 16 |
set nocompatible |
|---|
| 17 |
set ch=2 |
|---|
| 18 |
" allow backspacing over everything in insert mode |
|---|
| 19 |
set backspace=indent,eol,start |
|---|
| 20 |
set t_kD=[3~ |
|---|
| 21 |
if $TERM_PROGRAM =~? "Apple_Terminal" |
|---|
| 22 |
set t_kb= |
|---|
| 23 |
else |
|---|
| 24 |
set t_kb= |
|---|
| 25 |
endif |
|---|
| 26 |
|
|---|
| 27 |
if has("vms") |
|---|
| 28 |
set nobackup " do not keep a backup file, use versions instead |
|---|
| 29 |
" else |
|---|
| 30 |
" set backup " keep a backup file |
|---|
| 31 |
endif |
|---|
| 32 |
set history=50 " keep 50 lines of command line history |
|---|
| 33 |
set ruler " show the cursor position all the time |
|---|
| 34 |
set showcmd " display incomplete commands |
|---|
| 35 |
set incsearch " do incremental searching |
|---|
| 36 |
set hlsearch |
|---|
| 37 |
|
|---|
| 38 |
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries |
|---|
| 39 |
" let &guioptions = substitute(&guioptions, "t", "", "g") |
|---|
| 40 |
|
|---|
| 41 |
" Don't use Ex mode, use Q for formatting |
|---|
| 42 |
map Q gq |
|---|
| 43 |
|
|---|
| 44 |
" This is an alternative that also works in block mode, but the deleted |
|---|
| 45 |
" text is lost and it only works for putting the current register. |
|---|
| 46 |
"vnoremap p "_dp |
|---|
| 47 |
|
|---|
| 48 |
" Switch syntax highlighting on, when the terminal has colors |
|---|
| 49 |
" Also switch on highlighting the last used search pattern. |
|---|
| 50 |
if &t_Co > 2 || has("gui_running") |
|---|
| 51 |
syntax on |
|---|
| 52 |
set hlsearch |
|---|
| 53 |
endif |
|---|
| 54 |
|
|---|
| 55 |
" Only do this part when compiled with support for autocommands. |
|---|
| 56 |
if has("autocmd") |
|---|
| 57 |
" Enable file type detection. |
|---|
| 58 |
" Use the default filetype settings, so that mail gets 'tw' set to 72, |
|---|
| 59 |
" 'cindent' is on in C files, etc. |
|---|
| 60 |
" Also load indent files, to automatically do language-dependent indenting. |
|---|
| 61 |
filetype plugin indent on |
|---|
| 62 |
|
|---|
| 63 |
" Put these in an autocmd group, so that we can delete them easily. |
|---|
| 64 |
augroup vimrcEx |
|---|
| 65 |
au! |
|---|
| 66 |
|
|---|
| 67 |
" For all text files set 'textwidth' to 78 characters. |
|---|
| 68 |
autocmd FileType text setlocal textwidth=78 |
|---|
| 69 |
|
|---|
| 70 |
" When editing a file, always jump to the last known cursor position. |
|---|
| 71 |
" Don't do it when the position is invalid or when inside an event handler |
|---|
| 72 |
" (happens when dropping a file on gvim). |
|---|
| 73 |
autocmd BufReadPost * |
|---|
| 74 |
\ if line("'\"") > 0 && line("'\"") <= line("$") | |
|---|
| 75 |
\ exe "normal g`\"" | |
|---|
| 76 |
\ endif |
|---|
| 77 |
|
|---|
| 78 |
augroup END |
|---|
| 79 |
"else |
|---|
| 80 |
"set autoindent " always set autoindenting on |
|---|
| 81 |
endif " has("autocmd") |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
" these require the NERD_comments modules |
|---|
| 85 |
map ,c <leader>cl |
|---|
| 86 |
map ,d <leader>cu |
|---|
| 87 |
|
|---|
| 88 |
" this is for folding |
|---|
| 89 |
"map zz zA |
|---|
| 90 |
map zz za |
|---|
| 91 |
au BufWinLeave *.js mkview |
|---|
| 92 |
au BufWinEnter *.js silent loadview |
|---|
| 93 |
au BufWinLeave *.xul mkview |
|---|
| 94 |
au BufWinEnter *.xul silent loadview |
|---|
| 95 |
au BufWinLeave *.xml mkview |
|---|
| 96 |
au BufWinEnter *.xml silent loadview |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
" quick buffers |
|---|
| 101 |
"noremap <C-n> :bnext<CR> |
|---|
| 102 |
"noremap <C-p> :bprev<CR> |
|---|
| 103 |
|
|---|
| 104 |
" tabs! |
|---|
| 105 |
noremap [2C :tabnext<CR> |
|---|
| 106 |
noremap [2D :tabprevious<CR> |
|---|
| 107 |
noremap :tabnew<CR> |
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
"" lhs comments |
|---|
| 111 |
"map ,# :s/^/#/<CR> <Esc>:nohlsearch <CR> |
|---|
| 112 |
"map ,/ :s/^/\/\//<CR> <Esc>:nohlsearch <CR> |
|---|
| 113 |
"map ,> :s/^/> /<CR> <Esc>:nohlsearch<CR> |
|---|
| 114 |
"map ," :s/^/\"/<CR> <Esc>:nohlsearch<CR> |
|---|
| 115 |
"map ,% :s/^/%/<CR> <Esc>:nohlsearch<CR> |
|---|
| 116 |
"map ,! :s/^/!/<CR> <Esc>:nohlsearch<CR> |
|---|
| 117 |
"map ,; :s/^/;/<CR> <Esc>:nohlsearch<CR> |
|---|
| 118 |
"map ,- :s/^/--/<CR> <Esc>:nohlsearch<CR> |
|---|
| 119 |
"map ,c :s/^\/\/\\|^--\\|^> \\|^[#"%!;]//<CR> <Esc>:nohlsearch<CR> |
|---|
| 120 |
" |
|---|
| 121 |
"" wrapping comments |
|---|
| 122 |
"map ,* :s/^\(.*\)$/\/\* \1 \*\//<CR> <Esc>:nohlsearch<CR> |
|---|
| 123 |
"map ,( :s/^\(.*\)$/\(\* \1 \*\)/<CR><Esc>:nohlsearch <CR> |
|---|
| 124 |
"map ,< :s/^\(.*\)$/<!-- \1 -->/<CR> <Esc>:nohlsearch<CR> |
|---|
| 125 |
"map ,d :s/^\([/(]\*\\|<!--\) \(.*\) \(\*[/)]\\|-->\)$/\2/<CR> <Esc>:nohlsearch<CR> |
|---|
| 126 |
|
|---|
| 127 |
set tabstop=2 |
|---|
| 128 |
set expandtab |
|---|
| 129 |
set shiftwidth=2 |
|---|
| 130 |
set softtabstop=2 |
|---|
| 131 |
set smartindent |
|---|
| 132 |
|
|---|
| 133 |
set encoding=utf8 |
|---|
| 134 |
set fileencoding=utf8 |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
let g:snip_start_tag = "@" |
|---|
| 138 |
let g:snip_end_tag = "@" |
|---|
| 139 |
imap <Plug>Jumper |
|---|
| 140 |
|
|---|
| 141 |
"function InsertTabWrapper() |
|---|
| 142 |
" let col = col('.') - 1 |
|---|
| 143 |
" if !col || getline('.')[col - 1] !~ '\k' |
|---|
| 144 |
" return "\<tab>" |
|---|
| 145 |
" else |
|---|
| 146 |
" return "\<c-p>" |
|---|
| 147 |
" endif |
|---|
| 148 |
"endfunction |
|---|
| 149 |
"inoremap <tab> <c-r>=InsertTabWrapper()<cr> |
|---|
| 150 |
" |
|---|
| 151 |
|
|---|
| 152 |
function NewPost() |
|---|
| 153 |
new +set\ syntax=mkd |
|---|
| 154 |
endfunction |
|---|
| 155 |
|
|---|
| 156 |
function Publish (Which, Pubb) |
|---|
| 157 |
exe "python which = '" . a:Which . "'" |
|---|
| 158 |
exe "python publish = " . a:Pubb |
|---|
| 159 |
python << END |
|---|
| 160 |
import vim |
|---|
| 161 |
import os.path |
|---|
| 162 |
import xmlrpclib |
|---|
| 163 |
import re |
|---|
| 164 |
f = os.path.expanduser("~/.%s"%(which)) |
|---|
| 165 |
f = open(f).read() |
|---|
| 166 |
f = f.splitlines() |
|---|
| 167 |
s = xmlrpclib.ServerProxy(f[0]) |
|---|
| 168 |
b = f[1] |
|---|
| 169 |
u = f[2] |
|---|
| 170 |
p = f[3] |
|---|
| 171 |
|
|---|
| 172 |
RE_TITLE = re.compile("""title:\s+(.*)$""", re.I) |
|---|
| 173 |
content = [] |
|---|
| 174 |
title = None |
|---|
| 175 |
for l in vim.current.buffer: |
|---|
| 176 |
m = RE_TITLE.match(l) |
|---|
| 177 |
if m: |
|---|
| 178 |
title = m.groups(1) |
|---|
| 179 |
else: |
|---|
| 180 |
content.append(l) |
|---|
| 181 |
|
|---|
| 182 |
if title: |
|---|
| 183 |
content = "<title>%s</title>%s"%(title, "\n".join(content)) |
|---|
| 184 |
|
|---|
| 185 |
o = s.blogger.newPost('', b, u, p, content, publish) |
|---|
| 186 |
print o |
|---|
| 187 |
END |
|---|
| 188 |
endfunction |
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
" l10n stuff... now that i am in dutch |
|---|
| 192 |
set langmenu=none |
|---|
| 193 |
|
|---|
| 194 |
"let javaScript_fold=1 |
|---|