Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filetype off
- set nocompatible
- filetype plugin indent on
- filetype on
- syntax on
- let &t_SI = "\033]12;orange\007"
- let &t_EI = "\033]12;white\007"
- autocmd VimLeave * :!echo -ne "\033]12;white\007"
- autocmd!
- if &term =~ 'xterm'
- set t_kd=<Down>
- set t_ku=<Up>
- set t_kr=<Right>
- set t_kl=<Left>
- if $COLORTERM == 'gnome-terminal' || $COLORTERM == 'xfce4-terminal'
- set term=linux
- set t_RV=
- set t_Co=256
- if has("autocmd")
- au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
- au InsertEnter,InsertChange *
- \ if v:insertmode == 'i' |
- \ silent execute '!echo -ne "\e[6 q"' | redraw! |
- \ elseif v:insertmode == 'r' |
- \ silent execute '!echo -ne "\e[4 q"' | redraw! |
- \ endif
- au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
- endif
- elseif $COLORTERM == ''
- execute 'set t_kb=' . nr2char(8)
- fixdel
- endif
- endif
- nmap <ESC>oA <ESC>k
- nmap <ESC>oB <ESC>j
- nmap <ESC>oC <ESC>l
- nmap <ESC>oD <ESC>h
- if has("unix")
- let s:uname = system("uname -s")
- if s:uname == "Darwin"
- let &t_SI = "\<Esc>P\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
- let &t_EI = "\<Esc>P\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\""
- endif
- endif
- :au FocusGained * call getchar(0)
- set history=5000
- set noundofile
- set undolevels=5000
- set undodir=~/.vim/undodir
- set viminfo=!,/100,'100,r/mnt/zip,r/mnt/floppy,f1,h,\"100,:1000,n$HOME/.vim/.viminfo
- set complete=.,w,b,u,U,i
- if has("unix")
- set dictionary=/usr/share/dict/words
- set complete+=k
- endif
- colorscheme darkblue
- set completeopt=menu
- set wildmenu
- set wildmode=list:longest,full
- set wildignore+=*/.vim/undodir/*,.git/*,*/*~,_*
- set shortmess+=r
- set showmode
- set showcmd
- set mouse=a
- set modeline
- set nowrap
- set ruler
- set nosol
- set nu
- set scrolloff=9
- set novisualbell
- if exists("+autochdir")
- set autochdir
- endif
- set lazyredraw
- set hidden
- set nojoinspaces
- set shiftwidth=2
- set shiftround
- set autoindent
- set splitright
- set hls
- set formatoptions-=ta
- set textwidth=79
- set cpoptions+=ly
- if has('cryptv')
- set cryptmethod=blowfish " blowfish
- endif
- nmap <leader>l :set list!<CR>
- if has("unix")
- set listchars+=tab:▸\ ,eol:¬,trail:·
- endif
- set comments+=b:\"
- set comments+=n::
- augroup filetype
- autocmd BufNewFile * setlocal filetype=txt
- autocmd BufEnter * if &filetype == "" | setlocal filetype=txt | endif
- autocmd VimEnter *popsci.com* set filetype=markdown
- autocmd VimEnter *popsci.com* :call Bupname()
- augroup END
- fun! Bupname()
- let l:curfile = "$HOME/.vim/backups/" . expand("%:t:") . "_BACKUP.html"
- silent execute 'write' l:curfile
- endfun
- autocmd FileType css set smartindent
- autocmd FileType txt if &statusline !~ "WC: " | setlocal statusline+=\ \ WC:\ %{WordCount()}\
- autocmd BufEnter * if &filetype == "help" | let &statusline = mystatusline | endif
- autocmd BufWritePost vimrc source $MYVIMRC | source $MYGVIMRC
- autocmd BufWritePost .vimrc source $MYVIMRC | source $MYGVIMRC
- autocmd FileType html set formatoptions+=tl
- autocmd FileType mail set formatoptions+=a
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
- autocmd FileType vim set commentstring=\"%s
- augroup textobj_quote
- autocmd!
- autocmd FileType markdown call textobj#quote#init() | call textobj#sentence#init()
- autocmd FileType text call textobj#quote#init({'educate': 0}) | call textobj#sentence#init()
- augroup END
- augroup textobj_sentence
- autocmd!
- autocmd FileType markdown call textobj#sentence#init()
- autocmd FileType textile call textobj#sentence#init()
- autocmd FileType text call textobj#sentence#init()
- augroup END
- set ignorecase
- set smartcase
- set incsearch
- set whichwrap=h,l,~,[,],<,>
- set matchpairs+=<:>
- set matchpairs+=':'
- set matchpairs+=":"
- let loaded_matchparen = 0
- nnoremap <F1> :help<Space>
- vmap <F1> <C-C><F1>
- omap <F1> <C-C><F1>
- map! <F1> <C-C><F1>
- nnoremap Q gw/^>*\s*$<Enter>
- vnoremap Q gq
- vnoremap <C-T> >
- vnoremap <C-D> <LT>
- vnoremap <Tab> <C-T>
- vnoremap <S-Tab> <C-D>
- noremap Y y$
- nnoremap \tp :set invpaste paste?<CR>
- nmap <F4> \tp
- imap <F4> <C-O>\tp
- set pastetoggle=<F4>
- nnoremap <F6> :call Vsplittoggle()<CR>
- inoremap <F6> <C-O>:call Vsplittoggle()<CR>
- function! Vsplittoggle()
- let win_num = winnr('$')
- if win_num == 1
- vnew
- set nonumber
- wincmd h
- else
- only
- endif
- endfunction
- set lbr
- set wrap
- set wrap linebreak textwidth=0
- inoremap <Up> <C-o>gk
- inoremap <Down> <C-o>gj
- nnoremap <Up> gk
- nnoremap <Down> gj
- noremap <S-Down> gj
- noremap <S-Up> gk
- inoremap <S-Down> <C-O>gh<C-O>gj
- inoremap <S-Up> <C-O>gh<C-O>gk
- nnoremap <S-Down> gh<C-O>gj
- nnoremap <S-Up> gh<C-O>gk
- inoremap <expr> <Down> pumvisible()?"\<C-N>":"\<Down>"
- inoremap <expr> <Up> pumvisible()?"\<C-P>":"\<Up>"
- inoremap <expr> <PageDown> pumvisible()?"\<PageDown>\<C-P>\<C-N>":"\<PageDown>"
- inoremap <expr> <PageUp> pumvisible()?"\<PageUp>\<C-P>\<C-N>":"\<PageUp>"
- noremap <Space> /
- nmap <Space> /
- omap <Space> /
- nnoremap <CR> i<CR>
- nnoremap <Del> i<Del>
- nnoremap <BS> i<BS>
- nnoremap <Enter> i<Enter>
- nnoremap <C-z> zz
- nnoremap Z zz
- nnoremap Za za
- nnoremap Zb zb
- nnoremap Zc zc
- nnoremap Zd zd
- nnoremap Ze ze
- nnoremap Zf zf
- nnoremap Zg zg
- nnoremap Zh zh
- nnoremap Zi zi
- nnoremap Zj zj
- nnoremap Zk zk
- nnoremap Zl zl
- nnoremap Zm zm
- nnoremap Zn zn
- nnoremap Zo zo
- nnoremap Zp zp
- nnoremap Zq zq
- nnoremap Zr zr
- nnoremap Zs zs
- nnoremap Zt zt
- nnoremap Zu zu
- nnoremap Zv zv
- nnoremap Zw zw
- nnoremap Zx zx
- nnoremap Zy zy
- nnoremap Zz zz
- nnoremap Z. z.
- nnoremap Z- z-
- nnoremap Z<CR> z<CR>
- nnoremap za <Nop>
- nnoremap zb <Nop>
- nnoremap zc <Nop>
- nnoremap zd <Nop>
- nnoremap ze <Nop>
- nnoremap zf <Nop>
- nnoremap zg <Nop>
- nnoremap zh <Nop>
- nnoremap zi <Nop>
- nnoremap zj <Nop>
- nnoremap zk <Nop>
- nnoremap zl <Nop>
- nnoremap zm <Nop>
- nnoremap zn <Nop>
- nnoremap zo <Nop>
- nnoremap zp <Nop>
- nnoremap zq <Nop>
- nnoremap zr <Nop>
- nnoremap zs <Nop>
- nnoremap zt <Nop>
- nnoremap zu <Nop>
- nnoremap zv <Nop>
- nnoremap zw <Nop>
- nnoremap zx <Nop>
- nnoremap zy <Nop>
- nnoremap zz u
- nnoremap z- <Nop>
- nnoremap z. <Nop>
- nnoremap z<CR> <Nop>
- nnoremap z0 <Nop>
- nnoremap z1 <Nop>
- nnoremap z2 <Nop>
- nnoremap z3 <Nop>
- nnoremap z4 <Nop>
- nnoremap z5 <Nop>
- nnoremap z6 <Nop>
- nnoremap z7 <Nop>
- nnoremap z8 <Nop>
- nnoremap z9 <Nop>
- nnoremap z^ <Nop>
- nnoremap z<Up> <Nop>
- nnoremap z<Down> <Nop>
- nnoremap z<Left> <Nop>
- nnoremap z<Right> <Nop>
- inoremap <S-Esc> <Esc>l
- inoremap kj <Esc>
- nnoremap <C-S-u> maO<esc>`a
- nnoremap <C-u> mao<esc>`a
- nnoremap @ q
- nnoremap <Leader>@ q
- nnoremap q @
- nnoremap qq @@
- nnoremap :: :<C-f>
- nnoremap :? :<C-f>?
- nnoremap ; :
- nnoremap , ;
- cabbrev vh vertical help
- let b:surround_105 = "_\r_"
- let b:surround_98 = "__\r__"
- let b:surround_97 = "\[\r]\(\1url: \1)"
- autocmd FileType html let g:surround_105 = "<i>\r</i>"
- autocmd FileType html let g:surround_98 = "<b>\r</b>"
- autocmd FileType html let g:surround_97 = "<a\1url: \r..*\r href=\"&\"\1 target=\"_blank\">\r</a>"
- hi FixHere ctermfg=Red guifg=Red
- let w:m2=matchadd('FixHere', '@@', -1)
- func! CompileGcc()
- exec "w"
- exec "!gcc % -o %<"
- endfunc
- func! CompileRunGcc()
- exec "w"
- exec "!gcc % -o %<"
- exec "! ./%<"
- endfunc
- set selectmode= " same as mswin
- set mousemodel=popup " same as mswin and dos/win default
- set keymodel=startsel " halfway compromise
- set selection=inclusive " same as xterm and default
- set virtualedit=block,onemore
- if has("win32")
- let g:netrw_cygwin=0
- let g:netrw_scp_cmd = "C:\\LocalApps\\Putty\\pscp.exe -q "
- let g:netrw_cursorline=1
- let g:netrw_silent = 1
- :au FocusGained * call getchar(0)
- endif
- let g:netrw_cursorline=0
- let g:netrw_list_hide= '^\..*'
- set backspace=indent,eol,start whichwrap+=<,>,[,]
- vnoremap <BS> d
- xnoremap <C-X> "+x
- xnoremap <S-Del> "+x
- xnoremap <C-C> "+y
- vnoremap <C-C> "+y
- xnoremap <C-Insert> "+y
- vnoremap <C-Insert> "+y
- map <C-V> "+gP
- map <S-Insert> "+g<Leader>P
- exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
- exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
- imap <S-Insert> <C-V>
- xmap <S-Insert> <C-V>
- noremap <C-Q> <C-V>
- cnoremap <C-Q> <C-V>
- cnoremap <C-V> <C-R>+
- noremap <C-S> :update<CR>
- vnoremap <C-S> <C-C>:update<CR>
- inoremap <C-S> <C-O>:update<CR>
- if has("gui_running")
- :map <silent> <C-S> :if expand("%") == ""<CR>:browse confirm w<CR>:else<CR>:update<CR>:endif<CR>
- :inoremap <silent> <C-S> <C-O>:if expand("%") == ""<CR><Esc>:browse confirm w<CR>:else<CR>:update<CR>:endif<CR>
- endif
- noremap <C-O> :browse confirm e<CR>
- noremap <M-[> <C-O>
- noremap <M-]> <C-I>
- if !has("unix")
- set guioptions-=a
- endif
- if has("gui")
- noremap <M-Space> :simalt ~<CR>
- inoremap <M-Space> <C-O>:simalt ~<CR>
- cnoremap <M-Space> <C-C>:simalt ~<CR>
- endif
- nmap <C-Down> <Plug>SpeedDatingDown
- nmap <C-Up> <Plug>SpeedDatingUp
- nmap d<C-X> <Plug>SpeedDatingNowLocal
- noremap <C-A> :%y+<CR>
- noremap <C-S-A> gggH<C-O>G
- set cpo&
- nnoremap <silent> <Esc> <Esc>:nohlsearch<bar>pclose<bar>call clever_f#reset()<CR>|
- nnoremap <S-Tab> i<Tab><Esc><Right>
- vnoremap <S-Tab> >gv|
- inoremap <S-Tab> <Tab>|
- nnoremap <silent><C-j> m`:silent +g/\m^\s*$/d<CR>``:noh<CR>
- nnoremap <silent><C-k> m`:silent -g/\m^\s*$/d<CR>``:noh<CR>
- nnoremap <silent><A-j> :set paste<CR>m`o<Esc>``:set nopaste<CR>
- nnoremap <silent><A-k> :set paste<CR>m`O<Esc>``:set nopaste<CR>
- cnoremap <C-A> <Home>
- nmap - "+
- xmap - "+
- nnoremap <Leader>H H
- nnoremap <Leader>L L
- nnoremap <Leader>M M
- nnoremap H ^
- nnoremap L g_
- function! LookUpwards()
- let column_num = virtcol('.')
- let target_pattern = '\%' . column_num . 'v.'
- let target_line_num = search(target_pattern . '*\S', 'bnW')
- if !target_line_num
- return ""
- else
- return matchstr(getline(target_line_num), target_pattern)
- endif
- endfunction
- inoremap <silent> <C-Y> <C-R><C-R>=LookUpwards()<CR>
- vnoremap <silent> <buffer> J :<C-U>'<+1,'>s;^\s*\%(-\?\*\"\<bar>//\)\s*;<space>;e<bar>nohls<CR>gvJ
- nnoremap <silent> <buffer> J :<C-U>call JoinComments(v:count)<CR>
- function! JoinComments(count)
- let l:linecount = a:count
- if l:linecount < 2
- let l:linecount = 2
- endif
- echo a:count . " lines joined"
- let v:errmsg = ''
- while l:linecount > 1
- normal! J
- silent! substitute:\%#\s*\%(-\?\*\|//\)\s*: :
- silent! substitute:\%#\s*\%(>\)\s: : " for mail quote character
- silent! substitute:\%#\s*\%(\"\)\s: : " for vimrc comments
- if v:errmsg!~'Pattern not found:'
- normal! ``
- endif
- let l:linecount = l:linecount - 1
- endwhile
- nohls
- endfunction
- fu! AAa_to_Aaa()
- let c = getline(".")[0:col(".")-2]
- if c =~ '\v\C<[[:upper:]]{2}[[:lower:]]$'
- let pos = getpos('.')
- normal hh~
- call setpos('.',pos)
- endif
- endf
- :au CursorMovedI * call AAa_to_Aaa()
- function! PasteJointCharacterwise(regname, pastecmd)
- let reg_type = getregtype(a:regname)
- let l:newreg = getreg(a:regname)
- let l:newreg = substitute(l:newreg, '\n', ' ', 'g')
- let l:newreg = substitute(l:newreg, '\^', '\^ ', '')
- let l:newreg = substitute(l:newreg, '\$', ' \$', '')
- call setreg(a:regname, l:newreg, "c")
- normal! mm
- exe 'normal "'.a:regname . a:pastecmd
- . s / */ /eg
- call setreg(a:regname, '', "a".reg_type)
- exe 'normal `[v`]J'
- normal! `m
- endfunction
- nmap <leader>p :call PasteJointCharacterwise(v:register, "p")<CR>
- nmap <leader>P :call PasteJointCharacterwise(v:register, "P")<CR>
- nmap g<leader>P :call PasteJointCharacterwise(v:register, "gP")<CR>
- nmap g<leader>p :call PasteJointCharacterwise(v:register, "gp")<CR>
- let g:sentencelines = 0
- function! ToggleSentenceLines()
- if g:sentencelines
- if getline("$") !~ "^\s*$"
- $put = ''
- endif
- silent g /\w\+/ .,/^$/-1join
- let &showbreak=''
- normal gg
- let g:sentencelines = 0
- else
- silent % s /\([.!?]\+[])"”']*\)\( \{1,2}\([["“('A-Z]\)\)/\1\r\3/g
- let &showbreak=' '
- normal gg
- let g:sentencelines = 1
- endif
- endfu
- nnoremap <Leader>s :silent call ToggleSentenceLines()<CR>
- let g:prose=0
- function! ToggleProse()
- if g:prose==1
- set tw=0
- set formatoptions-=at
- if getline("$") !~ "^\s*$"
- $put = ''
- endif
- silent g /\w\+/ .,/^$/-1join
- let g:prose=0
- else
- set tw=80
- set formatoptions+=at
- let g:prose=1
- endif
- endfunction
- nmap <F5> :silent call FixQuotes()<CR>
- map <silent> <leader>qc <Plug>ReplaceWithCurly
- map <silent> <leader>qs <Plug>ReplaceWithStraight
- if !exists(":DiffOrig")
- command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
- \ | wincmd p | diffthis
- endif
- function! WordCount()
- if line('$') == 1 && getline(1) == ''
- return
- elseif mode() == "i" || mode() == "n"
- let s:old_status = v:statusmsg
- exe "silent normal g\<c-g>"
- let b:word_count = str2nr(split(v:statusmsg)[11])
- let v:statusmsg = s:old_status
- endif
- return b:word_count
- endfunction
- function! AutoFormatToggle()
- if &fo =~ 'a'
- setlocal fo-=a
- else
- setlocal fo+=a
- endif
- endfu
- map <F1> :call AutoFormatToggle()<CR>
- imap <F1> <Esc>:call AutoFormatToggle()<CR>a
- hi default link User1 Identifier
- hi default link User2 Statement
- hi default link User3 Error
- hi default link User4 Special
- autocmd ColorScheme * highlight Redd ctermfg=red guifg=red
- let mystatusline = ""
- let mystatusline .= "\ %n\ %*" | " buffer number
- let mystatusline .= "\ %<%F%*" | " full path
- let mystatusline .= "\ %y%*" | " file type
- let mystatusline .= " \%M" | " modified flag
- let mystatusline .= "\ %#vimWarn#\%{(&key==\"\"?\"\":\"ENCR\")}%*" | " encrypted?
- let mystatusline .= "\ \[%{v:register}\]" | " current register
- let mystatusline .= "\ %{getcwd()} " | " current working dir
- let mystatusline .= "%=" " left - right separator
- let mystatusline .= "0x%04B\ %*" | " character under cursor
- let mystatusline .= "\ \ \c\%v\%*" | " column number
- let mystatusline .= "/%{len(iconv(getline('.'), &encoding, 'char'))}" | " total columns
- let mystatusline .= "%7l%*" | " current line
- let mystatusline .= "/%L%*" | " total lines
- let &statusline = mystatusline
- function! WCtoggle()
- if &statusline =~ "WC: "
- setlocal statusline-=\ \ WC:\ %{WordCount()}\
- else
- setlocal statusline+=\ \ WC:\ %{WordCount()}\
- endif
- endfunction
- nnoremap <Leader>w :silent call WCtoggle()<CR>
- function! InsertStatuslineColor(mode)
- if a:mode == 'i'
- hi statusline guibg=black
- hi statusline guifg=gray
- hi statusline ctermbg=black
- hi statusline ctermfg=gray
- elseif a:mode == 'r'
- hi statusline guibg=black
- hi statusline guifg=gray
- hi statusline ctermbg=black
- hi statusline ctermfg=white
- else
- hi statusline guibg=blue
- hi statusline guifg=gray
- hi statusline ctermbg=blue
- hi statusline ctermfg=white
- endif
- endfunction
- function! InsertLeaveActions()
- hi statusline guibg=blue
- hi statusline guifg=gray
- hi statusline ctermbg=blue
- hi statusline ctermfg=white
- endfunction
- au InsertEnter * call InsertStatuslineColor(v:insertmode)
- au InsertLeave * call InsertLeaveActions()
- inoremap <c-c> <c-o>:call InsertLeaveActions()<cr><c-c>
- set laststatus=2
- hi statusline guibg=blue
- hi statusline guifg=gray
- function! FixQuotes()
- % s /--/ -- /eg
- % s /\s*--\s*/ -- /eg
- % s / - / -- /eg
- % s /`/'/eg
- % s /\%u2018/'/eg
- % s /\%u2019/'/eg
- % s /\%u0091/'/eg
- % s /\%u0092/'/eg
- % s /\%u2030/"/eg
- % s /\%u0093/"/eg
- % s /\%u0094/"/eg
- % s /\%u201c/"/eg
- % s /\%u201d/"/eg
- % s /\%u201e/"/eg
- % s /\%u201a/'/eg
- %
- % s /\s*\%u97\s*/ -- /eg
- % s /\s*—\s*/ -- /eg
- % s /\s*\%u2013\s*/ -- /eg
- % s /…/.../eg
- % s /<! -- break -- >/<!--break-->/eg
- endfunction
- cabbrev <expr>W ((getcmdtype()==':' && getcmdpos() == 1) ? 'W' : 'w')
- cabbrev <expr>Q ((getcmdtype()==':' && getcmdpos() == 1) ? 'Q' : 'q')
- cabbrev <expr>Wq ((getcmdtype()==':' && getcmdpos() == 1) ? 'Wq' : 'wq')
- au! FileType mail :nnoremap <buffer> o o<Enter><Enter><Enter><Up><Up>
- au! FileType mail :setlocal formatoptions+=a
- au! FileType help :setlocal statusline-=\ \ WC:\ %{WordCount()}\
- nnoremap <C-S-Tab> :tabprevious<CR>
- nnoremap <C-Tab> :tabnext<CR>
- noremap <C-S-Tab> :tabprevious<CR>
- noremap <C-Tab> :tabnext<CR>
- inoremap <C-S-Tab> <Esc>:tabprevious<CR>i
- inoremap <C-Tab> <Esc>:tabnext<CR>i
- nnoremap <C-t> :tabnew<CR>
- inoremap <C-t> <Esc>:tabnew<CR>
- noremap <C-F4> :tabclose<CR>
- :nmap <C-LeftMouse> :Utl ol<cr>
- :nmap H 0
- :nmap L $
- :omap H 0
- :omap L $
- func! Eatchar(pat)
- let c = nr2char(getchar())
- return (c =~ a:pat) ? '' : c
- endfunc
- :map ,c <Plug>NERDCommenterToggle
- nmap w <Plug>(smartword-w)
- nmap b <Plug>(smartword-b)
- nmap e <Plug>(smartword-e)
- nmap ge <Plug>(smartword-ge)
- :inoreab ddate <C-R>=strftime("%F")<CR>
- :cab ddate <C-R>=strftime("%F")<CR>
- noreabbrev <silent> ,p <Enter><S-Tab>Paul <Left><C-R>=Eatchar('\s')<CR>
- noreabbrev <silent> trb target="_blank" <Left><C-R>=Eatchar('\s')<CR>
- iabbrev brk <!--break-->
- inoreabbrev <silent> dmer <dme:relatedinfo side="right" /> <Left><C-R>=Eatchar('\s')<CR>
- inoreabbrev dts <C-R>=strftime("%Y-%m-%d")<CR>
- inoremap <expr> F ((col('.')>1 && getline('.')[col('.')-2]=~#'^\d$')?((getline('.')[col('.')-4]!~'\.' && getline('.')[col('.')-3]!~'\.')?(printf('°F (%d°C)', float2nr((matchstr(getline('.')[:(col('.')-2)], '\d\+$')-32)/1.8))):(printf('°F (%.1g°C)', (str2float(matchstr(getline('.')[:(col('.')-2)], '\v\-?\d+(\.\d+)?$'))-32)/1.8))):('F'))
- inoremap <expr> C ((col('.')>1 && getline('.')[col('.')-2]=~#'^\d$')?((getline('.')[col('.')-4]!~'\.' && getline('.')[col('.')-3]!~'\.')?(printf('°C (%d°F)', float2nr((matchstr(getline('.')[:(col('.')-2)], '\d\+$')*1.8)+32))):(printf('°C (%.1g°F)', (str2float(matchstr(getline('.')[:(col('.')-2)], '\v\-?\d+(\.\d+)?$'))*1.8)+32))):('C'))
- for buffer_no in range(1, 9)
- execute "nmap <A-" . buffer_no . "> :b" . buffer_no . "\<CR>"
- endfor
- if &l:filetype ==''
- set ft="html"
- endif
- set encoding =utf-8
- set formatoptions+=q
- set display=lastline
- runtime plugin/netrwPlugin.vim
- let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*'
- imap <Space> <Space><c-g>u
- onoremap <Leader>e //e<CR>
- nnoremap <Leader>e //e<CR>
- function! Smartpaste()
- let l:newreg = " "
- let l:newreg .= @@
- let l:newreg .= " "
- call setreg('@', l:newreg, "v")
- normal! mmF p
- . s / */ /eg
- normal! `m
- endfu
- nmap <C-p> :call Smartpaste()<CR>
- function! Diary()
- if has("unix")
- let l:diarydir = "~/Dropbox/notes/diary/"
- endif
- let l:diaryfilename = l:diarydir . strftime('%Y-%m-%d') . ".txt"
- silent execute 'edit' l:diaryfilename
- execute ':X'
- endfunc
- nnoremap <Leader>3 :call RomanNums()<CR>
- fun! RomanNums(...)
- let numm = (a:0 >= 1) ? a:1 : getline('.')
- if numm =~ '^\d*$'
- let numm = Arabic2roman(numm)
- elseif numm =~ '^\a*$'
- let numm = Roman2arabic(numm)
- else
- echo "Not a number."
- endif
- silent call setline('.',numm)
- endfunction
- let s:a2r = [[1000, 'm'], [900, 'cm'], [500, 'd'], [400, 'cd'], [100, 'c'],
- \ [90 , 'xc'], [50 , 'l'], [40 , 'xl'], [10 , 'x'],
- \ [9 , 'ix'], [5 , 'v'], [4 , 'iv'], [1 , 'i']]
- function! Roman2arabic(roman)
- let roman = tolower(a:roman)
- let sign = 1
- let arabic = 0
- while roman != ''
- if roman =~ '^[-n]'
- let sign = -sign
- endif
- for [numbers,letters] in s:a2r
- if roman =~ '^'.letters
- let arabic += sign * numbers
- let roman = strpart(roman,strlen(letters)-1)
- break
- endif
- endfor
- let roman = strpart(roman,1)
- endwhile
- return arabic
- endfunction
- function! Arabic2roman(arabic)
- if a:arabic <= 0
- let arabic = -a:arabic
- let roman = "n"
- else
- let arabic = a:arabic
- let roman = ""
- endif
- for [numbers, letters] in s:a2r
- let roman .= repeat(letters,arabic/numbers)
- let arabic = arabic % numbers
- endfor
- return toupper(roman)
- endfunction
- set guioptions-=T
- set guicursor+=v:hor10-Cursor
- let g:speeddating_no_mappings = 1
- xmap \\ <Plug>Commentary
- nmap \\ <Plug>Commentary
- nmap \\\ <Plug>CommentaryLine
- nmap \\u <Plug>CommentaryUndo
- let g:force_reload_textobj_sentence = 0
- let g:bullets_enabled_file_types = ['markdown', 'text', 'txt', 'gitcommit']
- let g:syntastic_mode_map = { 'mode': 'passive',
- \ 'active_filetypes': ['', ''],
- \ 'passive_filetypes': ['puppet'] }
- let g:pad_use_default_mappings = 0
- let g:pad_format = "txt"
- let g:pad_dir = "~/.vim/vimpad"
- let g:vimroom_clear_line_numbers = 0
- let g:vimroom_sidebar_height = 0
- nmap <silent> <Leader>v <Plug>VimroomToggle
- let g:goyo_linenr = 1
- let g:goyo_width = 115
- let g:goyo_margin_bottom = 0
- nnoremap <Leader>g :Goyo<CR>
- let g:peekaboo_prefix = '<leader>'
- let g:peekaboo_ins_prefix = '<c-x>'
- let g:peekaboo_window = 'vertical botright 70new'
- let g:limelight_paragraph_span = 1
- let g:clever_f_smart_case=1
- let g:clever_f_fix_key_direction=1
- let g:clever_f_chars_match_any_signs=";"
- let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
- let g:ctrlp_clear_cache_on_exit = 0
- let g:ctrlp_custom_ignore = 'itsalltext'
- let g:ctrlp_map = '<Leader>t'
- nnoremap <Leader>r :CtrlPMRU<CR>
- let g:ctrlp_working_path_mode = 0
- let g:ctrlp_match_window_reversed = 0
- let g:ctrlp_match_window = "bottom,order:btt.min:8,max:15"
- let g:ctrlp_max_files = 20000
- let g:ctrlp_default_input = 1
- let g:ctrlp_dotfiles = 0
- let g:ctrlp_prompt_mappings = {
- \ 'ToggleType(1)': ['<c-f>', '<c-up>', '<right>' ],
- \ 'ToggleType(-1)': ['<c-b>', '<c-down>', '<left>'],
- \ 'PrtCurLeft()': ['<c-h>'],
- \ 'PrtCurRight()': ['<c-l>'],
- \ }
- let g:ctrlp_extensions = ['dir']
- let g:snips_trigger_key='<c-\>'
- let g:ackprg = "ag --vimgrep"
- let g:ack_qhandler = "leftabove copen 35"
- let g:notes_suffix = '.txt'
- let g:notes_smart_quotes = 0
- if has('gui_running')
- autocmd BufEnter * sign define dummy
- autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
- if has("win32")
- set guifont=Fixed:h9:cANSI
- set guifontwide=Lucida\ Console:h9
- set ambiwidth=double
- set lines=70
- set columns=212
- au GUIEnter * simalt ~x
- elseif has("mac")
- set columns=200
- set lines=65
- set noantialias
- else
- set guifont=Fixed\ 11
- set lines=33
- set columns=110
- endif
- else
- nmap <Down> <Down>
- nmap <Up> <Up>
- nmap <Left> <Left>
- nmap <Right> <Right>
- endif
- cnoremap <Up> <Up>
- cnoremap <Down> <Down>
- cnoremap <Left> <Left>
- cnoremap <Right> <Right>
- let g:nv_directories = ['/home/eater/Dropbox/notes/', '/home/eater/Dropbox/Work/cooksscience/notes/']
- let g:nv_default_extension = '.txt'
- let g:nv_main_directory = g:nv_directories[0] " default is first in directory list
- nnoremap <Leader>n :NV<CR>
- if has("mac")
- set rtp+=/Users/padams/homebrew/opt/fzf
- endif
- call plug#begin('~/.vim/plugged')
- Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
- Plug 'junegunn/fzf.vim'
- Plug 'vim-scripts/MPage'
- Plug 'Alok/notational-fzf-vim'
- Plug 'pbogut/fzf-mru.vim'
- Plug 'justinmk/vim-dirvish'
- Plug 'kshenoy/vim-signature'
- Plug 'tpope/vim-speeddating'
- Plug 'tpope/vim-surround'
- Plug 'tpope/vim-repeat'
- Plug 'tpope/vim-unimpaired'
- Plug 'tpope/vim-commentary'
- Plug 'tpope/vim-fugitive'
- Plug 'tpope/vim-markdown'
- Plug 'mbbill/undotree'
- Plug 'tmhedberg/matchit'
- Plug 'godlygeek/CSApprox'
- Plug 'junegunn/goyo.vim'
- Plug 'junegunn/vim-peekaboo'
- Plug 'junegunn/vim-plug'
- Plug 'inkarkat/Smartput'
- Plug 'skammer/vim-css-color'
- Plug 'gregsexton/MatchTag'
- Plug 'kana/vim-textobj-user'
- Plug 'kana/vim-smartword'
- Plug 'kana/vim-textobj-lastpat'
- Plug 'reedes/vim-textobj-quote'
- Plug 'reedes/vim-textobj-sentence'
- Plug 'beloglazov/vim-textobj-punctuation'
- Plug 'jamessan/vim-gnupg'
- Plug 'arecarn/crunch'
- Plug 'bling/vim-bufferline'
- Plug 'rhysd/clever-f.vim'
- Plug 'mileszs/ack.vim'
- Plug 'clarke/vim-renumber'
- Plug 'MarcWeber/vim-addon-mw-utils'
- Plug 'tomtom/tlib_vim'
- Plug 'vim-scripts/closetag.vim'
- Plug 'vim-scripts/utl.vim'
- Plug 'vim-scripts/RelOps'
- Plug 'vim-scripts/allfold'
- Plug 'dkarter/bullets.vim', { 'frozen' : 1 }
- call plug#end()
- nnoremap <silent> <Leader>f :Files<cr>
- nnoremap <silent> <Leader>d :FZFMru<cr>
- nnoremap <silent> <Leader>b :Lines<cr>
- nnoremap <silent> <Leader>c :FCD<cr>
- function! s:escape(path)
- return substitute(a:path, ' ', '\\ ', 'g')
- endfunction
- function! AgHandler(line)
- let parts = split(a:line, ':')
- let [fn, lno] = parts[0 : 1]
- execute 'e '. s:escape(fn)
- execute lno
- normal! zz
- endfunction
- command! -nargs=+ Fag call fzf#run({
- \ 'source': 'ag --depth=2 -l -t "<args>"',
- \ 'sink': function('AgHandler'),
- \ 'options': '+m',
- \ 'tmux_height': '60%'
- \ })
- command! -nargs=? FCD call fzf#run({
- \ 'source': 'find ~/** -type d -print 2>/dev/null',
- \ 'sink': 'cd' ,
- \ 'tmux_height': '60%' ,
- \ 'options': '-q "<args>" -m --prompt "Directory> "',
- \ })
- let g:WriteBackup_BackupDir = '~/.vim/backups'
- let $SWAPDIR = '~/.vim/backups/swap//'
- set directory^=~/.vim/backups/swap//
- syntax on "seems to work best at the end here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement