1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:20:05 +08:00

disable autochange dir - fix option

This commit is contained in:
Sarunas Valaskevicius 2018-12-19 15:59:41 +00:00
parent 5a5cd8280b
commit ee7e5b6af1
2 changed files with 32 additions and 36 deletions

View File

@ -20,10 +20,10 @@
" SpaceVim uses `~/.SpaceVim.d/init.toml` as its default global config file. " 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 " 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. " 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. " settings in `.SpaceVim.d/init.toml` in the root directory of your project.
" `.SpaceVim.d/` will also be added to runtimepath. " `.SpaceVim.d/` will also be added to runtimepath.
" "
" here is an example setting SpaceVim options: " here is an example setting SpaceVim options:
" > " >
" [options] " [options]
@ -124,7 +124,7 @@ let g:spacevim_enable_googlesuggest = 0
"" ""
" @section windows_leader, options-windows_leader " @section windows_leader, options-windows_leader
" @parentsection options " @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. " Set to empty to disable this feature, or you can set to another char.
" > " >
" windows_leader = "" " 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. " Set to empty to disable this feature, or you can set to another char.
" > " >
" let g:spacevim_windows_leader = '' " 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: " Define the left section of statusline in active windows. By default:
" > " >
" let g:spacevim_statusline_left_sections = " let g:spacevim_statusline_left_sections =
" \ [ " \ [
" \ 'winnr', " \ 'winnr',
" \ 'filename', " \ 'filename',
@ -430,7 +430,7 @@ let g:spacevim_warning_symbol = '⚠'
" < " <
let g:spacevim_info_symbol = SpaceVim#api#import('messletters').circled_letter('i') 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. " 0 : to prevent Nvim from changing the cursor shape.
" 1 : to enable non-blinking mode-sensitive cursor. " 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 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. " You can change it to Chinese.
" > " >
" let g:spacevim_vim_help_language = 'cn' " let g:spacevim_vim_help_language = 'cn'
@ -466,8 +466,8 @@ let g:spacevim_colorscheme = 'gruvbox'
" The background of colorscheme. Default is 'dark'. " The background of colorscheme. Default is 'dark'.
let g:spacevim_colorscheme_bg = 'dark' let g:spacevim_colorscheme_bg = 'dark'
"" ""
" The default colorscheme of SpaceVim. Default is 'desert'. " The default colorscheme of SpaceVim. Default is 'desert'.
" This colorscheme will be used if the colorscheme set by " This colorscheme will be used if the colorscheme set by
" `g:spacevim_colorscheme` is not installed. " `g:spacevim_colorscheme` is not installed.
" > " >
" let g:spacevim_colorscheme_default = 'other_color' " 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. " Set SpaceVim buffer index type, default is 0.
" > " >
" " types: " " types:
" " 0: 1 ➛ ➊ " " 0: 1 ➛ ➊
" " 1: 1 ➛ ➀ " " 1: 1 ➛ ➀
" " 2: 1 ➛ ⓵ " " 2: 1 ➛ ⓵
" " 3: 1 ➛ ¹ " " 3: 1 ➛ ¹
@ -561,7 +561,7 @@ let g:spacevim_buffer_index_type = 0
" Set SpaceVim windows index type, default is 0. " Set SpaceVim windows index type, default is 0.
" > " >
" " types: " " types:
" " 0: 1 ➛ ➊ " " 0: 1 ➛ ➊
" " 1: 1 ➛ ➀ " " 1: 1 ➛ ➀
" " 2: 1 ➛ ⓵ " " 2: 1 ➛ ⓵
" " 3: 1 ➛ 1 " " 3: 1 ➛ 1
@ -604,7 +604,7 @@ let g:spacevim_custom_plugins = []
let g:spacevim_filetype_icons = {} let g:spacevim_filetype_icons = {}
"" ""
" SpaceVim will load the global config after local config if set to 1. Default " 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 " 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 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 " 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 " let g:spacevim_enable_vimfiler_welcome = 0
" < " <
@ -746,7 +746,7 @@ endif
let g:spacevim_leader_guide_max_size = 0 let g:spacevim_leader_guide_max_size = 0
if !exists('g:leaderGuide_submode_mappings') if !exists('g:leaderGuide_submode_mappings')
let g:leaderGuide_submode_mappings = let g:leaderGuide_submode_mappings =
\ { '<C-C>': 'win_close', 'n': 'page_down', 'p': 'page_up', 'u' : 'undo'} \ { '<C-C>': 'win_close', 'n': 'page_down', 'p': 'page_up', 'u' : 'undo'}
endif endif
@ -915,7 +915,6 @@ function! SpaceVim#begin() abort
augroup END augroup END
else else
call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) ) call SpaceVim#logger#info('Startup with argv: ' . string(s:status[1]) )
call SpaceVim#plugins#projectmanager#current_root()
endif endif
call SpaceVim#default#options() call SpaceVim#default#options()
call SpaceVim#default#layers() call SpaceVim#default#layers()
@ -941,7 +940,7 @@ function! SpaceVim#welcome() abort
endif endif
if g:spacevim_enable_vimfiler_welcome if g:spacevim_enable_vimfiler_welcome
\ && get(g:, '_spacevim_checking_flag', 0) == 0 \ && get(g:, '_spacevim_checking_flag', 0) == 0
if exists(':VimFiler') == 2 if exists(':VimFiler') == 2
VimFiler VimFiler
wincmd p wincmd p
endif endif
@ -950,7 +949,7 @@ endfunction
"" ""
" @section FAQ, faq " @section FAQ, faq
"1. How do I enable YouCompleteMe? "1. How do I enable YouCompleteMe?
" > " >
" I do not recommend using 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 " 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 " 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` " 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. " command. A buffer will be opened and you can add your custom snippet.
" By default this buffer will be save in `~/.SpaceVim/snippets`. " By default this buffer will be save in `~/.SpaceVim/snippets`.
" If you want to use another directory: " If you want to use another directory:
" "
" let g:neosnippet#snippets_directory = '~/path/to/snip_dir' " 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|. " read |neosnippet-snippet-syntax|.
" < " <
" "
@ -999,7 +998,7 @@ endfunction
"" ""
" @section Changelog, changelog " @section Changelog, changelog
" Following HEAD: changes in master branch since last release v0.7.0 " Following HEAD: changes in master branch since last release v0.7.0
" "
" https://github.com/SpaceVim/SpaceVim/wiki/Following-HEAD " https://github.com/SpaceVim/SpaceVim/wiki/Following-HEAD
" "
" 2018-03-19: v0.7.0 " 2018-03-19: v0.7.0

