From e4f42d3ca85bbf18a2156fc43699b236045dd3b3 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 9 Feb 2012 14:43:09 +0100 Subject: [PATCH] =?UTF-8?q?.vimrc:=20Add=20some=20goodies=20found=20in=20@?= =?UTF-8?q?alrra=E2=80=99s=20dotfiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vimrc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.vimrc b/.vimrc index 505672db57d..ab3d3fb884a 100644 --- a/.vimrc +++ b/.vimrc @@ -55,8 +55,10 @@ set shortmess=atI set showmode " Show the filename in the window titlebar set title +" Show the (partial) command as it’s being typed +set showcmd +" Use relative line numbers if exists("&relativenumber") - " Use relative line numbers set relativenumber au BufReadPost * set relativenumber endif @@ -64,11 +66,21 @@ endif set scrolloff=3 " Strip trailing whitespace (,ss) -function! StripWhitespace () +function! StripWhitespace() let save_cursor = getpos(".") let old_query = getreg('/') :%s/\s\+$//e call setpos('.', save_cursor) call setreg('/', old_query) endfunction -noremap ss :call StripWhitespace () \ No newline at end of file +noremap ss :call StripWhitespace() +" Save a file as root (,W) +noremap W :w !sudo tee % > /dev/null + +" Automatic commands +if has("autocmd") + " Enable file type detection + filetype on + " Treat .json files as .js + autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript +endif \ No newline at end of file