From 1c7b9453de846ccbc58dc89b6d7438fa0502a9e6 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Mon, 14 Jul 2014 10:30:02 -0400 Subject: [PATCH] Syntastic doesn't check on :wq when disabled, and toggling active/passive also toggles check on open/wq. A new variable was added to prevent autochecking tags, and the README and update script were updated to reflect this. Disabling the linebreaks is now defaulted to off (flip it back on if you like it). The update script is a bit more careful about how it runs when executed from other directories. A bug preventing the g:disablelinebreaks variable from being possible to disable has been squashed, and no default is set when it's not enabled. Added Emmet javascript (rather than just json), and tried to sync up the webformat list between plugins that enable themselves for those. --- README.md | 11 ++++++----- update | 23 ++++++++++------------- vim/config/after.vim | 6 +++--- vim/config/keyboard.vim | 12 ++++++------ vim/config/plugins.vim | 20 +++++++++++++++++--- vimrc | 6 +++--- 6 files changed, 45 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 83662da..fbdf759 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,12 @@ A theme, config and collection of plugins for Vim. ## Configuration ## * **Configure Variables**: The following variables can be added to _vim/vimrc.user_ and have their values set to the values you require: - * `g:disablelinebreaks`: **1** = Override filetype plugins so linebreaks never occur | 0 = Linebreaks are disabled by default, but filetype plugins can override this setting (_default_: 1) - * `g:autostartfiler`: **1** = Start the filer file manager when vim is run and the buffer is empty | 0 = Do nothing when vim is run and the buffer is empty (_default_: 1) - * `g:autostartchecker`: **1** = Check syntax once an appropriate file is loaded | 0 = Check syntax only after syntax checking is toggled on (_default_: 0) - * `g:autostarttagbar`: **1** = Have the tagbar load automatically when a compatible format is run | 0 = The tagbar will stay hidden until triggered on demand with its toggle (_default_: 0) - * `g:powerlinefonts`: **1** = Render the statusline using characters available with powerline-patched fonts | 0 = Render the statusbar with less attractive but more compatible characters available in all fonts (_default_: 0) + * `g:autostartfiler`: **1** = Start the filer file manager when vim is run and the buffer is empty | **0** = Do nothing when vim is run and the buffer is empty (_default_: **1**) + * `g:autostartchecker`: **1** = Check syntax once an appropriate file is loaded | **0** = Check syntax only after syntax checking is toggled on (_default_: **0**) + * `g:autostarttagbar`: **1** = Have the tagbar load automatically when a compatible format is run | **0** = The tagbar will stay hidden until triggered on demand with its toggle (_default_: **0**) + * `g:disableautotags`: **1** = Prevent tags from being automatically generated and highlighted | **0** = Automatically generate and highlight tags (_default_: **0**) + * `g:disablelinebreaks`: **1** = Override filetype plugins so linebreaks never occur | **0** = Linebreaks are disabled by default, but filetype plugins can override this setting (_default_: **0**) + * `g:powerlinefonts`: **1** = Render the statusline using characters available with powerline-patched fonts | **0** = Render the statusbar with less attractive but more compatible characters available in all fonts (_default_: **0**) * **Custom Settings**: Settings with priority over those set by darkcloud-vimconfig can be added to a file named _vimrc.user_, located in _darkcloud-vimconfig/vim/_ or any of the folders in the runtimepath. * **Custom Plugins**: Pathogen compatible plugins can be cloned or extracted to "darkcloud-vimconfig/vim/bundle.user/", or a folder named "bundle" or "bundle.user" in any of the folders in the runtimepath. * **Custom Snippets**: To add or override Emmet snippets, create _~/.vim/snippets.json_ and add your own definitions using json like shown in the [Emmet Documentation](http://docs.emmet.io/customization/snippets/). diff --git a/update b/update index 5b2cb9f..2b9d287 100755 --- a/update +++ b/update @@ -11,6 +11,8 @@ # # ############################################################## +cd $(dirname "$0") + ### BEGIN: VARIABLES ### # user variables (these can be edited) ERRORLOG="update-errors.log" # set the error log filename @@ -18,10 +20,9 @@ ERRORLOG="update-errors.log" # set the error log filename # script variables (these should not be touched) VERSION=$(printf "%s.r%s" "$(git show -s --format=%ci master | sed 's/\ .*//g;s/-//g')" "$(git rev-list --count HEAD)") SCRIPT_NAME=$(grep -o -e "[^\/]*$" <<< "$0") -SCRIPT_HOME="${0%/*}" +SCRIPT_HOME=$(pwd) ### END: VARIABLES ### - ### BEGIN: FUNCTIONS ### # command_parse "$@": configures environment using arguments function command_parse { @@ -72,7 +73,6 @@ function show_help() { } ### END: FUNCTIONS ### - ### BEGIN: SETUP ### # change to the base darkcloud-vimconfig folder cd "$SCRIPT_HOME" @@ -123,12 +123,13 @@ if [ ! -e vim/vimrc.user ]; then echo -n -e "\n${HEADINGCOLOUR} >> Creating User Config File:${RESETCOLOUR}" PROCESS_STATUS=$(touch vim/vimrc.user 2>&1) if [ $? = 0 ]; then - echo -e '"Disable Linebreaks: (*1:force disabled globally | 0: disabled by default)\n"let g:disablelinebreaks=0\n' >> vim/vimrc.user - echo -e '"Autostart Filer: (*1:filer loads in new empty buffers | 0: filer must be triggered)\n"let g:autostartfiler=0\n' >> vim/vimrc.user - echo -e '"Syntax Autostart: (1:start toggled on | *0: start toggled off)\n"let g:autostartchecker=1\n' >> vim/vimrc.user - echo -e '"Tagbar Autostart: (1:start open | *0:start closed)\n"let g:autostarttagbar=1\n' >> vim/vimrc.user - echo -e '"Powerline Fonts: (1:enabled | *0:disabled)\n"let g:powerlinefonts=1 "(set powerline font for gvim and terminal when enabled)\n' >> vim/vimrc.user - echo -e '"GVim Font Selection: (Escaping spaces and use powerline if appropriate)\nset guifont=Monospace\ 12' >> vim/vimrc.user + echo -e '"Autostart Filer in empty buffers: (*1:filer loads in new empty buffers | 0:filer must be triggered)\n"let g:autostartfiler=0\n' >> vim/vimrc.user + echo -e '"Autocheck syntax checking: (1:start toggled on | *0:start toggled off)\n"let g:autostartchecker=1\n' >> vim/vimrc.user + echo -e '"Autoload Tagbar: (1:start open | *0:start closed)\n"let g:autostarttagbar=1\n' >> vim/vimrc.user + echo -e '"Disable automatic tag generation and highlighting: (1:force disabled tag generation and highlighting | *0:enable automatic tag generation and highlighting)\n"let g:disableautotags=1\n' >> vim/vimrc.user + echo -e '"Disable automatic linebreaking: (1:force disabled globally | *0:let the filetype decide)\n"let g:disablelinebreaks=1\n' >> vim/vimrc.user + echo -e '"Enable Powerline fonts: (1:expect powerline font | *0:expect regular font)\n"let g:powerlinefonts=1 "(set powerline font for gvim and terminal when enabled)\n' >> vim/vimrc.user + echo -e '"GVim font selection: (Escaping spaces and use powerline if appropriate)\nset guifont=Monospace\ 12' >> vim/vimrc.user echo -e "${SUCCESSCOLOUR} SUCCESS! ${RESETCOLOUR}" else echo -e "${FAILCOLOUR} FAIL! ${RESETCOLOUR}" @@ -137,7 +138,6 @@ if [ ! -e vim/vimrc.user ]; then fi ### END: SETUP ### - ### BEGIN: REPO UPDATE ### echo -n -e "\n${HEADINGCOLOUR} >> Updating Repository:${RESETCOLOUR}" PROCESS_STATUS=$(git pull origin master 2>&1) @@ -150,7 +150,6 @@ else fi ### END: REPO UPDATE ### - ### BEGIN: SUBMODULE UPDATE ### # synchronize the repo urls for each submodule using the ones in .gitmodules echo -e "\n${HEADINGCOLOUR} >> Updating Plugin Submodules >> ${RESETCOLOUR}" @@ -212,7 +211,6 @@ git submodule foreach git clean -dxf > /dev/null 2>&1 && echo -e "${SUCCESSCOLOU done && echo ### END: SUBMODULE UPDATE ### - ### BEGIN: USER PLUGIN UPDATE ### if [ -d vim/bundle.user ]; then if [ ! $(find vim/bundle.user | grep ".git/config" | wc -l) = 0 ]; then @@ -243,7 +241,6 @@ if [ -d vim/bundle.user ]; then fi ### END: USER PLUGIN UPDATE ### - ### BEGIN: GENERATE PLUGIN HELPTAGS ### if [ $(type -P vim) ]; then echo -n -e "${HEADINGCOLOUR} >> Generating Plugin Help:${RESETCOLOUR}" diff --git a/vim/config/after.vim b/vim/config/after.vim index 4a9214e..8e4adae 100644 --- a/vim/config/after.vim +++ b/vim/config/after.vim @@ -15,11 +15,11 @@ if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' endif "disable linebreaks by default or override all of them (default: 1) -if !exists("g:disablelinebreaks")|let g:disablelinebreaks=1|endif +if !exists("g:disablelinebreaks") + let g:disablelinebreaks=1 +endif if (g:disablelinebreaks == 1) autocmd VimEnter * set tw=0 nolinebreak -else - set tw=0 nolinebreak endif "enable omnicompletion for any filetype without that has syntax highlighting diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index b9a448f..92f6815 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -418,12 +418,12 @@ inoremap ':set spell!' "toggle syntax checking - nnoremap ':SyntasticToggleMode' - xnoremap ':SyntasticToggleModegv' - inoremap ':SyntasticToggleMode' - nnoremap ':SyntasticToggleMode' - xnoremap ':SyntasticToggleModegv' - inoremap ':SyntasticToggleMode' + nnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleMode' + xnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleModegv' + inoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleMode' + nnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleMode' + xnoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleModegv' + inoremap ':if (g:syntastic_check_on_open == 1)let g:syntastic_check_on_open=0let g:syntastic_check_on_wq=0elselet g:syntastic_check_on_open=1let g:syntastic_check_on_wq=1endif:SyntasticToggleMode' "toggle external-paste mode set pastetoggle= diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim index 464bde7..3f8f632 100644 --- a/vim/config/plugins.vim +++ b/vim/config/plugins.vim @@ -20,6 +20,18 @@ "EASYTAGS: {{{ let g:easytags_file = '~/.vim/tags' + + "prevent automatically generating the tagfile and syntax highlighting tags (default: 0) + if !exists("g:disableautotags") + let g:disableautotags=0 + endif + if (g:disableautotags == 1) + let g:easytags_auto_update=0 + let g:easytags_auto_highlight=0 + else + let g:easytags_auto_update=1 + let g:easytags_auto_highlight=1 + endif "}}} "EMMET: {{{ @@ -27,7 +39,7 @@ let g:use_emmet_complete_tag=1 let g:user_emmet_mode='a' - autocmd FileType css,json,htm,html,php,aspx EmmetInstall + autocmd FileType aspnet,html,xhtml,php,css,javascript,json EmmetInstall if filereadable("~/.vim/snippets.json") let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.vim/snippets.json')), "\n")) @@ -69,7 +81,7 @@ "}}} "MATCHTAGALWAYS: {{{ - let g:mta_filetypes = {'aspnet':1, 'html':1, 'xhtml':1, 'xml':1, 'php':1, 'jinja':1} + let g:mta_filetypes = {'aspnet':1, 'html':1, 'xhtml':1, 'php':1, 'xml':1, 'jinja':1} "}}} "NEOCOMPLCACHE AUTOCOMPLETION PLUGIN: {{{ @@ -96,6 +108,7 @@ let g:neocomplcache_omni_patterns.css='^\s\+\w+\|\w+[):;]?\s\+\|[@!]' let g:neocomplcache_omni_patterns.less='^\s\+\w+\|\w+[):;]?\s\+\|[@!]' let g:neocomplcache_omni_patterns.javascript='[^. \t]\.\%(\h\w*\)\?' + let g:neocomplcache_omni_patterns.json='[^. \t]\.\%(\h\w*\)\?' let g:neocomplcache_omni_patterns.python='[^. *\t]\.\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.ruby='[^. *\t]\.\w*\|\h\w*::' let g:neocomplcache_omni_patterns.php='[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' @@ -127,9 +140,11 @@ if (g:autostartchecker == 1) let g:syntastic_mode_map = {'mode':'active','active_filetypes':[],'passive_filetypes':[]} let g:syntastic_check_on_open=1 + let g:syntastic_check_on_wq=1 else let g:syntastic_mode_map = {'mode':'passive','active_filetypes':[],'passive_filetypes':[]} let g:syntastic_check_on_open=0 + let g:syntastic_check_on_wq=0 endif let g:syntastic_always_populate_loc_list=1 @@ -143,7 +158,6 @@ if !exists("g:autostarttagbar") let g:autostarttagbar=0 endif - if !&diff if (g:autostarttagbar == 1) autocmd VimEnter * nested :call tagbar#autoopen(1) diff --git a/vimrc b/vimrc index 65d1703..b353ac9 100644 --- a/vimrc +++ b/vimrc @@ -37,12 +37,12 @@ "Load Keymappings: runtime config/keyboard.vim - "Load After Config: - runtime config/after.vim - "Load User Config: runtime vimrc.user + "Load After Config: + runtime config/after.vim + "Load Plugin Configuration: runtime config/plugins.vim