View File

@ -81,10 +81,16 @@ endfunction
function! SpaceVim#plugins#projectmanager#current_root() abort function! SpaceVim#plugins#projectmanager#current_root() abort
let rootdir = getbufvar('%', 'rootDir', '') let rootdir = getbufvar('%', 'rootDir', '')
if empty(rootdir) if empty(rootdir)
let rootdir = s:change_to_root_directory() let rootdir = s:find_root_directory()
else 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 s:change_dir(rootdir)
call SpaceVim#plugins#projectmanager#RootchandgeCallback() call SpaceVim#plugins#projectmanager#RootchandgeCallback()
endif endif
return rootdir return rootdir
endfunction endfunction
@ -160,9 +166,7 @@ function! s:sort_dirs(dirs) abort
else else
let dir = fnamemodify(dir, ':p:h') let dir = fnamemodify(dir, ':p:h')
endif endif
call s:change_dir(dir) return dir
call setbufvar('%', 'rootDir', getcwd())
return b:rootDir
endif endif
endfunction endfunction
@ -170,12 +174,5 @@ function! s:compare(d1, d2) abort
return len(split(a:d2, '/')) - len(split(a:d1, '/')) return len(split(a:d2, '/')) - len(split(a:d1, '/'))
endfunction 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: " vim:set et nowrap sw=2 cc=80: