vim: fix ordering of autocmds
parent
60f099195d
commit
352aec8f3f
115
vim/vimrc
115
vim/vimrc
|
@ -48,6 +48,24 @@ let _agw.colors=[
|
||||||
\ 'base16-unikitty-dark',
|
\ 'base16-unikitty-dark',
|
||||||
\]
|
\]
|
||||||
|
|
||||||
|
let _agw.languages=[
|
||||||
|
\ "c",
|
||||||
|
\ "cpp",
|
||||||
|
\ "cs",
|
||||||
|
\ "go",
|
||||||
|
\ "html",
|
||||||
|
\ "java",
|
||||||
|
\ "json",
|
||||||
|
\ "lisp",
|
||||||
|
\ "php",
|
||||||
|
\ "python",
|
||||||
|
\ "racket",
|
||||||
|
\ "ruby",
|
||||||
|
\ "rust",
|
||||||
|
\ "scheme",
|
||||||
|
\ "zscript",
|
||||||
|
\]
|
||||||
|
|
||||||
let _agw.cr_scheme=-2 " color from s:colors, -1=random, -2=default
|
let _agw.cr_scheme=-2 " color from s:colors, -1=random, -2=default
|
||||||
let _agw.g_columns=80 " GUI columns
|
let _agw.g_columns=80 " GUI columns
|
||||||
let _agw.g_rows=24 " GUI rows
|
let _agw.g_rows=24 " GUI rows
|
||||||
|
@ -64,6 +82,10 @@ runtime! vconf
|
||||||
|
|
||||||
" Functions ------------------------------------------------------------------|
|
" Functions ------------------------------------------------------------------|
|
||||||
|
|
||||||
|
fu _agw.is_lang(lang)
|
||||||
|
return index(g:_agw.languages, a:lang) >= 0
|
||||||
|
endfu
|
||||||
|
|
||||||
fu _agw.fill_line()
|
fu _agw.fill_line()
|
||||||
if g:_agw.use_ruby
|
if g:_agw.use_ruby
|
||||||
ruby<<
|
ruby<<
|
||||||
|
@ -268,7 +290,8 @@ let twitvim_browser_cmd='palemoon'
|
||||||
let vim_markdown_folding_disabled=1
|
let vim_markdown_folding_disabled=1
|
||||||
|
|
||||||
" rainbow
|
" rainbow
|
||||||
let rainbow_active=0
|
let rainbow_active=1
|
||||||
|
let lisp_rainbow=1
|
||||||
|
|
||||||
" netrw
|
" netrw
|
||||||
let netrw_banner=0
|
let netrw_banner=0
|
||||||
|
@ -444,62 +467,68 @@ com W execute 'w !sudo tee > /dev/null %' | edit!
|
||||||
|
|
||||||
" Autocommands ---------------------------------------------------------------|
|
" Autocommands ---------------------------------------------------------------|
|
||||||
|
|
||||||
" Strip whitespace
|
augroup AGW
|
||||||
au FileType c,cpp,cs,java,php,ruby,rust,python,go,zscript,markdown au BufWritePre <buffer> call _agw.strip_white()
|
" enable tagbar
|
||||||
|
if _agw.use_tagbar == 1
|
||||||
|
au VimEnter * nested :TagbarOpen
|
||||||
|
endif
|
||||||
|
|
||||||
" Enable rainbow braces
|
" vertical split on enter
|
||||||
if _agw.use_rainbow != 0
|
if _agw.use_vsp == 1
|
||||||
au FileType c,cpp,cs,java,php,ruby,rust,python,go,zscript,html,scheme,racket,lisp,json au BufEnter <buffer> RainbowToggleOn
|
au VimEnter * vsplit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" markdown sucks
|
" markdown sucks
|
||||||
au FileType markdown set comments+=fb:- comments-=b:- indentexpr=
|
au FileType markdown set comments+=fb:- comments-=b:- indentexpr=
|
||||||
|
|
||||||
" Racket options
|
" Racket options
|
||||||
au FileType racket call _agw.setup_rkt()
|
au FileType racket call _agw.setup_rkt()
|
||||||
|
|
||||||
" ASM options
|
" ASM options
|
||||||
au BufEnter *\.asm,*\.s,*\.inc,*\.i call _agw.setup_asm()
|
au FileType asm call _agw.setup_asm()
|
||||||
|
|
||||||
" close empty buffers automatically
|
" Strip whitespace
|
||||||
au BufEnter * call _agw.close_empty()
|
au BufWritePre * if _agw.is_lang(&ft) | call _agw.strip_white() | endif
|
||||||
|
|
||||||
" set color randomly on buffer enter
|
" fix file detection for fish
|
||||||
if _agw.cr_scheme == -1
|
au BufRead *
|
||||||
au BufEnter * call _agw.set_color(localtime() % len(_agw.colors))
|
\ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' |
|
||||||
endif
|
\ setlocal filetype=fish |
|
||||||
|
\ endif
|
||||||
|
|
||||||
" .rkt → Racket
|
" .rkt → Racket
|
||||||
au BufRead,BufNewFile *.rkt set syntax=racket
|
au BufRead,BufNewFile *.rkt set syntax=racket
|
||||||
|
|
||||||
" .edf → conf
|
" .edf → conf
|
||||||
au BufRead,BufNewFile *.edf set syntax=conf
|
au BufRead,BufNewFile *.edf set syntax=conf
|
||||||
|
|
||||||
" disable most ftplugins
|
" disable most ftplugins
|
||||||
au BufReadPre * let b:did_ftplugin=1
|
au BufReadPre * let b:did_ftplugin=1
|
||||||
au BufReadPre *.rkt unlet b:did_ftplugin
|
au BufReadPre *.rkt unlet b:did_ftplugin
|
||||||
|
|
||||||
" enable tagbar
|
" rust.vim sets Cargo.toml to use filetype `cfg` even though it shouldn't,
|
||||||
if _agw.use_tagbar == 1
|
" to fix this we simply do the same thing before it has a chance to
|
||||||
au VimEnter * nested :TagbarOpen
|
au BufRead,BufNewFile Cargo.toml
|
||||||
endif
|
\ if &filetype == "" |
|
||||||
|
\ set filetype=toml |
|
||||||
|
\ endif
|
||||||
|
|
||||||
" rust.vim sets Cargo.toml to use filetype `cfg` even though it shouldn't, to
|
" close empty buffers automatically
|
||||||
" fix this we simply do the same thing before it has a chance to
|
au BufEnter * call _agw.close_empty()
|
||||||
au BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=toml | endif
|
|
||||||
|
|
||||||
" vertical split on enter
|
" set color randomly on buffer enter
|
||||||
if _agw.use_vsp == 1
|
if _agw.cr_scheme == -1
|
||||||
au VimEnter * vsplit
|
au BufEnter * call _agw.set_color(localtime() % len(_agw.colors))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" suppress readonly warnings
|
" Enable rainbow braces
|
||||||
au BufEnter * set noreadonly
|
if _agw.use_rainbow != 0
|
||||||
|
au BufEnter * if _agw.is_lang(&ft) | exec 'RainbowToggleOn' | endif
|
||||||
|
endif
|
||||||
|
|
||||||
autocmd BufRead *
|
" suppress readonly warnings
|
||||||
\ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' |
|
au BufEnter * set noreadonly
|
||||||
\ setlocal filetype=fish |
|
augroup end
|
||||||
\ endif
|
|
||||||
|
|
||||||
" Mapping --------------------------------------------------------------------|
|
" Mapping --------------------------------------------------------------------|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue