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

Fix Resolve in windows (#2549)

This commit is contained in:
Wang Shidong 2019-02-02 21:59:53 +08:00 committed by GitHub
parent 313a856c7b
commit 4e063bb322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 15 deletions

View File

@ -6,10 +6,11 @@
" License: GPLv3
"=============================================================================
scriptencoding utf-8
let s:has_cache = {}
let s:SYS = SpaceVim#api#import('system')
""
" @section vim#compatible, api-vim-compatible
@ -112,9 +113,11 @@ elseif s:self.has('python3')
\ py3eval('vim.windows[' . a:nr . '].col')]
endfunction
else
" @vimlint(EVL103, 1, a:nr)
function! s:self.win_screenpos(nr) abort
return [0, 0]
endfunction
" @vimlint(EVL103, 0, a:nr)
endif
if exists('*execute')
@ -290,7 +293,7 @@ else
let result = []
" 20 281 23 -invalid-
for info in jumpinfo
let [jump, line, col, file_text] = s:STRING.split(info, '', 0, 4)
let [jump, line, col] = s:STRING.split(info, '', 0, 4)[0:2]
call add(result, {
\ 'bufnr' : jump,
\ 'lnum' : line,
@ -301,6 +304,26 @@ else
endfunction
endif
if s:SYS.isWindows
function! s:self.resolve(path) abort
let cmd = 'dir /a "' . a:path . '" | findstr SYMLINK'
" 2018/12/07 周五 下午 10:23 <SYMLINK> vimfiles [C:\Users\Administrator\.SpaceVim]
" ref: https://superuser.com/questions/524669/checking-where-a-symbolic-link-points-at-in-windows-7
silent let rst = system(cmd)
let @+=rst
if !v:shell_error
let dir = split(rst)[-1][1:-2]
return dir
endif
return a:path
endfunction
else
function! s:self.resolve(path) abort
return resolve(a:path)
endfunction
endif
function! SpaceVim#api#vim#compatible#get() abort
return deepcopy(s:self)

View File

@ -9,6 +9,7 @@
let s:TOML = SpaceVim#api#import('data#toml')
let s:JSON = SpaceVim#api#import('data#json')
let s:FILE = SpaceVim#api#import('file')
let s:CMP = SpaceVim#api#import('vim#compatible')
function! SpaceVim#custom#profile(dict) abort
for key in keys(a:dict)
@ -133,7 +134,7 @@ endfunction
function! SpaceVim#custom#load() abort
" if file .SpaceVim.d/init.toml exist
if filereadable('.SpaceVim.d/init.toml')
let g:_spacevim_config_path = fnamemodify('.SpaceVim.d/init.toml', ':p')
let g:_spacevim_config_path = s:CMP.resolve(fnamemodify('.SpaceVim.d/init.toml', ':p'))
let &rtp = fnamemodify('.SpaceVim.d', ':p:h') . ',' . &rtp
let local_conf = g:_spacevim_config_path
call SpaceVim#logger#info('find local conf: ' . local_conf)
@ -176,11 +177,11 @@ endfunction
function! s:load_glob_conf() abort
let global_dir = empty($SPACEVIMDIR) ? expand('~/.SpaceVim.d') : $SPACEVIMDIR
if filereadable(global_dir . '/init.toml')
let g:_spacevim_global_config_path = global_dir . '/init.toml'
let local_conf = global_dir . '/init.toml'
let local_conf_cache = expand('~/.cache/SpaceVim/conf/init.json')
let global_dir = empty($SPACEVIMDIR) ? s:FILE.unify_path(s:CMP.resolve(expand('~/.SpaceVim.d'))) : $SPACEVIMDIR
if filereadable(global_dir . 'init.toml')
let g:_spacevim_global_config_path = global_dir . 'init.toml'
let local_conf = global_dir . 'init.toml'
let local_conf_cache = s:FILE.unify_path(expand('~/.cache/SpaceVim/conf/init.json'))
let &rtp = global_dir . ',' . &rtp
if getftime(local_conf) < getftime(local_conf_cache)
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
@ -190,9 +191,9 @@ function! s:load_glob_conf() abort
call writefile([s:JSON.json_encode(conf)], local_conf_cache)
call SpaceVim#custom#apply(conf, 'glob')
endif
elseif filereadable(global_dir . '/init.vim')
let g:_spacevim_global_config_path = global_dir . '/init.vim'
let custom_glob_conf = global_dir . '/init.vim'
elseif filereadable(global_dir . 'init.vim')
let g:_spacevim_global_config_path = global_dir . 'init.vim'
let custom_glob_conf = global_dir . 'init.vim'
let &rtp = global_dir . ',' . &rtp
exe 'source ' . custom_glob_conf
else

View File

@ -68,11 +68,11 @@ let s:time = {
\ 'weekly' : 7 * 24 * 60 * 60 * 1000,
\ }
for n in range(1, 23)
call extend(s:time, {n . 'h' : n * 60 * 60 * 1000})
for s:n in range(1, 23)
call extend(s:time, {s:n . 'h' : s:n * 60 * 60 * 1000})
endfor
unlet n
unlet s:n
let s:random_colorscheme = 0
let s:random_frequency = ''
@ -83,6 +83,8 @@ function! SpaceVim#layers#colorscheme#config() abort
" Use local file's save time, the local file is
" ~/.cache/SpaceVim/colorscheme_frequence.json
" {"fequecnce" : "dalily", "last" : 000000, 'theme' : 'one'}
" FIXME: when global config cache is updated, check the cache also should
" be updated
if filereadable(expand('~/.cache/SpaceVim/colorscheme_frequence.json'))
let conf = s:JSON.json_decode(join(readfile(expand('~/.cache/SpaceVim/colorscheme_frequence.json'), ''), ''))
if s:random_frequency !=# '' && !empty(conf)

View File

@ -17,7 +17,7 @@ function! SpaceVim#layers#lang#vim#plugins() abort
\ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}],
\ ]
call add(plugins,['tweekmonster/exception.vim', {'merged' : 0}])
call add(plugins,['mhinz/vim-lookup', {'merged' : 0}])
call add(plugins,['wsdjeg/vim-lookup', {'merged' : 0}])
call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}])
if g:spacevim_autocomplete_method ==# 'asyncomplete'
call add(plugins, ['prabirshrestha/asyncomplete-necovim.vim', {

View File

@ -13,6 +13,7 @@ SpaceVim 组织正常维护的仓库有如下这些,其中 `SpaceVim/SpaceVim`
| [SpaceVim/vim-luacomplete](https://github.com/SpaceVim/vim-luacomplete) | lua complete plugin for vim |
| [SpaceVim/unite-unicode](https://github.com/SpaceVim/unite-unicode) | Unite.vim plugin to insert unicode gyphs |
| [SpaceVim/vim-material](https://github.com/SpaceVim/vim-material) | Vim colorscheme inspired by equinusocio's Material Theme |
| [wsdjeg/vim-lookup](https://github.com/wsdjeg/vim-lookup) | A fork of mhinz/vim-lookup, base on SpaceVim API |
主仓库的文件结构如下:

View File

@ -13,6 +13,7 @@ This is the project layout of SpaceVim org:
| [SpaceVim/vim-luacomplete](https://github.com/SpaceVim/vim-luacomplete) | lua complete plugin for vim |
| [SpaceVim/unite-unicode](https://github.com/SpaceVim/unite-unicode) | Unite.vim plugin to insert unicode gyphs |
| [SpaceVim/vim-material](https://github.com/SpaceVim/vim-material) | Vim colorscheme inspired by equinusocio's Material Theme |
| [wsdjeg/vim-lookup](https://github.com/wsdjeg/vim-lookup) | A fork of mhinz/vim-lookup, base on SpaceVim API |
In the main repo, the layout is: