mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 10:10:04 +08:00
Fix data dir (#4409)
This commit is contained in:
parent
b518b77e49
commit
1e4cb1f295
@ -257,7 +257,7 @@ endif
|
|||||||
""
|
""
|
||||||
" Set the cache directory of plugins. Default is `$data_dir/vimfiles`.
|
" Set the cache directory of plugins. Default is `$data_dir/vimfiles`.
|
||||||
" >
|
" >
|
||||||
" let g:spacevim_plugin_bundle_dir = g:spacevim_data_dir.'/vimplugs'
|
" let g:spacevim_plugin_bundle_dir = g:spacevim_data_dir.'vimplugs'
|
||||||
" <
|
" <
|
||||||
let g:spacevim_plugin_bundle_dir
|
let g:spacevim_plugin_bundle_dir
|
||||||
\ = g:spacevim_data_dir . join(['vimfiles', ''],
|
\ = g:spacevim_data_dir . join(['vimfiles', ''],
|
||||||
|
@ -177,7 +177,7 @@ function! SpaceVim#custom#write(force) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:path_to_fname(path) abort
|
function! s:path_to_fname(path) abort
|
||||||
return expand(g:spacevim_data_dir.'/SpaceVim/conf/') . substitute(a:path, '[\\/:;.]', '_', 'g') . '.json'
|
return expand(g:spacevim_data_dir.'SpaceVim/conf/') . substitute(a:path, '[\\/:;.]', '_', 'g') . '.json'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#custom#load() abort
|
function! SpaceVim#custom#load() abort
|
||||||
@ -233,7 +233,7 @@ function! s:load_glob_conf() abort
|
|||||||
if filereadable(global_dir . 'init.toml')
|
if filereadable(global_dir . 'init.toml')
|
||||||
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
||||||
let local_conf = global_dir . 'init.toml'
|
let local_conf = global_dir . 'init.toml'
|
||||||
let local_conf_cache = s:FILE.unify_path(expand(g:spacevim_data_dir.'/SpaceVim/conf/' . fnamemodify(resolve(local_conf), ':t:r') . '.json'))
|
let local_conf_cache = s:FILE.unify_path(expand(g:spacevim_data_dir . 'SpaceVim/conf/' . fnamemodify(resolve(local_conf), ':t:r') . '.json'))
|
||||||
let &rtp = global_dir . ',' . &rtp . ',' . global_dir . 'after'
|
let &rtp = global_dir . ',' . &rtp . ',' . global_dir . 'after'
|
||||||
if getftime(resolve(local_conf)) < getftime(resolve(local_conf_cache))
|
if getftime(resolve(local_conf)) < getftime(resolve(local_conf_cache))
|
||||||
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
|
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
|
||||||
|
@ -78,9 +78,9 @@ function! SpaceVim#default#options() abort
|
|||||||
set undolevels=1000
|
set undolevels=1000
|
||||||
" Neovim 0.5 changed the undofile format
|
" Neovim 0.5 changed the undofile format
|
||||||
if has('nvim-0.5.0')
|
if has('nvim-0.5.0')
|
||||||
let g:data_dir = g:spacevim_data_dir.'/SpaceVim/'
|
let g:data_dir = g:spacevim_data_dir.'SpaceVim/'
|
||||||
else
|
else
|
||||||
let g:data_dir = g:spacevim_data_dir.'/SpaceVim/old/'
|
let g:data_dir = g:spacevim_data_dir.'SpaceVim/old/'
|
||||||
endif
|
endif
|
||||||
let g:backup_dir = g:data_dir . 'backup//'
|
let g:backup_dir = g:data_dir . 'backup//'
|
||||||
let g:swap_dir = g:data_dir . 'swap//'
|
let g:swap_dir = g:data_dir . 'swap//'
|
||||||
|
@ -91,8 +91,8 @@ function! SpaceVim#layers#colorscheme#config() abort
|
|||||||
" {"frequency" : "dalily", "last" : 000000, 'theme' : 'one'}
|
" {"frequency" : "dalily", "last" : 000000, 'theme' : 'one'}
|
||||||
" FIXME: when global config cache is updated, check the cache also should
|
" FIXME: when global config cache is updated, check the cache also should
|
||||||
" be updated
|
" be updated
|
||||||
if filereadable(expand(g:spacevim_data_dir.'/SpaceVim/colorscheme_frequency.json'))
|
if filereadable(expand(g:spacevim_data_dir.'SpaceVim/colorscheme_frequency.json'))
|
||||||
let conf = s:JSON.json_decode(join(readfile(expand(g:spacevim_data_dir.'/SpaceVim/colorscheme_frequency.json'), ''), ''))
|
let conf = s:JSON.json_decode(join(readfile(expand(g:spacevim_data_dir.'SpaceVim/colorscheme_frequency.json'), ''), ''))
|
||||||
if s:random_frequency !=# '' && !empty(conf)
|
if s:random_frequency !=# '' && !empty(conf)
|
||||||
let ctime = localtime()
|
let ctime = localtime()
|
||||||
if index(s:random_candidates, get(conf, 'theme', '')) == -1 ||
|
if index(s:random_candidates, get(conf, 'theme', '')) == -1 ||
|
||||||
@ -124,7 +124,7 @@ function! s:update_conf() abort
|
|||||||
\ 'last' : localtime(),
|
\ 'last' : localtime(),
|
||||||
\ 'theme' : g:spacevim_colorscheme
|
\ 'theme' : g:spacevim_colorscheme
|
||||||
\ }
|
\ }
|
||||||
call writefile([s:JSON.json_encode(conf)], expand(g:spacevim_data_dir.'/SpaceVim/colorscheme_frequency.json'))
|
call writefile([s:JSON.json_encode(conf)], expand(g:spacevim_data_dir.'SpaceVim/colorscheme_frequency.json'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,12 +124,12 @@ function! s:install_manager() abort
|
|||||||
let &rtp .= ',' . g:_spacevim_root_dir . 'bundle/dein.vim/'
|
let &rtp .= ',' . g:_spacevim_root_dir . 'bundle/dein.vim/'
|
||||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||||
"auto install vim-plug
|
"auto install vim-plug
|
||||||
if filereadable(expand(g:spacevim_data_dir.'/vim-plug/autoload/plug.vim'))
|
if filereadable(expand(g:spacevim_data_dir.'vim-plug/autoload/plug.vim'))
|
||||||
let g:_spacevim_vim_plug_installed = 1
|
let g:_spacevim_vim_plug_installed = 1
|
||||||
else
|
else
|
||||||
if executable('curl')
|
if executable('curl')
|
||||||
exec '!curl -fLo '
|
exec '!curl -fLo '
|
||||||
\ . g:spacevim_data_dir.'/vim-plug/autoload/plug.vim'
|
\ . g:spacevim_data_dir.'vim-plug/autoload/plug.vim'
|
||||||
\ . ' --create-dirs '
|
\ . ' --create-dirs '
|
||||||
\ . 'https://raw.githubusercontent.com/'
|
\ . 'https://raw.githubusercontent.com/'
|
||||||
\ . 'junegunn/vim-plug/master/plug.vim'
|
\ . 'junegunn/vim-plug/master/plug.vim'
|
||||||
|
@ -46,8 +46,8 @@ let s:grep_timer_id = -1
|
|||||||
let s:preview_timer_id = -1
|
let s:preview_timer_id = -1
|
||||||
let s:grepid = 0
|
let s:grepid = 0
|
||||||
function! s:read_histroy() abort
|
function! s:read_histroy() abort
|
||||||
if filereadable(expand(g:spacevim_data_dir.'/SpaceVim/flygrep_history'))
|
if filereadable(expand(g:spacevim_data_dir.'SpaceVim/flygrep_history'))
|
||||||
let _his = s:JSON.json_decode(join(readfile(expand(g:spacevim_data_dir.'/SpaceVim/flygrep_history'), ''), ''))
|
let _his = s:JSON.json_decode(join(readfile(expand(g:spacevim_data_dir.'SpaceVim/flygrep_history'), ''), ''))
|
||||||
if type(_his) ==# type([])
|
if type(_his) ==# type([])
|
||||||
return _his
|
return _his
|
||||||
else
|
else
|
||||||
@ -62,10 +62,10 @@ function! s:update_history() abort
|
|||||||
call remove(s:grep_history, index(s:grep_history, s:grep_expr))
|
call remove(s:grep_history, index(s:grep_history, s:grep_expr))
|
||||||
endif
|
endif
|
||||||
call add(s:grep_history, s:grep_expr)
|
call add(s:grep_history, s:grep_expr)
|
||||||
if !isdirectory(expand(g:spacevim_data_dir.'/SpaceVim'))
|
if !isdirectory(expand(g:spacevim_data_dir.'SpaceVim'))
|
||||||
call mkdir(expand(g:spacevim_data_dir.'/SpaceVim'))
|
call mkdir(expand(g:spacevim_data_dir.'SpaceVim'))
|
||||||
endif
|
endif
|
||||||
call writefile([s:JSON.json_encode(s:grep_history)], expand(g:spacevim_data_dir.'/SpaceVim/flygrep_history'))
|
call writefile([s:JSON.json_encode(s:grep_history)], expand(g:spacevim_data_dir.'SpaceVim/flygrep_history'))
|
||||||
endfunction
|
endfunction
|
||||||
let s:grep_history = s:read_histroy()
|
let s:grep_history = s:read_histroy()
|
||||||
let s:complete_input_history_num = [0,0]
|
let s:complete_input_history_num = [0,0]
|
||||||
|
@ -228,7 +228,7 @@ function! s:copy_tab() abort
|
|||||||
let s:copy_tab_name = gettabvar(cursor_tab, '_spacevim_tab_name', '')
|
let s:copy_tab_name = gettabvar(cursor_tab, '_spacevim_tab_name', '')
|
||||||
exe 'tabnext ' . cursor_tab
|
exe 'tabnext ' . cursor_tab
|
||||||
let save_sessionopts = &sessionoptions
|
let save_sessionopts = &sessionoptions
|
||||||
let tabsession = g:spacevim_data_dir.'/SpaceVim/tabmanager_session.vim'
|
let tabsession = g:spacevim_data_dir.'SpaceVim/tabmanager_session.vim'
|
||||||
let &sessionoptions = 'winsize'
|
let &sessionoptions = 'winsize'
|
||||||
exe 'mksession! ' . tabsession
|
exe 'mksession! ' . tabsession
|
||||||
exe 'tabnext ' . current_tab
|
exe 'tabnext ' . current_tab
|
||||||
@ -251,7 +251,7 @@ function! s:paste_tab() abort
|
|||||||
let current_tab = tabpagenr()
|
let current_tab = tabpagenr()
|
||||||
let tabid = s:get_cursor_tabnr()
|
let tabid = s:get_cursor_tabnr()
|
||||||
silent! exe tabid . 'tabnew '
|
silent! exe tabid . 'tabnew '
|
||||||
silent! exe 'so '.g:spacevim_data_dir.'/SpaceVim/tabmanager_session.vim'
|
silent! exe 'so '.g:spacevim_data_dir.'SpaceVim/tabmanager_session.vim'
|
||||||
call settabvar(tabpagenr(),
|
call settabvar(tabpagenr(),
|
||||||
\ 'spacevim_tabman_expandable',
|
\ 'spacevim_tabman_expandable',
|
||||||
\ s:copy_tab_expand_status)
|
\ s:copy_tab_expand_status)
|
||||||
|
@ -18,7 +18,7 @@ let g:ctrlp_show_hidden = get(g:, 'ctrlp_show_hidden', 1)
|
|||||||
"for caching
|
"for caching
|
||||||
let g:ctrlp_use_caching = get(g:, 'ctrlp_use_caching', 500)
|
let g:ctrlp_use_caching = get(g:, 'ctrlp_use_caching', 500)
|
||||||
let g:ctrlp_clear_cache_on_exit = get(g:, 'ctrlp_clear_cache_on_exit', 1)
|
let g:ctrlp_clear_cache_on_exit = get(g:, 'ctrlp_clear_cache_on_exit', 1)
|
||||||
let g:ctrlp_cache_dir = get(g:, 'ctrlp_cache_dir', get(g:, 'spacevim_data_dir', '~') . '/ctrlp')
|
let g:ctrlp_cache_dir = get(g:, 'ctrlp_cache_dir', get(g:, 'spacevim_data_dir', '~') . 'ctrlp')
|
||||||
"let g:ctrlp_map = ',,'
|
"let g:ctrlp_map = ',,'
|
||||||
"let g:ctrlp_open_multiple_files = 'v'
|
"let g:ctrlp_open_multiple_files = 'v'
|
||||||
"if you have install ag, the g:ctrlp_custom_ignore will not work
|
"if you have install ag, the g:ctrlp_custom_ignore will not work
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
let g:neocomplete#data_directory= get(g:, 'neocomplete#data_directory',
|
let g:neocomplete#data_directory= get(g:, 'neocomplete#data_directory',
|
||||||
\ g:spacevim_data_dir.'/neocomplete')
|
\ g:spacevim_data_dir.'neocomplete')
|
||||||
let g:acp_enableAtStartup = get(g:, 'acp_enableAtStartup', 0)
|
let g:acp_enableAtStartup = get(g:, 'acp_enableAtStartup', 0)
|
||||||
let g:neocomplete#enable_at_startup =
|
let g:neocomplete#enable_at_startup =
|
||||||
\ get(g:, 'neocomplete#enable_at_startup', 1)
|
\ get(g:, 'neocomplete#enable_at_startup', 1)
|
||||||
|
@ -37,7 +37,7 @@ let g:unite_source_file_rec_max_depth = get(g:,
|
|||||||
\ 'unite_source_file_rec_max_depth', 6)
|
\ 'unite_source_file_rec_max_depth', 6)
|
||||||
let g:unite_enable_ignore_case = get(g:, 'unite_enable_ignore_case', 1)
|
let g:unite_enable_ignore_case = get(g:, 'unite_enable_ignore_case', 1)
|
||||||
let g:unite_enable_smart_case = get(g:, 'unite_enable_smart_case', 1)
|
let g:unite_enable_smart_case = get(g:, 'unite_enable_smart_case', 1)
|
||||||
let g:unite_data_directory = get(g:, 'unite_data_directory',g:spacevim_data_dir.'/unite')
|
let g:unite_data_directory = get(g:, 'unite_data_directory',g:spacevim_data_dir.'unite')
|
||||||
"let g:unite_enable_start_insert=1
|
"let g:unite_enable_start_insert=1
|
||||||
let g:unite_source_history_yank_enable = get(g:,
|
let g:unite_source_history_yank_enable = get(g:,
|
||||||
\ 'unite_source_history_yank_enable', 1)
|
\ 'unite_source_history_yank_enable', 1)
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
let g:gutentags_cache_dir = get(g:, 'gutentags_cache_dir', expand(g:spacevim_data_dir.'/tags'))
|
let g:gutentags_cache_dir = get(g:, 'gutentags_cache_dir', expand(g:spacevim_data_dir.'tags'))
|
||||||
let g:gutentags_modules = get(g:, 'gutentags_modules', ['ctags', 'gtags_cscope'])
|
let g:gutentags_modules = get(g:, 'gutentags_modules', ['ctags', 'gtags_cscope'])
|
||||||
|
@ -871,7 +871,7 @@ set `~/.cache¸.
|
|||||||
*g:spacevim_plugin_bundle_dir*
|
*g:spacevim_plugin_bundle_dir*
|
||||||
Set the cache directory of plugins. Default is `$data_dir/vimfiles`.
|
Set the cache directory of plugins. Default is `$data_dir/vimfiles`.
|
||||||
>
|
>
|
||||||
let g:spacevim_plugin_bundle_dir = g:spacevim_data_dir.'/vimplugs'
|
let g:spacevim_plugin_bundle_dir = g:spacevim_data_dir.'vimplugs'
|
||||||
<
|
<
|
||||||
|
|
||||||
*g:spacevim_realtime_leader_guide*
|
*g:spacevim_realtime_leader_guide*
|
||||||
|
@ -3,13 +3,14 @@ local sp = require('spacevim')
|
|||||||
local cmp = require('spacevim.api').import('vim.compatible')
|
local cmp = require('spacevim.api').import('vim.compatible')
|
||||||
local cmd = require('spacevim').cmd
|
local cmd = require('spacevim').cmd
|
||||||
local sp_file = require('spacevim.api').import('file')
|
local sp_file = require('spacevim.api').import('file')
|
||||||
|
local sp_opt = require('spacevim.opt')
|
||||||
local sp_json = require('spacevim.api').import('data.json')
|
local sp_json = require('spacevim.api').import('data.json')
|
||||||
local logger = require('spacevim.logger').derive('a.vim')
|
local logger = require('spacevim.logger').derive('a.vim')
|
||||||
|
|
||||||
local alternate_conf = {}
|
local alternate_conf = {}
|
||||||
alternate_conf['_'] = '.project_alt.json'
|
alternate_conf['_'] = '.project_alt.json'
|
||||||
|
|
||||||
local cache_path = sp_file.unify_path(sp.eval('g:spacevim_data_dir'), ':p') .. 'SpaceVim/a.json'
|
local cache_path = sp_file.unify_path(sp_opt.data_dir, ':p') .. 'SpaceVim/a.json'
|
||||||
|
|
||||||
|
|
||||||
local project_config = {}
|
local project_config = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user