1
0
mirror of https://github.com/akelge/zsh synced 2025-07-04 13:39:07 +00:00

Added features for javascript

JSBeautify (,ff) added and modified to retain position
Slightly changed vimrc for different filetypes
This commit is contained in:
2012-02-29 09:30:19 +00:00
parent 1f96fcc64a
commit d83cd7bbd4
4 changed files with 1253 additions and 7 deletions

View File

@ -12,7 +12,7 @@ set history=50
set nohlsearch
set nostartofline
" set paste
" set autochdir
set autochdir
" Let's go to 256 colors
set t_Co=256
@ -46,7 +46,7 @@ set cpoptions=aAcF$
set modeline
set modelines=1
set encoding=utf-8
set listchars=tab:->,trail:.,eol:$
set listchars=tab:->,trail:.,eol:$,extends:>,precedes:<
set smartcase
set errorbells
" set visualbell
@ -200,19 +200,60 @@ if has("autocmd")
\ exe "normal g'\"" |
\ endif
" Mako
autocmd BufNewFile,BufRead *.mako setf mako tw=0
autocmd BufNewFile,BufRead *.mako setf mako
autocmd FileType *.mako set textwidth=0
" Python
autocmd BufNewFile,BufRead *.py set textwidth=79
autocmd FileType python set textwidth=79
autocmd FileType python set omnifunc=pythoncomplete#Complete
" Plist
autocmd BufReadPre,FileReadPre *.plist set binary ft=plist syntax=xml
autocmd BufReadPre,FileReadPre *.plist setf plist
autocmd FileType plist set binary syntax=xml
autocmd BufReadPost *.plist call MyBinaryPlistReadPost()
autocmd FileReadPost *.plist call MyBinaryPlistReadPost() | let b:saveAsBinaryPlist = 0
autocmd BufWritePre,FileWritePre *.plist call MyBinaryPlistWritePre()
autocmd BufWritePost,FileWritePost *.plist call MyBinaryPlistWritePost()
" Plain text
autocmd BufNewFile,BufRead *.txt set ft=txt tw=78 pfn=:h10
autocmd BufNewFile,BufRead *.txt setf txt
autocmd FileType txt set textwidth=78 printfont=:h10
" Javascript
autocmd FileType javascript set sw=4 ts=4 sts=4
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
" Transparent editing of gpg encrypted files.
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg,*.asc set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg,*.asc set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg,*.asc set bin
autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = &ch|set ch=2
autocmd BufReadPre,FileReadPre *.gpg,*.asc let shsave=&sh
autocmd BufReadPre,FileReadPre *.gpg,*.asc let &sh='sh'
autocmd BufReadPre,FileReadPre *.gpg,*.asc let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg,*.asc '[,']!gpg2 --decrypt --default-recipient-self 2> /dev/null
autocmd BufReadPost,FileReadPost *.gpg,*.asc let &sh=shsave
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg,*.asc set nobin
autocmd BufReadPost,FileReadPost *.gpg,*.asc let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gpg,*.asc execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg,*.asc set bin
autocmd BufWritePre,FileWritePre *.gpg,*.asc let shsave=&sh
autocmd BufWritePre,FileWritePre *.gpg,*.asc let &sh='sh'
" GPG Binary
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg2 --encrypt --default-recipient-self 2>/dev/null
" GPG Ascii armor
autocmd BufWritePre,FileWritePre *.asc '[,']!gpg2 --armor --encrypt --default-recipient-self 2>/dev/null
autocmd BufWritePre,FileWritePre *.gpg,*.asc let &sh=shsave
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg,*.asc silent u
autocmd BufWritePost,FileWritePost *.gpg,*.asc set nobin
augroup END
endif
""" iTerm 2 Custom cursor shape