vimrc: add :W command and au set noreadonly

master
an 2019-05-29 23:13:32 -04:00
parent 88c512dba2
commit 9456418edf
1 changed files with 22 additions and 14 deletions

36
vimrc
View File

@ -121,7 +121,7 @@ else
set t_Co=256
let base16colorspace=256
set termguicolors
endi
endif
" OS-specific settings
if has('gui_running')
@ -130,8 +130,8 @@ if has('gui_running')
else
set guifont=PxPlus\ IBM\ EGA8\ 12
set linespace=-2
endi
endi
endif
endif
if has('win32')
" windows sucks
@ -164,7 +164,7 @@ else
" swap files
set directory=$HOME/.vim/temp//
endi
endif
" set up colors and file types
colorscheme base16-porple
@ -188,7 +188,7 @@ ruby<<
$curbuf.line += " " + "-" * rep + "|"
end
.
endf
endfu
" File size
fu! FileSize()
@ -197,8 +197,8 @@ fu! FileSize()
return ""
else
return fs
endi
endf
endif
endfu
" Strip whitespace on buffer write
fu! s:StripWhite()
@ -210,20 +210,23 @@ ruby<<
end
end
.
endf
endfu
" Close empty buffers
fu! s:CloseEmptyBuffers()
let bufs = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val) < 0 && !getbufvar(v:val, "&modified")')
if !empty(bufs)
execute 'bdelete' join(bufs, ' ')
endi
endf
endif
endfu
" Commands -------------------------------------------------------------------|
" Find
com! -nargs=+ -complete=file -bar Gr silent! grep! "<Args>"|cwindow
com -nargs=+ -complete=file -bar Gr silent! grep! "<Args>"|cwindow
" Write (sudo)
com W execute 'w !sudo tee > /dev/null %' | edit!
" Autocommands ---------------------------------------------------------------|
@ -245,13 +248,18 @@ au FileType edif set syntax=conf
" disable most ftplugins
au BufReadPre * let b:did_ftplugin=1
" au VimEnter * nested :TagbarOpen
" enable tagbar
"au VimEnter * nested :TagbarOpen
" rust.vim sets Cargo.toml to use filetype `cfg` even though it shouldn't, to
" fix this we simply do the same thing before it has a chance to
au BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=toml | endi
au BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=toml | endif
"au VimEnter * vs
" vertical split on enter
"au VimEnter * vsplit
" suppress readonly warnings
au BufEnter * set noreadonly
" Mapping --------------------------------------------------------------------|