move after/ftplugins to autocmds

This commit is contained in:
James Dixon 2020-12-18 21:14:59 -05:00
parent 5453b8950b
commit f7b0d0b1dd
6 changed files with 50 additions and 19 deletions

View File

@ -1,4 +0,0 @@
"settings
set noexpandtab
let g:go_auto_type_info = 1
let g:go_imports_autosave = 1

View File

@ -1,2 +0,0 @@
"syntax
syntax sync fromstart

View File

@ -1,2 +0,0 @@
"settings
setlocal spell

View File

@ -1,2 +0,0 @@
"keymaps
xnoremap <leader>r <esc>:'<,'>:w !python3<CR>

View File

@ -1,5 +1,38 @@
if has("autocmd") if has("autocmd")
"global "filetype functions
"------------------
function FT_halftab()
setlocal expandtab
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
endfunction
function FT_python()
setlocal autoindent
setlocal formatprg=yapf
iabbr false False
iabbr true True
xnoremap <leader>r <esc>:'<,'>:w !python3<CR>
endfunction
function FT_go()
set noexpandtab
let g:go_auto_type_info = 1
let g:go_imports_autosave = 1
endfunction
function FT_html()
syntax sync fromstart
endfunction
function FT_markdown()
setlocal spell
endfunction
"global autocmds
"-----------------
augroup global augroup global
autocmd! autocmd!
"keep equal proportions when windows resized "keep equal proportions when windows resized
@ -9,18 +42,14 @@ if has("autocmd")
\ <= line("$") | exe "normal! g'\"" | endif \ <= line("$") | exe "normal! g'\"" | endif
augroup END augroup END
"general filetype autocmds
"-------------------------
augroup emmet_group augroup emmet_group
autocmd! autocmd!
autocmd FileType html,css EmmetInstall autocmd FileType html,css EmmetInstall
augroup END augroup END
augroup indent_group augroup prettier_format_group
autocmd!
autocmd FileType html,css,scss,javascript,json,toml,yaml
\ setlocal ts=2 sts=2 sw=2 expandtab
augroup END
augroup format_group
autocmd! autocmd!
autocmd FileType javascript setlocal formatprg=prettier autocmd FileType javascript setlocal formatprg=prettier
autocmd FileType typescript setlocal formatprg=prettier\ --parser\ typescript autocmd FileType typescript setlocal formatprg=prettier\ --parser\ typescript
@ -31,7 +60,19 @@ if has("autocmd")
autocmd FileType markdown setlocal formatprg=prettier\ --parser\ markdown autocmd FileType markdown setlocal formatprg=prettier\ --parser\ markdown
autocmd FileType json setlocal formatprg=prettier\ --parser\ json autocmd FileType json setlocal formatprg=prettier\ --parser\ json
autocmd FileType yaml setlocal formatprg=prettier\ --parser\ yaml autocmd FileType yaml setlocal formatprg=prettier\ --parser\ yaml
autocmd FileType python setlocal formatprg=yapf
augroup END augroup END
augroup halftab_indent_group
autocmd!
autocmd FileType sh,bash,html,css,scss,javascript,json,toml,yaml call FT_halftab()
augroup END
"language specific autocmds
"--------------------------
augroup language_group
autocmd FileType python call FT_python()
autocmd FileType go call FT_go()
autocmd FileType html call FT_html()
autocmd FileType markdown call FT_markdown()
augroup END
endif endif