From ef9202c1c78261e02aa2def7af34b5053a84e824 Mon Sep 17 00:00:00 2001 From: tracyone Date: Thu, 21 Sep 2023 21:21:42 +0800 Subject: [PATCH] project:fix session restore issue Signed-off-by: tracyone --- autoload/te/autocmds.vim | 3 +++ autoload/te/feat.vim | 2 +- autoload/te/project.vim | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autoload/te/autocmds.vim b/autoload/te/autocmds.vim index 0551044..f497afb 100644 --- a/autoload/te/autocmds.vim +++ b/autoload/te/autocmds.vim @@ -26,4 +26,7 @@ function! te#autocmds#file_type() abort if g:complete_plugin_type.cur_val == 'coc.nvim' call CocCheckExtensions() endif + if type(get(g:, 'vinux_project_name')) == g:t_string + call te#project#set_indent_options(g:vinux_coding_style.cur_val) + endif endfunction diff --git a/autoload/te/feat.vim b/autoload/te/feat.vim index 977f338..e09fcec 100644 --- a/autoload/te/feat.vim +++ b/autoload/te/feat.vim @@ -45,7 +45,7 @@ function! te#feat#gen_feature_vim(reset) abort let l:temp2=te#feat#get_vim_version() let l:vinux_version=te#compatiable#systemlist('git describe') if type(l:vinux_version) == g:t_number || v:shell_error != 0 - let g:vinux_version='vinux V1.8.8'.' @'.l:temp2[0].'.'.l:temp2[1] + let g:vinux_version='vinux V1.8.9'.' @'.l:temp2[0].'.'.l:temp2[1] else let l:temp = matchstr(l:vinux_version[-1],'.*\(-\d\+-\w\+\)\@=') if l:temp !=# '' diff --git a/autoload/te/project.vim b/autoload/te/project.vim index 9bddd09..86ceac5 100644 --- a/autoload/te/project.vim +++ b/autoload/te/project.vim @@ -9,9 +9,9 @@ function! te#project#set_indent_options(coding_style) let g:vinux_coding_style.cur_val = a:coding_style if a:coding_style ==# 'linux' let g:vinux_tabwidth=8 - :silent! bufdo set textwidth=80 - :silent! bufdo set noexpandtab - :silent! bufdo set nosmarttab + :set textwidth=80 + :set noexpandtab + :set nosmarttab elseif a:coding_style ==# 'mozilla' let g:vinux_tabwidth=4 elseif a:coding_style ==# 'google' @@ -23,9 +23,9 @@ function! te#project#set_indent_options(coding_style) else let g:vinux_tabwidth=4 endif - execute 'silent! bufdo set tabstop='.g:vinux_tabwidth - execute 'silent! bufdo set shiftwidth='.g:vinux_tabwidth - execute 'silent! bufdo set softtabstop='.g:vinux_tabwidth + execute 'silent! set tabstop='.g:vinux_tabwidth + execute 'silent! set shiftwidth='.g:vinux_tabwidth + execute 'silent! set softtabstop='.g:vinux_tabwidth endfunction "create a project "1. session @@ -35,7 +35,7 @@ endfunction function! te#project#create_project() abort let l:project_exist = 0 let l:default_name=fnamemodify(getcwd(), ':t') - if exists('g:vinux_project_name') && !empty(g:vinux_project_name) + if type(get(g:, 'vinux_project_name')) == g:t_string let l:default_name=g:vinux_project_name let l:project_exist = 1 let l:name = input("Rename or save current project:", l:default_name)