diff options
Diffstat (limited to 'vim/plugin')
-rw-r--r-- | vim/plugin/dircreate.vim | 31 | ||||
-rw-r--r-- | vim/plugin/eolws.vim | 6 | ||||
-rw-r--r-- | vim/plugin/keywordprg.vim | 33 | ||||
-rw-r--r-- | vim/plugin/nopaste.vim | 19 | ||||
-rw-r--r-- | vim/plugin/opinionated-defaults.vim | 157 | ||||
-rw-r--r-- | vim/plugin/rainbow_paren.vim | 96 |
6 files changed, 0 insertions, 342 deletions
diff --git a/vim/plugin/dircreate.vim b/vim/plugin/dircreate.vim deleted file mode 100644 index 11da7f9..0000000 --- a/vim/plugin/dircreate.vim +++ /dev/null @@ -1,31 +0,0 @@ -function! s:ensure_dir_exists() - let l:required_dir = expand("%:h") - if !isdirectory(l:required_dir) - if <SID>ask_quit("Directory '" . l:required_dir . "' doesn't exist.", "&Create it?") - return - endif - - try - call mkdir(l:required_dir, 'p') - catch - call <SID>ask_quit("Can't create '" . l:required_dir . "'", "&Continue anyway?") - endtry - endif -endfunction - -function! s:ask_quit(msg, proposed_action) - if confirm(a:msg, "&Quit?\n" . a:proposed_action) == 1 - if len(getbufinfo()) > 1 - silent bd - return 1 - else - exit - end - endif - return 0 -endfunction - -augroup dircreate - autocmd! - autocmd BufNewFile * call <SID>ensure_dir_exists() -augroup END diff --git a/vim/plugin/eolws.vim b/vim/plugin/eolws.vim deleted file mode 100644 index 1f1a003..0000000 --- a/vim/plugin/eolws.vim +++ /dev/null @@ -1,6 +0,0 @@ -augroup eolws - autocmd! - autocmd InsertEnter * syn clear EOLWS | syn match EOLWS excludenl /\s\+\%#\@!$/ - autocmd InsertLeave * syn clear EOLWS | syn match EOLWS excludenl /\s\+$/ -augroup END -highlight EOLWS ctermbg=red guibg=red diff --git a/vim/plugin/keywordprg.vim b/vim/plugin/keywordprg.vim deleted file mode 100644 index dfedd80..0000000 --- a/vim/plugin/keywordprg.vim +++ /dev/null @@ -1,33 +0,0 @@ -function! Help(visual, iskeyword, command) - let l:iskeyword = &iskeyword - for l:kw in a:iskeyword - exe 'set iskeyword+=' . l:kw - endfor - if a:visual - let l:oldreg = @a - normal! gv"aygv - let l:word = @a - let @a = l:oldreg - else - let l:word = expand('<cword>') - endif - let &iskeyword = l:iskeyword - - exe 'noswapfile ' . &helpheight . 'new ' . l:word - setlocal buftype=nofile - setlocal bufhidden=wipe - setlocal nobuflisted - - setlocal modifiable - exe 'call ' . a:command . '("' . l:word . '")' - normal! ggdd - setlocal nomodifiable -endfunction - -function! s:man(word) - exe 'silent read! man -Pcat ' . a:word - setlocal filetype=man -endfunction - -nnoremap <silent>K :call Help(0, [], '<SID>man')<CR> -xnoremap <silent>K :call Help(1, [], '<SID>man')<CR> diff --git a/vim/plugin/nopaste.vim b/vim/plugin/nopaste.vim deleted file mode 100644 index cb904f7..0000000 --- a/vim/plugin/nopaste.vim +++ /dev/null @@ -1,19 +0,0 @@ -function! s:nopaste(visual) - if a:visual - silent normal! gv:!nopaste<CR> - else - let l:pos = getpos('.') - silent normal! :%!nopaste<CR> - endif - silent normal! "+yy - let @* = @+ - silent undo - " can't restore visual selection because that will overwrite "* - if !a:visual - call setpos('.', l:pos) - endif - echo @+ -endfunction - -nnoremap <silent><Leader>p :call <SID>nopaste(0)<CR> -xnoremap <silent><Leader>p :<C-U>call <SID>nopaste(1)<CR> diff --git a/vim/plugin/opinionated-defaults.vim b/vim/plugin/opinionated-defaults.vim deleted file mode 100644 index 87eaf57..0000000 --- a/vim/plugin/opinionated-defaults.vim +++ /dev/null @@ -1,157 +0,0 @@ -""" GENERAL """ -set nocompatible -syntax on -filetype indent plugin on -augroup opinionated_defaults - autocmd! -augroup END - - -""" PERSISTENCE """ - -" remember as many history items as possible (command, search, etc) -set history=10000 -" enable persistent undo (undo even after closing and reopening vim) -if has('persistent_undo') - let s:undocachedir = $HOME . '/.cache/vim/undo' - if !isdirectory(s:undocachedir) - call mkdir(s:undocachedir, 'p') - endif - exe "set undodir=" . s:undocachedir - set undofile -endif -" use a separate swapfile directory -let s:swapfiledir = $HOME . '/.cache/vim/swap' -if !isdirectory(s:swapfiledir) - call mkdir(s:swapfiledir, 'p') -endif -exe "set directory=" . s:swapfiledir -" use a separate view directory -let s:viewdir = $HOME . '/.cache/vim/view' -if !isdirectory(s:viewdir) - call mkdir(s:viewdir, 'p') -endif -exe "set viewdir=" . s:viewdir - - -""" BUFFERS """ - -" automatically write the buffer before :make, shell commands, etc -set autowrite -" ask to save modified buffers when quitting, instead of throwing an error -set confirm -" allow switching to other buffers when the current one is modified -set hidden -" these two restore the last known cursor position when a buffer is loaded -set nostartofline -autocmd opinionated_defaults BufReadPost * - \ if line("'\"") <= line('$') | - \ exe 'normal! g`"' | - \ endif - - -""" DISPLAY """ - -" show as much of a line as possible if it doesn't all fit on the screen -set display+=truncate -" more useful display of nonprinting characters (<07> instead of ^G) -set display+=uhex -" don't redraw in the middle of noninteractive commands (maps, macros, etc) -set lazyredraw -" always give a message for the number of lines delete/changed -set report=0 -" keep some additional context visible when scrolling -set scrolloff=5 -if has('cmdline_info') - " display the current partial command and size of the visual selection - set showcmd -endif -if has('conceal') - " enable syntax-specific hiding of text - set conceallevel=2 -endif -if has('linebreak') - " display a marker when a line was wrapped - set showbreak=> -endif - - -""" EDITING """ - -" automatically use an indent that matches the previous line -set autoindent -" allow backspacing over everything -set backspace=indent,eol,start -" remove leading comment characters intelligently when joining lines -set formatoptions+=j -" always join with a single space, even between sentences -set nojoinspaces -" try to always keep indentation lined up on shiftwidth boundaries -set shiftround -" keep softtabstop and shiftwidth in sync -set softtabstop=-1 - - -""" COMMAND MODE """ - -" make command mode completion work more like the shell: -" first, complete the longest common sequence, -" then show a list, -" then cycle through completing the full names in the list in order -set wildmode=longest,list,full -if exists('+wildignorecase') - " make command mode completion case insensitive - set wildignorecase -endif - - -""" SEARCH """ - -" make searches case-insensitive -set ignorecase -" unless they include a capital letter -set smartcase -if has('extra_search') - " highlight all matches when searching - set hlsearch -endif - - -""" TERMINAL STUFF """ - -" wait a much shorter amount of time for escape sequences -" (this makes <Esc> much more responsive) -set ttimeoutlen=50 -" send text to the terminal in such a way that line wrapping is done at the -" terminal level, so copying and pasting wrapped lines works correctly -" (assuming you temporarily unset showbreak) -set ttyfast -" entirely disable error bells: -" make all bells visual bells -set visualbell -" and then disable visual bells -set t_vb= - - -""" COLORS """ - -" force vim to use 256 colors -" (it typically can't detect this while in screen/tmux since TERM=screen -" doesn't advertise it, even though ~everything does support it these days) -set t_Co=256 -" globally highlight diff conflict markers -match ErrorMsg '^\(<\||\|=\|>\)\{7\}\([^=].\+\)\?$' - - -""" MAPPINGS """ - -" keep the current selection when indenting -xnoremap < <gv -xnoremap > >gv -" make Y behave analogously to D instead of dd -nnoremap Y y$ -" make arrow keys move visually (since j/k already move linewise) -noremap <up> gk -noremap <down> gj -inoremap <up> <C-o>gk -inoremap <down> <C-o>gj diff --git a/vim/plugin/rainbow_paren.vim b/vim/plugin/rainbow_paren.vim deleted file mode 100644 index 9c26134..0000000 --- a/vim/plugin/rainbow_paren.vim +++ /dev/null @@ -1,96 +0,0 @@ -" this script by Shawn M Moore aka Sartak <sartak at gmail.com> -" also by Michael R Geddes aka frogonwheels <vimmer at frog.wheelycreek.net> -" originally by anonymous - -" this in the public domain -" last updated 25 Mar 07 - -" this does nothing unless you, -" let g:rainbow = 1 - -" and set which kinds of character pairs you want to rainbow -" let g:rainbow_paren = 1 " () -" let g:rainbow_brace = 1 " {} -" let g:rainbow_bracket = 1 " [] -" let g:rainbow_angle = 1 " <> - -" if you want the different types to nest, such that the braces in ({}) are -" colored the same as the internal parens of (()), then -" let g:rainbow_nested = 1 - -function! Rainbow() - let s:basename = 'level' - exe 'hi '.s:basename.'1c ctermfg=6 guifg=#1673b0' - exe 'hi '.s:basename.'2c ctermfg=2 guifg=#008551' - exe 'hi '.s:basename.'3c ctermfg=3 guifg=#b25200' - exe 'hi '.s:basename.'4c ctermfg=4 guifg=#4369cc' - exe 'hi '.s:basename.'5c ctermfg=5 guifg=#a045a7' - " this color is never nested, it only appears on the outermost layer - exe 'hi '.s:basename.'6c ctermfg=1 guifg=#c7394e' - - " helper function - func s:DoSyn(cur, top, left, right, uniq) - let uniq = a:uniq - if exists("g:rainbow_nested") && g:rainbow_nested != 0 - let uniq = "" - endif - - let cmd = 'syn region '.s:basename.uniq.a:cur.' transparent fold matchgroup='.s:basename.a:cur.'c start=/'.a:left.'/ end=/'.a:right.'/ contains=TOP' - - let i = a:cur - - if i == 1 - let i = a:top - endif - - while i <= a:top - let cmd = cmd . ',' . s:basename . uniq . i - let i = i + 1 - endwhile - exe cmd - endfunc - - func s:DoSyntaxes(count) - let i = 1 - - while i <= a:count - " if you define new pairs, make sure to take into account that the - " delimiter is currently / and that it uses regex, so you need to escape - " regex metachars (like what is done for brackets) - - if exists("g:rainbow_paren") && g:rainbow_paren != 0 - " ocaml uses (* *) for comments; these shouldn't be highlighted - if &filetype == "ocaml" - call s:DoSyn(i, a:count, "(\\*\\@!", "\\*\\@<!)", "a") - else - call s:DoSyn(i, a:count, "(", ")", "a") - endif - endif - - if exists("g:rainbow_brace") && g:rainbow_brace != 0 - call s:DoSyn(i, a:count, "{", "}", "b") - endif - - if exists("g:rainbow_bracket") && g:rainbow_bracket != 0 - call s:DoSyn(i, a:count, "\\[", "\\]", "c") - endif - - if exists("g:rainbow_angle") && g:rainbow_angle != 0 - call s:DoSyn(i, a:count, "<", ">", "d") - endif - - let i = i + 1 - endwhile - endfun - - call s:DoSyntaxes(6) " 6 is the number of colors we have - - delfun s:DoSyn - delfun s:DoSyntaxes -endfunction - -if exists("g:rainbow") && g:rainbow - augroup rainbow - autocmd BufWinEnter,FileType * call Rainbow() - augroup END -endif |