From ee7e5b6af116f065070bf4fbcbf286a634a0a7aa Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Wed, 19 Dec 2018 15:59:41 +0000 Subject: [PATCH 1/4] disable autochange dir - fix option --- autoload/SpaceVim.vim | 45 ++++++++++---------- autoload/SpaceVim/plugins/projectmanager.vim | 23 +++++----- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index b78cdea66..6b8f16cc9 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -20,10 +20,10 @@ " SpaceVim uses `~/.SpaceVim.d/init.toml` as its default global config file. " You can set all the SpaceVim options and layers in it. `~/.SpaceVim.d/` will " also be added to runtimepath, so you can write your own scripts in it. -" SpaceVim also supports local config for each project. Place local config +" SpaceVim also supports local config for each project. Place local config " settings in `.SpaceVim.d/init.toml` in the root directory of your project. " `.SpaceVim.d/` will also be added to runtimepath. -" +" " here is an example setting SpaceVim options: " > " [options] @@ -124,7 +124,7 @@ let g:spacevim_enable_googlesuggest = 0 "" " @section windows_leader, options-windows_leader " @parentsection options -" Window functions leader for SpaceVim. Default is `s`. +" Window functions leader for SpaceVim. Default is `s`. " Set to empty to disable this feature, or you can set to another char. " > " windows_leader = "" @@ -132,7 +132,7 @@ let g:spacevim_enable_googlesuggest = 0 "" -" Window functions leader for SpaceVim. Default is `s`. +" Window functions leader for SpaceVim. Default is `s`. " Set to empty to disable this feature, or you can set to another char. " > " let g:spacevim_windows_leader = '' @@ -330,7 +330,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow' "" " Define the left section of statusline in active windows. By default: " > -" let g:spacevim_statusline_left_sections = +" let g:spacevim_statusline_left_sections = " \ [ " \ 'winnr', " \ 'filename', @@ -430,7 +430,7 @@ let g:spacevim_warning_symbol = '⚠' " < let g:spacevim_info_symbol = SpaceVim#api#import('messletters').circled_letter('i') "" -" Set the SpaceVim cursor shape in the terminal. +" Set the SpaceVim cursor shape in the terminal. " > " 0 : to prevent Nvim from changing the cursor shape. " 1 : to enable non-blinking mode-sensitive cursor. @@ -444,7 +444,7 @@ let g:spacevim_info_symbol = SpaceVim#api#import('messletters').circ " < let g:spacevim_terminal_cursor_shape = 2 "" -" Set the help language of vim. Default is 'en'. +" Set the help language of vim. Default is 'en'. " You can change it to Chinese. " > " let g:spacevim_vim_help_language = 'cn' @@ -466,8 +466,8 @@ let g:spacevim_colorscheme = 'gruvbox' " The background of colorscheme. Default is 'dark'. let g:spacevim_colorscheme_bg = 'dark' "" -" The default colorscheme of SpaceVim. Default is 'desert'. -" This colorscheme will be used if the colorscheme set by +" The default colorscheme of SpaceVim. Default is 'desert'. +" This colorscheme will be used if the colorscheme set by " `g:spacevim_colorscheme` is not installed. " > " let g:spacevim_colorscheme_default = 'other_color' @@ -549,7 +549,7 @@ let g:spacevim_gitcommit_issue_icon = '' " Set SpaceVim buffer index type, default is 0. " > " " types: -" " 0: 1 ➛ ➊ +" " 0: 1 ➛ ➊ " " 1: 1 ➛ ➀ " " 2: 1 ➛ ⓵ " " 3: 1 ➛ ¹ @@ -561,7 +561,7 @@ let g:spacevim_buffer_index_type = 0 " Set SpaceVim windows index type, default is 0. " > " " types: -" " 0: 1 ➛ ➊ +" " 0: 1 ➛ ➊ " " 1: 1 ➛ ➀ " " 2: 1 ➛ ⓵ " " 3: 1 ➛ 1 @@ -604,7 +604,7 @@ let g:spacevim_custom_plugins = [] let g:spacevim_filetype_icons = {} "" " SpaceVim will load the global config after local config if set to 1. Default -" is 0. If you have a local config, the global config will not be loaded. +" is 0. If you have a local config, the global config will not be loaded. " > " let g:spacevim_force_global_config = 1 " < @@ -645,9 +645,9 @@ let g:spacevim_project_rooter_automatically = 1 " < let g:spacevim_lint_on_the_fly = 0 "" -" Enable/Disable vimfiler in the welcome windows. Default is 1. +" Enable/Disable vimfiler in the welcome windows. Default is 1. " This will cause vim to start up slowly if there are too many files in the -" current directory. +" current directory. " > " let g:spacevim_enable_vimfiler_welcome = 0 " < @@ -746,7 +746,7 @@ endif let g:spacevim_leader_guide_max_size = 0 if !exists('g:leaderGuide_submode_mappings') - let g:leaderGuide_submode_mappings = + let g:leaderGuide_submode_mappings = \ { '': 'win_close', 'n': 'page_down', 'p': 'page_up', 'u' : 'undo'} endif @@ -915,7 +915,6 @@ function! SpaceVim#begin() abort augroup END else call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) ) - call SpaceVim#plugins#projectmanager#current_root() endif call SpaceVim#default#options() call SpaceVim#default#layers() @@ -941,7 +940,7 @@ function! SpaceVim#welcome() abort endif if g:spacevim_enable_vimfiler_welcome \ && get(g:, '_spacevim_checking_flag', 0) == 0 - if exists(':VimFiler') == 2 + if exists(':VimFiler') == 2 VimFiler wincmd p endif @@ -950,7 +949,7 @@ endfunction "" " @section FAQ, faq -"1. How do I enable YouCompleteMe? +"1. How do I enable YouCompleteMe? " > " I do not recommend using YouCompleteMe. " It is too big as a vim plugin. Also, I do not like using submodules in a vim @@ -974,13 +973,13 @@ endfunction " > " SpaceVim uses neosnippet as the default snippet engine. If you want to add " a snippet for a vim filetype, open a vim file and run `:NeoSnippetEdit` -" command. A buffer will be opened and you can add your custom snippet. -" By default this buffer will be save in `~/.SpaceVim/snippets`. +" command. A buffer will be opened and you can add your custom snippet. +" By default this buffer will be save in `~/.SpaceVim/snippets`. " If you want to use another directory: " " let g:neosnippet#snippets_directory = '~/path/to/snip_dir' -" -" For more info about how to write snippet, please +" +" For more info about how to write snippet, please " read |neosnippet-snippet-syntax|. " < " @@ -999,7 +998,7 @@ endfunction "" " @section Changelog, changelog " Following HEAD: changes in master branch since last release v0.7.0 -" +" " https://github.com/SpaceVim/SpaceVim/wiki/Following-HEAD " " 2018-03-19: v0.7.0 diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index ee9a8bf1f..d1516edef 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -81,10 +81,16 @@ endfunction function! SpaceVim#plugins#projectmanager#current_root() abort let rootdir = getbufvar('%', 'rootDir', '') if empty(rootdir) - let rootdir = s:change_to_root_directory() - else + let rootdir = s:find_root_directory() + if empty(rootdir) + let rootdir = getcwd() + endif + call setbufvar('%', 'rootDir', rootdir) + endif + if !empty(rootdir) && g:spacevim_project_rooter_automatically + echo g:spacevim_project_rooter_automatically call s:change_dir(rootdir) - call SpaceVim#plugins#projectmanager#RootchandgeCallback() + call SpaceVim#plugins#projectmanager#RootchandgeCallback() endif return rootdir endfunction @@ -160,9 +166,7 @@ function! s:sort_dirs(dirs) abort else let dir = fnamemodify(dir, ':p:h') endif - call s:change_dir(dir) - call setbufvar('%', 'rootDir', getcwd()) - return b:rootDir + return dir endif endfunction @@ -170,12 +174,5 @@ function! s:compare(d1, d2) abort return len(split(a:d2, '/')) - len(split(a:d1, '/')) endfunction -function! s:change_to_root_directory() abort - if !empty(s:find_root_directory()) - call SpaceVim#plugins#projectmanager#RootchandgeCallback() - endif - return getbufvar('%', 'rootDir', '') -endfunction - " vim:set et nowrap sw=2 cc=80: From a3f48a198a1b49d46123cb1e32c2a0b4e8ec0aba Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Wed, 19 Dec 2018 16:05:36 +0000 Subject: [PATCH 2/4] update release notes --- wiki/en/Following-HEAD.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wiki/en/Following-HEAD.md b/wiki/en/Following-HEAD.md index 2ee39f6cc..7527a1d3b 100644 --- a/wiki/en/Following-HEAD.md +++ b/wiki/en/Following-HEAD.md @@ -26,7 +26,7 @@ The next release is v1.0.0. ### Changed - Do not load language layer ([#2220](https://github.com/SpaceVim/SpaceVim/pull/2220)) -- Changed the behavior of 2-LeftMouse in vimfiler ([#2221](https://github.com/SpaceVim/SpaceVim/pull/2221)) +- Changed the behavior of 2-LeftMouse in vimfiler ([#2221](https://github.com/SpaceVim/SpaceVim/pull/2221)) - Use forked neoformat repo ([#2360](https://github.com/SpaceVim/SpaceVim/pull/2360), [#2355](https://github.com/SpaceVim/SpaceVim/pull/2355)) ### Fixed @@ -41,6 +41,7 @@ The next release is v1.0.0. - Fix fullscreen key binding ([#2351](https://github.com/SpaceVim/SpaceVim/pull/2351)) - Added missed syntax for detached FlyGrep ([#2353](https://github.com/SpaceVim/SpaceVim/pull/2353), [`08d0713`](https://github.com/SpaceVim/SpaceVim/commit/08d0713c4494ca401942a6ca10a48a1ac8484ce1)) - Fix FlyGrep syntax to support different outputs ([#2363](https://github.com/SpaceVim/SpaceVim/pull/2363), [`0b26f40`](https://github.com/SpaceVim/SpaceVim/commit/0b26f407d879427505418f5c3b4c1d753f3f4317)) +- Fix `project_rooter_automatically = 0` option to not change directory to project root ([#2363](https://github.com/SpaceVim/SpaceVim/pull/2365)) ### Removed From 6210afd2f1d09c2e70b763e07c4550e83623e651 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Wed, 19 Dec 2018 16:09:52 +0000 Subject: [PATCH 3/4] remove debug output --- autoload/SpaceVim/plugins/projectmanager.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index d1516edef..273d691e2 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -88,7 +88,6 @@ function! SpaceVim#plugins#projectmanager#current_root() abort call setbufvar('%', 'rootDir', rootdir) endif if !empty(rootdir) && g:spacevim_project_rooter_automatically - echo g:spacevim_project_rooter_automatically call s:change_dir(rootdir) call SpaceVim#plugins#projectmanager#RootchandgeCallback() endif From c5205aa192a63f9435fc10f054e13f043f2c2441 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Wed, 19 Dec 2018 16:14:20 +0000 Subject: [PATCH 4/4] only check option at the top level --- autoload/SpaceVim/plugins/projectmanager.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index 273d691e2..ce8df4448 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -87,7 +87,7 @@ function! SpaceVim#plugins#projectmanager#current_root() abort endif call setbufvar('%', 'rootDir', rootdir) endif - if !empty(rootdir) && g:spacevim_project_rooter_automatically + if !empty(rootdir) call s:change_dir(rootdir) call SpaceVim#plugins#projectmanager#RootchandgeCallback() endif