Giter Club home page Giter Club logo

Comments (3)

tracyone avatar tracyone commented on August 11, 2024

所有文件不应该放在项目路径下,因为经常需要切换路径,所以应该放在.project下面。

from vinux.

tracyone avatar tracyone commented on August 11, 2024
let g:startify_session_savecmds = []

<
Include a list of cmdline commands which Vim will run upon loading the
session. This can be useful to set various things (other than variables,
|g:startify_session_savevars| above) which Vim may not normally save into the
session file, as well as run external commands upon loading a session.

Example:

let g:startify_session_savecmds = [
       \ 'silent !pdfreader ~/latexproject/main.pdf &'
       \ ]

<

from vinux.

tracyone avatar tracyone commented on August 11, 2024
diff --git a/after/ftplugin/c.vim b/after/ftplugin/c.vim
index 4d9d9dc..05890d2 100644
--- a/after/ftplugin/c.vim
+++ b/after/ftplugin/c.vim
@@ -67,6 +67,22 @@ setlocal cinoptions=:0,l1,t0,g0,(0)
 setlocal comments    =sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/
 setlocal cindent  "enable specific indenting for C code
 setlocal foldmethod=syntax
+
+if g:vinux_coding_style.cur_val == 'linux'
+    let g:vinux_tabwidth=8
+    set textwidth=80
+    set noexpandtab
+    set nosmarttab
+elseif g:vinux_coding_style.cur_val ==# 'mozilla'
+    let g:vinux_tabwidth=4
+elseif g:vinux_coding_style.cur_val ==# 'google'
+    let g:vinux_tabwidth=2
+elseif g:vinux_coding_style.cur_val ==# 'llvm'
+    let g:vinux_tabwidth=4
+elseif g:vinux_coding_style.cur_val ==# 'chromium'
+    let g:vinux_tabwidth=2
+endif
+
 execute 'setlocal tabstop='.g:vinux_tabwidth
 execute 'setlocal shiftwidth='.g:vinux_tabwidth
 execute 'setlocal softtabstop='.g:vinux_tabwidth
diff --git a/autoload/te/project.vim b/autoload/te/project.vim
index 179a8e4..9b7cf40 100644
--- a/autoload/te/project.vim
+++ b/autoload/te/project.vim
@@ -2,9 +2,31 @@
 
 function! te#project#clang_format(A,L,P) abort
     let l:temp=a:A.a:L.a:P
-    return ["LLVM", "GNU", "Google", "Chromium", "Microsoft", "Mozilla", "WebKit", "Linux"]
+    return ["llvm", "gnu", "google", "chromium", "microsoft", "mozilla", "webkit", "linux"]
 endfunction
 
+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
+    elseif a:coding_style ==# 'mozilla'
+        let g:vinux_tabwidth=4
+    elseif a:coding_style ==# 'google'
+        let g:vinux_tabwidth=2
+    elseif a:coding_style ==# 'llvm'
+        let g:vinux_tabwidth=4
+    elseif a:coding_style ==# 'chromium'
+        let g:vinux_tabwidth=2
+    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
+endfunction
 "create a project
 "1. session
 "2. compile flag info
@@ -26,12 +48,6 @@ function! te#project#create_project() abort
             return -1
         endif
     endif
-    "session
-    if exists(":SSave") == 2
-        execute ":SSave ".l:name
-    elseif exists(":SaveSession") == 2
-        execute ":SaveSession ".l:name
-    endif
     "complete flag
     if get(g:, 'feat_enable_complete')
         if g:complete_plugin_type.cur_val ==# 'YouCompleteMe'
@@ -71,6 +87,7 @@ function! te#project#create_project() abort
                 else
                     call te#utils#run_command('clang-format -style='.l:coding_style.' -dump-config > .clang-format', function('te#file#copy_file'), ['.clang-format', l:project_name.'.clang-format'])
                 endif
+                call te#project#set_indent_options(l:coding_style)
             endif
         else
             let l:ret = te#file#copy_file('.clang-format', l:project_name.'.clang-format', 0)
@@ -92,6 +109,12 @@ function! te#project#create_project() abort
         call writefile([getcwd()], ".csdb", "a")
         let l:ret = te#file#copy_file('.csdb', l:project_name)
     endif
+    "session
+    if exists(":SSave") == 2
+        execute ":SSave ".l:name
+    elseif exists(":SaveSession") == 2
+        execute ":SaveSession ".l:name
+    endif
     return 0
 endfunction
 
diff --git a/rc/help.vim b/rc/help.vim
index 0b5b4eb..030ff63 100644
--- a/rc/help.vim
+++ b/rc/help.vim
@@ -24,6 +24,18 @@ let g:startify_change_to_vcs_root = 0
 let g:startify_session_sort = 1
 let g:startify_custom_header = []
 
+let g:startify_session_savevars = [
+            \ 'g:startify_session_savevars',
+            \ 'g:startify_session_savecmds',
+            \ 'g:vinux_coding_style.cur_val',
+            \ ]
+
+let g:startify_session_savecmds = [
+            \ 'call love#Apply()',
+            \ "call te#feat#source_rc('colors.vim')",
+            \ "call te#project#set_indent_options(g:vinux_coding_style.cur_val)"
+            \ ]
+
 let g:startify_commands = [
             \ {'o': [g:vinux_version, 'call te#utils#open_url("https://github.com/tracyone/vinux")']},
             \ {'v': ['Open vimrc', 'call feedkeys("\<Space>vc")']},
diff --git a/rc/options.vim b/rc/options.vim
index 9692f7b..aee2c33 100644
--- a/rc/options.vim
+++ b/rc/options.vim
@@ -92,20 +92,7 @@ endif
 set textwidth=160
 set expandtab
 set smarttab
-if g:vinux_coding_style.cur_val ==# 'linux'
-    let g:vinux_tabwidth=8
-    set textwidth=80
-    set noexpandtab
-    set nosmarttab
-elseif g:vinux_coding_style.cur_val ==# 'mozilla'
-    let g:vinux_tabwidth=4
-elseif g:vinux_coding_style.cur_val ==# 'google'
-    let g:vinux_tabwidth=2
-elseif g:vinux_coding_style.cur_val ==# 'llvm'
-    let g:vinux_tabwidth=4
-elseif g:vinux_coding_style.cur_val ==# 'chromium'
-    let g:vinux_tabwidth=2
-endif
+let g:vinux_tabwidth=4
 execute 'set tabstop='.g:vinux_tabwidth
 execute 'set shiftwidth='.g:vinux_tabwidth
 execute 'set softtabstop='.g:vinux_tabwidth

为.csdb指定一个路径???

from vinux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.