From 8f275568bea2b58a5a332211fdf2f88e09507404 Mon Sep 17 00:00:00 2001 From: katherine Date: Tue, 14 May 2019 22:51:51 -0700 Subject: switch vimrc settings functions to script-private --- .vimrc | 191 +++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 91 insertions(+), 100 deletions(-) diff --git a/.vimrc b/.vimrc index fd0e121..f4e9d02 100644 --- a/.vimrc +++ b/.vimrc @@ -48,7 +48,6 @@ Plugin 'itchyny/lightline.vim' Plugin 'tomtom/tcomment_vim' Plugin 'SirVer/ultisnips' -Plugin 'honza/vim-snippets' Plugin 'junegunn/vader.vim' @@ -236,6 +235,18 @@ endif cnoremap cnoremap +fun! s:goyo_enter() + set formatoptions+=a +endfun + +fun! s:goyo_leave() + set formatoptions-=a +endfun + +autocmd! User GoyoEnter nested call goyo_enter() +autocmd! User GoyoLeave nested call goyo_leave() + +nnoremap w :execute "silent Goyo" """"""""""""""""""""""" @@ -253,49 +264,49 @@ if has('autocmd') "set various filetype-specific settings. augroup filetypesettings - au FileType asm call Settings_asm() - au FileType bash call Settings_shell() - au FileType c call Settings_c() - au FileType coffee call Settings_coffee() - au FileType conf call Settings_conf() - au FileType cpp call Settings_c() - au FileType crystal call Settings_crystal() - au FileType cs call Settings_c() - au FileType css call Settings_css() - au FileType d call Settings_c() - au FileType elixir call Settings_elixir() - au FileType javascript call Settings_c() - au FileType tex call Settings_tex() - au FileType haskell call Settings_haskell() - au FileType html call Settings_html() - au FileType xhtml call Settings_html() - au FileType ia64 call Settings_ia64() - au FileType make call Settings_script() - au FileType mail call Settings_mail() - au FileType markdown call Settings_markdown() - au FileType matlab call Settings_matlab() - au FileType mips call Settings_mips() - au FileType mkd call Settings_text() - au FileType nim call Settings_nim() - au FileType ocaml call Settings_ocaml() - au FileType perl call Settings_perl() - au FileType php call Settings_html() - au FileType python call Settings_script() - au FileType ruby call Settings_elixir () - au FileType rust call Settings_rust() - au FileType scss call Settings_css() - au FileType sh call Settings_script() - au FileType text call Settings_text() - au FileType vim call Settings_vim() - au FileType yaml call Settings_script2() - au FileType zig call Settings_c() - au FileType zsh call Settings_shell() - au FileType z80 call Settings_z80() + au FileType asm call settings_asm() + au FileType bash call settings_shell() + au FileType c call settings_c() + au FileType coffee call settings_coffee() + au FileType conf call settings_conf() + au FileType cpp call settings_c() + au FileType crystal call settings_crystal() + au FileType cs call settings_c() + au FileType css call settings_css() + au FileType d call settings_c() + au FileType elixir call settings_elixir() + au FileType javascript call settings_c() + au FileType tex call settings_tex() + au FileType haskell call settings_haskell() + au FileType html call settings_html() + au FileType xhtml call settings_html() + au FileType ia64 call settings_ia64() + au FileType make call settings_script() + au FileType mail call settings_mail() + au FileType markdown call settings_markdown() + au FileType matlab call settings_matlab() + au FileType mips call settings_mips() + au FileType mkd call settings_text() + au FileType nim call settings_nim() + au FileType ocaml call settings_ocaml() + au FileType perl call settings_perl() + au FileType php call settings_html() + au FileType python call settings_script() + au FileType ruby call settings_script2() + au FileType rust call settings_rust() + au FileType scss call settings_css() + au FileType sh call settings_script() + au FileType text call settings_text() + au FileType vim call settings_vim() + au FileType yaml call settings_script2() + au FileType zig call settings_c() + au FileType zsh call settings_shell() + au FileType z80 call settings_z80() augroup END "do other stuff augroup filetypemisc - au FileType * call Settings_skel_read() + au FileType * call settings_skel_read() augroup END endif "autocmd @@ -305,7 +316,7 @@ endif "autocmd " "command for reading filetype skeletons -fun! Settings_skel_read() +fun! s:settings_skel_read() "is the buffer not empty? if line('$') != 1 || col('$') != 1 return 1 @@ -321,25 +332,8 @@ fun! Settings_skel_read() exec "silent! normal! ggJ/%START%\:s/%START%//\" endfun -"a 'writing mode' for prose-y formats -fun! s:goyo_enter() - setlocal formatoptions+=a -endfun - -fun! s:goyo_leave() - setlocal formatoptions+=a -endfun - -fun! Settings_sub_wmodetoggle() - if &fo =~ 'a' - Goyo! - else - Goyo - endif -endfun - "run vader tests on the current file -fun! Settings_sub_test_vim() +fun! s:settings_sub_test_vim() "check first if curbuf is a file if @% != '' && filereadable(@%) let l:real = '' @@ -371,7 +365,7 @@ endfun " Settings Functions " -fun! Settings_asm() +fun! s:settings_asm() "settings setlocal foldmethod=syntax "mappings @@ -379,7 +373,7 @@ fun! Settings_asm() nnoremap -_ O; endfun -fun! Settings_c() +fun! s:settings_c() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 @@ -391,24 +385,24 @@ fun! Settings_c() inoremap { }i{O endfun -fun! Settings_coffee() - call Settings_script2() +fun! s:settings_coffee() + call settings_script2() setlocal foldmethod=syntax nnoremap -_ O######O endfun -fun! Settings_conf() - call Settings_script() +fun! s:settings_conf() + call settings_script() setlocal expandtab endfun -fun! Settings_crystal() - call Settings_script2() +fun! s:settings_crystal() + call settings_script2() setlocal expandtab endfun -fun! Settings_css() - call Settings_c() +fun! s:settings_css() + call settings_c() "settings setlocal shiftwidth=2 setlocal tabstop=2 @@ -416,12 +410,12 @@ fun! Settings_css() "mappings endfun -fun! Settings_elixir() - call Settings_script2() +fun! s:settings_elixir() + call settings_script2() inoremap do endhhidoO endfun -fun! Settings_ia64() +fun! s:settings_ia64() "settings setlocal foldmethod=syntax "mappings @@ -429,7 +423,7 @@ fun! Settings_ia64() nnoremap -_ O*/hhi/* endfun -fun! Settings_haskell() +fun! s:settings_haskell() "settings setlocal shiftwidth=4 setlocal tabstop=4 @@ -439,7 +433,7 @@ fun! Settings_haskell() nnoremap -- O-- endfun -fun! Settings_html() +fun! s:settings_html() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 @@ -449,7 +443,7 @@ fun! Settings_html() nnoremap -- O-->3hi3hi