diff options
Diffstat (limited to 'base/.vimrc')
-rw-r--r-- | base/.vimrc | 239 |
1 files changed, 0 insertions, 239 deletions
diff --git a/base/.vimrc b/base/.vimrc deleted file mode 100644 index 3a4b16a..0000000 --- a/base/.vimrc +++ /dev/null @@ -1,239 +0,0 @@ -set nocompatible -set encoding=utf-8 - -set modelines=0 " for security - -set mouse="" -set backspace=indent,eol,start - -au FocusLost * :wa - -" Leader ====---- -nnoremap ,, , -let mapleader="," -nnoremap <leader>; ; -nnoremap ; : - -" Highlighting ====---- -syntax on -filetype plugin indent on - -set t_Co=256 " force enable 256-color mode. -if &t_Co >= 256 || has("gui_running") - let base16colorspace=256 - colorscheme base16-default-dark -endif -if &t_Co > 2 || has("gui_running") - syntax on -endif - -" Indentation ====---- -set shiftwidth=2 -set tabstop=2 -set expandtab -set shiftround " use multiple of shiftwidth with '<' and '>' -set autoindent -set copyindent " copy the previous line's indentation - -xnoremap < <gv -xnoremap > >gv - -" Search ====---- -set incsearch -set hlsearch -set wrapscan -set ignorecase " ignore case when searching -set smartcase " ignore case if search pattern is all lowercase, - " case-sensitive otherwise - -nnoremap <silent> <leader><space> :noh<cr> - -" Case insensitive -nmap * /\<<C-R>=expand('<cword>')<CR>\><CR> -nmap # ?\<<C-R>=expand('<cword>')<CR>\><CR> - -set showmatch -nnoremap <tab> % -vnoremap <tab> % - -" Screen ====---- -"set nowrap -set wrap -"set textwidth=79 -"set formatoptions=tqrn1 -set colorcolumn=85 -set ruler -set number -set relativenumber -set laststatus=2 -set shortmess=aoOstTWAI -set cursorline -"set showmode -set showcmd -set title " change the terminal's title -set scrolloff=3 - -set visualbell " don't beep -set noerrorbells " don't beep - -set list -set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:· -"autocmd filetype html,xml set listchars-=tab:>. - -set wildmenu -set wildmode=longest:full,full -set wildignore=*.swp,*.bak,*.pyc,*.class - -set ttyfast - -hi ColorColumn ctermbg=18 -hi Folded ctermbg=0 ctermfg=12 - -" Stop using arrow keys ====---- -noremap <up> <nop> -noremap <down> <nop> -noremap <left> <nop> -noremap <right> <nop> - -" nnoremap j gj -" nnoremap k gk - -" Splits ====---- -nnoremap <leader>w <C-w>v<C-w>l -nnoremap <C-h> <C-w>h -nnoremap <C-j> <C-w>j -nnoremap <C-k> <C-w>k -nnoremap <C-l> <C-w>l - -" History ====---- -set history=1000 " remember more commands and search history -set undolevels=1000 " use many muchos levels of undo - -if !isdirectory($HOME."/.vim") - call mkdir($HOME."/.vim", "", 0770) -endif -if !isdirectory($HOME."/.vim/undo-dir") - call mkdir($HOME."/.vim/undo-dir", "", 0700) -endif -set undodir=~/.vim/undo-dir -set undofile -" !!!! ADD THIS TO CRONTAB -" 43 0 * * 3 find /home/adam/.vim/undo-dir -type f -mtime +90 -delete - -set nobackup -set noswapfile " Note: swap helps large files. - -" Custom mappings ====---- - -" Quickly edit/reload the vimrc file -nnoremap <silent> <leader>ve :tabe $MYVIMRC<CR> -nnoremap <silent> <leader>vs :so $MYVIMRC<CR> - -nnoremap <F2> :set invpaste paste?<CR> -set pastetoggle=<F2> - -nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR> -nnoremap <leader>ft Vatzf -nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR> -nnoremap <leader>q gqip -nnoremap <leader>vp V`] -nnoremap <leader>h :syntax sync fromstart<CR> -nnoremap <leader>l :nohlsearch<cr>:diffupdate<cr>:syntax sync fromstart<cr><c-l> -nnoremap [<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>'[ -nnoremap ]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr> - -noremap <leader>y "*y -noremap <leader>yy "*Y -noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR> - -noremap <silent> + :s/^\s*/&\/\//<CR>:noh<CR> -noremap <silent> - :s/^\(\s*\)\/\//\1/<CR>:noh<CR> - -vnoremap Q gq -nnoremap Q gqap - -cnoremap w!! w !sudo tee % >/dev/null - -" helper function to toggle hex mode -function! ToggleHex() - " hex mode should be considered a read-only operation - " save values for modified and read-only for restoration later, - " and clear the read-only flag for now - let l:modified=&mod - let l:oldreadonly=&readonly - let &readonly=0 - let l:oldmodifiable=&modifiable - let &modifiable=1 - if !exists("b:editHex") || !b:editHex - " save old options - let b:oldft=&ft - let b:oldbin=&bin - " set new options - setlocal binary " make sure it overrides any textwidth, etc. - let &ft="xxd" - " set status - let b:editHex=1 - " switch to hex editor - %!xxd - else - " restore old options - let &ft=b:oldft - if !b:oldbin - setlocal nobinary - endif - " set status - let b:editHex=0 - " return to normal editing - %!xxd -r - endif - " restore values for modified and read only state - let &mod=l:modified - let &readonly=l:oldreadonly - let &modifiable=l:oldmodifiable -endfunction - -command! -bar Hexmode call ToggleHex() -nnoremap <leader>H :Hexmode<CR> - -function! NumberToggle() - if(&relativenumber == 1) - set norelativenumber - else - set relativenumber - endif -endfunc - -nnoremap <leader>N :call NumberToggle()<cr> -"autocmd InsertEnter * :set norelativenumber -"autocmd InsertLeave * :set relativenumber - -" Custom functions ====---- - -if filereadable(expand("~/.vimrc.local")) - source ~/.vimrc.local -endif - -function! SetLocalOptions(fname) - let dirname = fnamemodify(a:fname, ":p:h") - while "/" != dirname - let lvimrc = dirname . "/.vimrc.local" - if filereadable(lvimrc) - execute "source " . lvimrc - break - endif - let dirname = fnamemodify(dirname, ":p:h:h") - endwhile -endfunction - -au BufNewFile,BufRead * call SetLocalOptions(bufname("%")) - - -" To move elsewhere ====---- -au BufNewFile,BufRead *.less set filetype=less -autocmd! BufWritePost $MYVIMRC source $MYVIMRC -packadd! matchit -cnoremap <c-n> <down> -cnoremap <c-p> <up> -autocmd! BufRead,BufNewFile *.md set filetype=markdown -autocmd! BufRead,BufNewFile *.md set spell -vnoremap p "_dP |