When I start VIM it shows my tabs and reloads my buffers from the last
time.
I use a session to do this.
au VimEnter * exe "so d:\\Session.vim"
au VimLeave * exe "'mksession! d:\\Session.vim'"
My reopened files do not have syntax coloring.
I have to do ":e" in every file where I need syntax coloring to view
syntax coloring.
I know that I can add "localoptions" in sessionoptions but this slows
down my vim (I noted that it uses 20-25% more CPU). Without
"localoptions" my vim is much faster.
> When I start VIM it shows my tabs and reloads my buffers from the last > time.
> I use a session to do this.
> au VimEnter * exe "so d:\\Session.vim" > au VimLeave * exe "'mksession! d:\\Session.vim'"
> My reopened files do not have syntax coloring. > I have to do ":e" in every file where I need syntax coloring to view > syntax coloring.
> I know that I can add "localoptions" in sessionoptions but this slows > down my vim (I noted that it uses 20-25% more CPU). Without > "localoptions" my vim is much faster.
> How do you resolve this? > Don't you use sessions?
try adding either
syntax on
or (near the top)
runtime vimrc_example.vim
(it's not necessary to use both) to your vimrc (or make one if you don't yet have one, using
:e ~/_vimrc
inside Vim).
Best regards, Tony. -- Dimensions will always be expressed in the least usable term. Velocity, for example, will be expressed in furlongs per fortnight.
> > When I start VIM it shows my tabs and reloads my buffers from the last
> > time.
> > I use a session to do this.
> > au VimEnter * exe "so d:\\Session.vim"
> > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > My reopened files do not have syntax coloring.
> > I have to do ":e" in every file where I need syntax coloring to view
> > syntax coloring.
> > I know that I can add "localoptions" in sessionoptions but this slows
> > down my vim (I noted that it uses 20-25% more CPU). Without
> > "localoptions" my vim is much faster.
> > How do you resolve this?
> > Don't you use sessions?
> try adding either
> syntax on
> or (near the top)
> runtime vimrc_example.vim
> (it's not necessary to use both) to your vimrc (or make one if you don't
> yet have one, using
> :e ~/_vimrc
> inside Vim).
> Best regards,
> Tony.
> --
> Dimensions will always be expressed in the least usable term.
> Velocity, for example, will be expressed in furlongs per fortnight.
Hello Tony,
I already had "syntax on" near the top of my _vimrc file.
...
I noted that vim doesn't detect filetypes at startup when files are
restored (by sourcing a session).
I have
filetype on
filetype plugin on
written in my _vimrc
> On Apr 15, 11:17 am, Tony Mechelynck<antoine.mechely...@gmail.com> > wrote: >> On 15/04/11 09:06, rameo wrote:
>>> When I start VIM it shows my tabs and reloads my buffers from the last >>> time.
>>> I use a session to do this.
>>> au VimEnter * exe "so d:\\Session.vim" >>> au VimLeave * exe "'mksession! d:\\Session.vim'"
>>> My reopened files do not have syntax coloring. >>> I have to do ":e" in every file where I need syntax coloring to view >>> syntax coloring.
>>> I know that I can add "localoptions" in sessionoptions but this slows >>> down my vim (I noted that it uses 20-25% more CPU). Without >>> "localoptions" my vim is much faster.
>>> How do you resolve this? >>> Don't you use sessions?
>> try adding either
>> syntax on
>> or (near the top)
>> runtime vimrc_example.vim
>> (it's not necessary to use both) to your vimrc (or make one if you don't >> yet have one, using
>> :e ~/_vimrc
>> inside Vim).
>> Best regards, >> Tony. >> -- >> Dimensions will always be expressed in the least usable term. >> Velocity, for example, will be expressed in furlongs per fortnight.
> Hello Tony,
> I already had "syntax on" near the top of my _vimrc file.
> ... > I noted that vim doesn't detect filetypes at startup when files are > restored (by sourcing a session).
> I have > filetype on > filetype plugin on > written in my _vimrc
> Best regards, > Rameo
Whell, how exactly do you restore your sessions? When I used "gvim -S" with :mksession it did read my vimrc. (Now I use a handtyped Session.vim which does exactly what I want and not all the :mksession hocus-pocus.)
Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 58. You turn on your computer and turn off your wife.
> On Apr 15, 11:17 am, Tony Mechelynck <antoine.mechely...@gmail.com>
> wrote:
> > On 15/04/11 09:06, rameo wrote:
> > > When I start VIM it shows my tabs and reloads my buffers from the last
> > > time.
> > > I use a session to do this.
> > > au VimEnter * exe "so d:\\Session.vim"
> > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > My reopened files do not have syntax coloring.
> > > I have to do ":e" in every file where I need syntax coloring to view
> > > syntax coloring.
> > > I know that I can add "localoptions" in sessionoptions but this slows
> > > down my vim (I noted that it uses 20-25% more CPU). Without
> > > "localoptions" my vim is much faster.
> > > How do you resolve this?
> > > Don't you use sessions?
> > try adding either
> > syntax on
> > or (near the top)
> > runtime vimrc_example.vim
> > (it's not necessary to use both) to your vimrc (or make one if you don't
> > yet have one, using
> > :e ~/_vimrc
> > inside Vim).
> > Best regards,
> > Tony.
> > --
> > Dimensions will always be expressed in the least usable term.
> > Velocity, for example, will be expressed in furlongs per fortnight.
> Hello Tony,
> I already had "syntax on" near the top of my _vimrc file.
> ...
> I noted that vim doesn't detect filetypes at startup when files are
> restored (by sourcing a session).
> I have
> filetype on
> filetype plugin on
> written in my _vimrc
> Best regards,
> Rameo
I restore my sessions using VimEnter/VimLeave --> see 1st message.
I just checked what it does when I do it manually..
Syntax works. (maybe because it uses the sessionoptions "localoptions"
or "options")
> On Apr 15, 11:31 am, rameo<rai...@gmail.com> wrote: >> On Apr 15, 11:17 am, Tony Mechelynck<antoine.mechely...@gmail.com> >> wrote:
>>> On 15/04/11 09:06, rameo wrote:
>>>> When I start VIM it shows my tabs and reloads my buffers from the last >>>> time.
>>>> I use a session to do this.
>>>> au VimEnter * exe "so d:\\Session.vim" >>>> au VimLeave * exe "'mksession! d:\\Session.vim'"
>>>> My reopened files do not have syntax coloring. >>>> I have to do ":e" in every file where I need syntax coloring to view >>>> syntax coloring.
>>>> I know that I can add "localoptions" in sessionoptions but this slows >>>> down my vim (I noted that it uses 20-25% more CPU). Without >>>> "localoptions" my vim is much faster.
>>>> How do you resolve this? >>>> Don't you use sessions?
>>> try adding either
>>> syntax on
>>> or (near the top)
>>> runtime vimrc_example.vim
>>> (it's not necessary to use both) to your vimrc (or make one if you don't >>> yet have one, using
>>> :e ~/_vimrc
>>> inside Vim).
>>> Best regards, >>> Tony. >>> -- >>> Dimensions will always be expressed in the least usable term. >>> Velocity, for example, will be expressed in furlongs per fortnight.
>> Hello Tony,
>> I already had "syntax on" near the top of my _vimrc file.
>> ... >> I noted that vim doesn't detect filetypes at startup when files are >> restored (by sourcing a session).
>> I have >> filetype on >> filetype plugin on >> written in my _vimrc
>> Best regards, >> Rameo
> I restore my sessions using VimEnter/VimLeave --> see 1st message.
> I just checked what it does when I do it manually.. > Syntax works. (maybe because it uses the sessionoptions "localoptions" > or "options")
If you're using gvim, try making a desktop icon which would call it as
gvim -S d:\Session.vim
If you're using Console Vim, try making... well, I was about to say a shell alias, but maybe these don't exist on Windows. You can make a bat script, however, named maybe svim.bat, which would call Vim as
vim -S d:\Session.vim
In all cases, you may need to call vim, svim or gvim with a full path if its executable's directory is not in your PATH environment variable.
see :help -S
Best regards, Tony. -- "When are you BUTTHEADS gonna learn that you can't oppose Gestapo tactics *with* Gestapo tactics?" -- Reuben Flagg
Reply to message «syntax coloring», sent 11:06:33 15 April 2011, Friday by rameo:
> When I start VIM it shows my tabs and reloads my buffers from the last > time.
> I use a session to do this.
> au VimEnter * exe "so d:\\Session.vim" > au VimLeave * exe "'mksession! d:\\Session.vim'"
You have made just the same mistake as me some time ago: all filetype-related files are loaded using an autocommand, but by default no autocommands are allowed when you are executing an autocommand, so you should add `nested' just after the pattern. By the way, why do you use `exe'? The following works as well: augroup SaveRestoreSessions autocmd! autocmd VimEnter * nested source D:\session.vim autocmd VimLeave * nested mksession! D:\session.vim augroup END
> When I start VIM it shows my tabs and reloads my buffers from the last > time.
> I use a session to do this.
> au VimEnter * exe "so d:\\Session.vim" > au VimLeave * exe "'mksession! d:\\Session.vim'"
> My reopened files do not have syntax coloring. > I have to do ":e" in every file where I need syntax coloring to view > syntax coloring.
> I know that I can add "localoptions" in sessionoptions but this slows > down my vim (I noted that it uses 20-25% more CPU). Without > "localoptions" my vim is much faster.
> How do you resolve this? > Don't you use sessions?
> Reply to message «syntax coloring»,
> sent 11:06:33 15 April 2011, Friday
> by rameo:
> > When I start VIM it shows my tabs and reloads my buffers from the last
> > time.
> > I use a session to do this.
> > au VimEnter * exe "so d:\\Session.vim"
> > au VimLeave * exe "'mksession! d:\\Session.vim'"
> You have made just the same mistake as me some time ago: all filetype-related
> files are loaded using an autocommand, but by default no autocommands are
> allowed when you are executing an autocommand, so you should add `nested' just
> after the pattern. By the way, why do you use `exe'? The following works as
> well:
> augroup SaveRestoreSessions
> autocmd!
> autocmd VimEnter * nested source D:\session.vim
> autocmd VimLeave * nested mksession! D:\session.vim
> augroup END
> See `:h autocmd-nested' for more details.
> Original message:
> > When I start VIM it shows my tabs and reloads my buffers from the last
> > time.
> > I use a session to do this.
> > au VimEnter * exe "so d:\\Session.vim"
> > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > My reopened files do not have syntax coloring.
> > I have to do ":e" in every file where I need syntax coloring to view
> > syntax coloring.
> > I know that I can add "localoptions" in sessionoptions but this slows
> > down my vim (I noted that it uses 20-25% more CPU). Without
> > "localoptions" my vim is much faster.
> > How do you resolve this?
> > Don't you use sessions?
> signature.asc
> < 1KViewDownload
Great! It does work.
Thanks a lot!
Please let me ask you one more question...
How do you close this session and reopens a custom one (happens once
in a while)?
Reply to message «Re: syntax coloring», sent 19:13:18 15 April 2011, Friday by rameo:
> Please let me ask you one more question... > How do you close this session and reopens a custom one (happens once > in a while)?
I don't use one continious vim session and don't load any sessions at vim startup (the `just the same error' meant that I used an autocommand in a similar way and got the same error, not that I used the same code). Instead I create a new session file almost each time when vim exits and load one of created sessions at vim startup: 1. due to virtual desktops I almost never close any of my projects' windows, 2. I use vim to quickly edit something from command-line, loading any sessions will discard the most significant part of vim invocation arguments for this use-case. Saving session at vim exit is for the case when I have to reload vim (mostly plugin or kernel updates). Here is my code:
"▶2 mksession if has('mksession') function s:InitSes() let sesdir=expand('~/.vimsessions') if !isdirectory(sesdir) call mkdir(expand(sesdir), "", 0700) endif let sesfile=os#JoinPath(sesdir, '.sessions.lst') let sessions=[] if filereadable(sesfile) let sessions+=readfile(sesfile, 'b') while !empty(sessions) && empty(sessions[-1]) call remove(sessions, -1) endwhile endif let sessplitted=map(copy(sessions), \'split(v:val, ''\v%(\\@<!%(\\\\)*)@<=,'')') let sesdirs=map(copy(sessplitted), '((empty(v:val))?(""):(v:val[0]))') let sesfiles=map(copy(sessplitted), '((empty(v:val))?([]):(v:val[1:]))') execute "cd ".fnameescape(resolve(fnamemodify('.', ':p'))) let curdir=escape(fnamemodify('.', ':p'), ',\') return [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir] endfunction let s:_functions['s:InitSes']=function('s:InitSes') function s:MakeSession() let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes() let files=sort(map(filter(map(filter(range(1, bufnr('$')), \ 'getbufvar(v:val, "&bt")!=#"help"'), \ 'bufname(v:val)'), \ 'filereadable(v:val)'), \ 'escape(fnamemodify(resolve(fnamemodify(v:val, ":p")), ":~:."), ",\\")')) if empty(files) return endif let sesstr=join([curdir]+files, ',') let sindex=index(sessions, sesstr) if sindex==-1 let sindex=index(sessions, '') endif if sindex==-1 let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim') call add(sessions, sesstr) else let sesname=os#JoinPath(sesdir, sindex.'.vim') let sessions[sindex]=sesstr endif execute 'mksession! '.fnameescape(sesname) call writefile(sessions, sesfile, 'b') endfunction let s:_functions['s:MakeSession']=function('s:MakeSession') function s:LoadSession(bang, ...) let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes() if a:0 && string(+a:1)==#a:1 && a:1<len(sessions) && \!empty(sessions[a:1]) let dirsessions=[[+a:1, sesdirs[a:1], sessions[a:1]]] else let dirsessions=filter(map(copy(sesdirs), \ '[v:key, v:val, sessions[v:key]]'), \ 'v:val[1]==#curdir'. \ ((a:0)?(' && v:val[2]=~?a:1'):(''))) endif if len(dirsessions)==1 || (!empty(dirsessions) && a:bang) let sesid=dirsessions[0][0] let sesname=os#JoinPath(sesdir, sesid.'.vim') execute 'source '.fnameescape(sesname) call delete(sesname) if sesid==(len(sessions)-1) call remove(sessions, -1) else let sessions[sesid]="" endif call writefile(sessions, sesfile, 'b') endif endfunction let s:_functions['s:LoadSession']=function('s:LoadSession') function s:PrintSessions() let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes() call map(sessions, \'printf("%'.len(len(sessions)-1).'u %s", v:key, v:val)') echo join(sessions, "\n") endfunction let s:_functions['s:PrintSessions']=function('s:PrintSessions') autocmd VimLeavePre * call s:MakeSession() command -nargs=? -bang LoadSession call s:LoadSession(<bang>0, <q-args>) command -bar PrintSessions call s:PrintSessions() let s:_commands+=['LoadSession', 'PrintSessions'] endif "▲2
> On Apr 15, 1:43 pm, ZyX <zyx....@gmail.com> wrote: > > Reply to message «syntax coloring», > > sent 11:06:33 15 April 2011, Friday
> > by rameo: > > > When I start VIM it shows my tabs and reloads my buffers from the last > > > time.
> > > I use a session to do this.
> > > au VimEnter * exe "so d:\\Session.vim" > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > You have made just the same mistake as me some time ago: all > > filetype-related files are loaded using an autocommand, but by default > > no autocommands are allowed when you are executing an autocommand, so > > you should add `nested' just after the pattern. By the way, why do you > > use `exe'? The following works as well: > > augroup SaveRestoreSessions > > autocmd! > > autocmd VimEnter * nested source D:\session.vim > > autocmd VimLeave * nested mksession! D:\session.vim > > augroup END
> > See `:h autocmd-nested' for more details.
> > Original message: > > > When I start VIM it shows my tabs and reloads my buffers from the last > > > time.
> > > I use a session to do this.
> > > au VimEnter * exe "so d:\\Session.vim" > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > My reopened files do not have syntax coloring. > > > I have to do ":e" in every file where I need syntax coloring to view > > > syntax coloring.
> > > I know that I can add "localoptions" in sessionoptions but this slows > > > down my vim (I noted that it uses 20-25% more CPU). Without > > > "localoptions" my vim is much faster.
> > > How do you resolve this? > > > Don't you use sessions?
> > signature.asc > > < 1KViewDownload
> Great! It does work. > Thanks a lot!
> Please let me ask you one more question... > How do you close this session and reopens a custom one (happens once > in a while)?
> Reply to message «Re: syntax coloring»,
> sent 19:13:18 15 April 2011, Friday
> by rameo:
> > Please let me ask you one more question...
> > How do you close this session and reopens a custom one (happens once
> > in a while)?
> I don't use one continious vim session and don't load any sessions at
> vim startup (the `just the same error' meant that I used an autocommand
> in a similar way and got the same error, not that I used the same code).
> Instead I create a new session file almost each time when vim exits
> and load one of created sessions at vim startup:
> 1. due to virtual desktops I almost never close any of my projects' windows,
> 2. I use vim to quickly edit something from command-line, loading any sessions
> will discard the most significant part of vim invocation arguments
> for this use-case.
> Saving session at vim exit is for the case when I have to reload vim
> (mostly plugin or kernel updates).
> Here is my code:
> "▶2 mksession
> if has('mksession')
> function s:InitSes()
> let sesdir=expand('~/.vimsessions')
> if !isdirectory(sesdir)
> call mkdir(expand(sesdir), "", 0700)
> endif
> let sesfile=os#JoinPath(sesdir, '.sessions.lst')
> let sessions=[]
> if filereadable(sesfile)
> let sessions+=readfile(sesfile, 'b')
> while !empty(sessions) && empty(sessions[-1])
> call remove(sessions, -1)
> endwhile
> endif
> let sessplitted=map(copy(sessions),
> \'split(v:val, ''\v%(\\@<!%(\\\\)*)@<=,'')')
> let sesdirs=map(copy(sessplitted), '((empty(v:val))?(""):(v:val[0]))')
> let sesfiles=map(copy(sessplitted), '((empty(v:val))?([]):(v:val[1:]))')
> execute "cd ".fnameescape(resolve(fnamemodify('.', ':p')))
> let curdir=escape(fnamemodify('.', ':p'), ',\')
> return [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]
> endfunction
> let s:_functions['s:InitSes']=function('s:InitSes')
> function s:MakeSession()
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> let files=sort(map(filter(map(filter(range(1, bufnr('$')),
> \ 'getbufvar(v:val, "&bt")!=#"help"'),
> \ 'bufname(v:val)'),
> \ 'filereadable(v:val)'),
> \ 'escape(fnamemodify(resolve(fnamemodify(v:val, ":p")),
> ":~:."), ",\\")'))
> if empty(files)
> return
> endif
> let sesstr=join([curdir]+files, ',')
> let sindex=index(sessions, sesstr)
> if sindex==-1
> let sindex=index(sessions, '')
> endif
> if sindex==-1
> let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
> call add(sessions, sesstr)
> else
> let sesname=os#JoinPath(sesdir, sindex.'.vim')
> let sessions[sindex]=sesstr
> endif
> execute 'mksession! '.fnameescape(sesname)
> call writefile(sessions, sesfile, 'b')
> endfunction
> let s:_functions['s:MakeSession']=function('s:MakeSession')
> function s:LoadSession(bang, ...)
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> if a:0 && string(+a:1)==#a:1 && a:1<len(sessions) &&
> \!empty(sessions[a:1])
> let dirsessions=[[+a:1, sesdirs[a:1], sessions[a:1]]]
> else
> let dirsessions=filter(map(copy(sesdirs),
> \ '[v:key, v:val, sessions[v:key]]'),
> \ 'v:val[1]==#curdir'.
> \ ((a:0)?(' && v:val[2]=~?a:1'):('')))
> endif
> if len(dirsessions)==1 || (!empty(dirsessions) && a:bang)
> let sesid=dirsessions[0][0]
> let sesname=os#JoinPath(sesdir, sesid.'.vim')
> execute 'source '.fnameescape(sesname)
> call delete(sesname)
> if sesid==(len(sessions)-1)
> call remove(sessions, -1)
> else
> let sessions[sesid]=""
> endif
> call writefile(sessions, sesfile, 'b')
> endif
> endfunction
> let s:_functions['s:LoadSession']=function('s:LoadSession')
> function s:PrintSessions()
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> call map(sessions,
> \'printf("%'.len(len(sessions)-1).'u %s", v:key, v:val)')
> echo join(sessions, "\n")
> endfunction
> let s:_functions['s:PrintSessions']=function('s:PrintSessions')
> autocmd VimLeavePre * call s:MakeSession()
> command -nargs=? -bang LoadSession call s:LoadSession(<bang>0, <q-args>)
> command -bar PrintSessions call s:PrintSessions()
> let s:_commands+=['LoadSession', 'PrintSessions']
> endif
> "▲2
> I am going to evolve this into plugin sometime.
> Original message:
> > On Apr 15, 1:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «syntax coloring»,
> > > sent 11:06:33 15 April 2011, Friday
> > > by rameo:
> > > > When I start VIM it shows my tabs and reloads my buffers from the last
> > > > time.
> > > > I use a session to do this.
> > > > au VimEnter * exe "so d:\\Session.vim"
> > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > You have made just the same mistake as me some time ago: all
> > > filetype-related files are loaded using an autocommand, but by default
> > > no autocommands are allowed when you are executing an autocommand, so
> > > you should add `nested' just after the pattern. By the way, why do you
> > > use `exe'? The following works as well:
> > > augroup SaveRestoreSessions
> > > autocmd!
> > > autocmd VimEnter * nested source D:\session.vim
> > > autocmd VimLeave * nested mksession! D:\session.vim
> > > augroup END
> > > See `:h autocmd-nested' for more details.
> > > Original message:
> > > > When I start VIM it shows my tabs and reloads my buffers from the last
> > > > time.
> > > > I use a session to do this.
> > > > au VimEnter * exe "so d:\\Session.vim"
> > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > > My reopened files do not have syntax coloring.
> > > > I have to do ":e" in every file where I need syntax coloring to view
> > > > syntax coloring.
> > > > I know that I can add "localoptions" in sessionoptions but this slows
> > > > down my vim (I noted that it uses 20-25% more CPU). Without
> > > > "localoptions" my vim is much faster.
> > > > How do you resolve this?
> > > > Don't you use sessions?
> > > signature.asc
> > > < 1KViewDownload
> > Great! It does work.
> > Thanks a lot!
> > Please let me ask you one more question...
> > How do you close this session and reopens a custom one (happens once
> > in a while)?
> signature.asc
> < 1KViewDownload
Still have a little problem.
I had also a VimLeave argdel command in my _vimrc.
> On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote: > > Reply to message «Re: syntax coloring», > > sent 19:13:18 15 April 2011, Friday
> > by rameo: > > > Please let me ask you one more question... > > > How do you close this session and reopens a custom one (happens once > > > in a while)?
> > I don't use one continious vim session and don't load any sessions at > > vim startup (the `just the same error' meant that I used an autocommand > > in a similar way and got the same error, not that I used the same code). > > Instead I create a new session file almost each time when vim exits > > and load one of created sessions at vim startup: > > 1. due to virtual desktops I almost never close any of my projects' > > windows, 2. I use vim to quickly edit something from command-line, > > loading any sessions will discard the most significant part of vim > > invocation arguments for this use-case. > > Saving session at vim exit is for the case when I have to reload vim > > (mostly plugin or kernel updates). > > Here is my code:
> > > > You have made just the same mistake as me some time ago: all > > > > filetype-related files are loaded using an autocommand, but by > > > > default no autocommands are allowed when you are executing an > > > > autocommand, so you should add `nested' just after the pattern. By > > > > the way, why do you use `exe'? The following works as well: > > > > augroup SaveRestoreSessions > > > > autocmd! > > > > autocmd VimEnter * nested source D:\session.vim > > > > autocmd VimLeave * nested mksession! D:\session.vim > > > > augroup END
> > > > See `:h autocmd-nested' for more details.
> > > > Original message: > > > > > When I start VIM it shows my tabs and reloads my buffers from the > > > > > last time.
> > > > > My reopened files do not have syntax coloring. > > > > > I have to do ":e" in every file where I need syntax coloring to > > > > > view syntax coloring.
> > > > > I know that I can add "localoptions" in sessionoptions but this > > > > > slows down my vim (I noted that it uses 20-25% more CPU). Without > > > > > "localoptions" my vim is much faster.
> > > > > How do you resolve this? > > > > > Don't you use sessions?
> > > > signature.asc > > > > < 1KViewDownload
> > > Great! It does work. > > > Thanks a lot!
> > > Please let me ask you one more question... > > > How do you close this session and reopens a custom one (happens once > > > in a while)?
> > signature.asc > > < 1KViewDownload
> Still have a little problem. > I had also a VimLeave argdel command in my _vimrc.
> 1. Missing endif.
> 2. You don't need `exe' here.
> 3. I don't get why do you need this command at all.
> Original message:
> > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «Re: syntax coloring»,
> > > sent 19:13:18 15 April 2011, Friday
> > > by rameo:
> > > > Please let me ask you one more question...
> > > > How do you close this session and reopens a custom one (happens once
> > > > in a while)?
> > > I don't use one continious vim session and don't load any sessions at
> > > vim startup (the `just the same error' meant that I used an autocommand
> > > in a similar way and got the same error, not that I used the same code).
> > > Instead I create a new session file almost each time when vim exits
> > > and load one of created sessions at vim startup:
> > > 1. due to virtual desktops I almost never close any of my projects'
> > > windows, 2. I use vim to quickly edit something from command-line,
> > > loading any sessions will discard the most significant part of vim
> > > invocation arguments for this use-case.
> > > Saving session at vim exit is for the case when I have to reload vim
> > > (mostly plugin or kernel updates).
> > > Here is my code:
> > > > > You have made just the same mistake as me some time ago: all
> > > > > filetype-related files are loaded using an autocommand, but by
> > > > > default no autocommands are allowed when you are executing an
> > > > > autocommand, so you should add `nested' just after the pattern. By
> > > > > the way, why do you use `exe'? The following works as well:
> > > > > augroup SaveRestoreSessions
> > > > > autocmd!
> > > > > autocmd VimEnter * nested source D:\session.vim
> > > > > autocmd VimLeave * nested mksession! D:\session.vim
> > > > > augroup END
> > > > > See `:h autocmd-nested' for more details.
> > > > > Original message:
> > > > > > When I start VIM it shows my tabs and reloads my buffers from the
> > > > > > last time.
> > > > > > My reopened files do not have syntax coloring.
> > > > > > I have to do ":e" in every file where I need syntax coloring to
> > > > > > view syntax coloring.
> > > > > > I know that I can add "localoptions" in sessionoptions but this
> > > > > > slows down my vim (I noted that it uses 20-25% more CPU). Without
> > > > > > "localoptions" my vim is much faster.
> > > > > > How do you resolve this?
> > > > > > Don't you use sessions?
Tnx.. this is what I added:
autocmd VimLeave * if argc() != 0 | 'argdel *' endif
I noted that (even after a buffer delete :bd) certain buffers do
remain in "session.vim"
I had no troubles anymore after removing "argdel *" and troubles again
after having changed
...
Reply to message «Re: syntax coloring», sent 23:02:40 15 April 2011, Friday by rameo:
> Tnx.. this is what I added: > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
Reread help. This is false: you should not use strikes around `argdel *' and you should have bar before `endif' just like you have before `argdel'.
> I noted that (even after a buffer delete :bd) certain buffers do > remain in "session.vim" > I had no troubles anymore after removing "argdel *" and troubles again > after having changed the script as above.
I know this issue. In this case you should have `argdel' before mksession, I don't get why you have it *after*.
> > 1. Missing endif. > > 2. You don't need `exe' here. > > 3. I don't get why do you need this command at all.
> > Original message: > > > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote: > > > > Reply to message «Re: syntax coloring», > > > > sent 19:13:18 15 April 2011, Friday
> > > > by rameo: > > > > > Please let me ask you one more question... > > > > > How do you close this session and reopens a custom one (happens > > > > > once in a while)?
> > > > I don't use one continious vim session and don't load any sessions at > > > > vim startup (the `just the same error' meant that I used an > > > > autocommand in a similar way and got the same error, not that I used > > > > the same code). Instead I create a new session file almost each time > > > > when vim exits and load one of created sessions at vim startup: > > > > 1. due to virtual desktops I almost never close any of my projects' > > > > windows, 2. I use vim to quickly edit something from command-line, > > > > loading any sessions will discard the most significant part of vim > > > > invocation arguments for this use-case. > > > > Saving session at vim exit is for the case when I have to reload vim > > > > (mostly plugin or kernel updates). > > > > Here is my code:
> > > > > > You have made just the same mistake as me some time ago: all > > > > > > filetype-related files are loaded using an autocommand, but by > > > > > > default no autocommands are allowed when you are executing an > > > > > > autocommand, so you should add `nested' just after the pattern. > > > > > > By the way, why do you use `exe'? The following works as well: > > > > > > augroup SaveRestoreSessions > > > > > > autocmd! > > > > > > autocmd VimEnter * nested source D:\session.vim > > > > > > autocmd VimLeave * nested mksession! D:\session.vim > > > > > > augroup END
> > > > > > See `:h autocmd-nested' for more details.
> > > > > > Original message: > > > > > > > When I start VIM it shows my tabs and reloads my buffers from > > > > > > > the last time.
> > > > > > > My reopened files do not have syntax coloring. > > > > > > > I have to do ":e" in every file where I need syntax coloring to > > > > > > > view syntax coloring.
> > > > > > > I know that I can add "localoptions" in sessionoptions but this > > > > > > > slows down my vim (I noted that it uses 20-25% more CPU). > > > > > > > Without "localoptions" my vim is much faster.
> > > > > > > How do you resolve this? > > > > > > > Don't you use sessions?
> > > > > Great! It does work. > > > > > Thanks a lot!
> > > > > Please let me ask you one more question... > > > > > How do you close this session and reopens a custom one (happens > > > > > once in a while)?
> > > > signature.asc > > > > < 1KViewDownload
> > > Still have a little problem. > > > I had also a VimLeave argdel command in my _vimrc.
> Reply to message «Re: syntax coloring»,
> sent 23:02:40 15 April 2011, Friday
> by rameo:
> > Tnx.. this is what I added:
> > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> Reread help. This is false: you should not use strikes around `argdel *' and you
> should have bar before `endif' just like you have before `argdel'.
> > I noted that (even after a buffer delete :bd) certain buffers do
> > remain in "session.vim"
> > I had no troubles anymore after removing "argdel *" and troubles again
> > after having changed the script as above.
> I know this issue. In this case you should have `argdel' before mksession,
> I don't get why you have it *after*.
> Original message:
> > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «Re: syntax coloring»,
> > > sent 21:39:21 15 April 2011, Friday
> > > by rameo:
> > > > Still have a little problem.
> > > > I had also a VimLeave argdel command in my _vimrc.
> > > 1. Missing endif.
> > > 2. You don't need `exe' here.
> > > 3. I don't get why do you need this command at all.
> > > Original message:
> > > > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > Reply to message «Re: syntax coloring»,
> > > > > sent 19:13:18 15 April 2011, Friday
> > > > > by rameo:
> > > > > > Please let me ask you one more question...
> > > > > > How do you close this session and reopens a custom one (happens
> > > > > > once in a while)?
> > > > > I don't use one continious vim session and don't load any sessions at
> > > > > vim startup (the `just the same error' meant that I used an
> > > > > autocommand in a similar way and got the same error, not that I used
> > > > > the same code). Instead I create a new session file almost each time
> > > > > when vim exits and load one of created sessions at vim startup:
> > > > > 1. due to virtual desktops I almost never close any of my projects'
> > > > > windows, 2. I use vim to quickly edit something from command-line,
> > > > > loading any sessions will discard the most significant part of vim
> > > > > invocation arguments for this use-case.
> > > > > Saving session at vim exit is for the case when I have to reload vim
> > > > > (mostly plugin or kernel updates).
> > > > > Here is my code:
> > > > > > > You have made just the same mistake as me some time ago: all
> > > > > > > filetype-related files are loaded using an autocommand, but by
> > > > > > > default no autocommands are allowed when you are executing an
> > > > > > > autocommand, so you should add `nested' just after the pattern.
> > > > > > > By the way, why do you use `exe'? The following works as well:
> > > > > > > augroup SaveRestoreSessions
> > > > > > > autocmd!
> > > > > > > autocmd VimEnter * nested source D:\session.vim
> > > > > > > autocmd VimLeave * nested mksession! D:\session.vim
> > > > > > > augroup END
> > > > > > > See `:h autocmd-nested' for more details.
> > > > > > > Original message:
> > > > > > > > When I start VIM it shows my tabs and reloads my buffers from
> > > > > > > > the last time.
> Reply to message «Re: syntax coloring»,
> sent 23:02:40 15 April 2011, Friday
> by rameo:
> > Tnx.. this is what I added:
> > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> Reread help. This is false: you should not use strikes around `argdel *' and you
> should have bar before `endif' just like you have before `argdel'.
> > I noted that (even after a buffer delete :bd) certain buffers do
> > remain in "session.vim"
> > I had no troubles anymore after removing "argdel *" and troubles again
> > after having changed the script as above.
> I know this issue. In this case you should have `argdel' before mksession,
> I don't get why you have it *after*.
> Original message:
> > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «Re: syntax coloring»,
> > > sent 21:39:21 15 April 2011, Friday
> > > by rameo:
> > > > Still have a little problem.
> > > > I had also a VimLeave argdel command in my _vimrc.
> > > 1. Missing endif.
> > > 2. You don't need `exe' here.
> > > 3. I don't get why do you need this command at all.
> > > Original message:
> > > > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > Reply to message «Re: syntax coloring»,
> > > > > sent 19:13:18 15 April 2011, Friday
> > > > > by rameo:
> > > > > > Please let me ask you one more question...
> > > > > > How do you close this session and reopens a custom one (happens
> > > > > > once in a while)?
> > > > > I don't use one continious vim session and don't load any sessions at
> > > > > vim startup (the `just the same error' meant that I used an
> > > > > autocommand in a similar way and got the same error, not that I used
> > > > > the same code). Instead I create a new session file almost each time
> > > > > when vim exits and load one of created sessions at vim startup:
> > > > > 1. due to virtual desktops I almost never close any of my projects'
> > > > > windows, 2. I use vim to quickly edit something from command-line,
> > > > > loading any sessions will discard the most significant part of vim
> > > > > invocation arguments for this use-case.
> > > > > Saving session at vim exit is for the case when I have to reload vim
> > > > > (mostly plugin or kernel updates).
> > > > > Here is my code:
> > > > > > > You have made just the same mistake as me some time ago: all
> > > > > > > filetype-related files are loaded using an autocommand, but by
> > > > > > > default no autocommands are allowed when you are executing an
> > > > > > > autocommand, so you should add `nested' just after the pattern.
> > > > > > > By the way, why do you use `exe'? The following works as well:
> > > > > > > augroup SaveRestoreSessions
> > > > > > > autocmd!
> > > > > > > autocmd VimEnter * nested source D:\session.vim
> > > > > > > autocmd VimLeave * nested mksession! D:\session.vim
> > > > > > > augroup END
> > > > > > > See `:h autocmd-nested' for more details.
> > > > > > > Original message:
> > > > > > > > When I start VIM it shows my tabs and reloads my buffers from
> > > > > > > > the last time.
> Reply to message «Re: syntax coloring»,
> sent 19:13:18 15 April 2011, Friday
> by rameo:
> > Please let me ask you one more question...
> > How do you close this session and reopens a custom one (happens once
> > in a while)?
> I don't use one continious vim session and don't load any sessions at
> vim startup (the `just the same error' meant that I used an autocommand
> in a similar way and got the same error, not that I used the same code).
> Instead I create a new session file almost each time when vim exits
> and load one of created sessions at vim startup:
> 1. due to virtual desktops I almost never close any of my projects' windows,
> 2. I use vim to quickly edit something from command-line, loading any sessions
> will discard the most significant part of vim invocation arguments
> for this use-case.
> Saving session at vim exit is for the case when I have to reload vim
> (mostly plugin or kernel updates).
> Here is my code:
> "▶2 mksession
> if has('mksession')
> function s:InitSes()
> let sesdir=expand('~/.vimsessions')
> if !isdirectory(sesdir)
> call mkdir(expand(sesdir), "", 0700)
> endif
> let sesfile=os#JoinPath(sesdir, '.sessions.lst')
> let sessions=[]
> if filereadable(sesfile)
> let sessions+=readfile(sesfile, 'b')
> while !empty(sessions) && empty(sessions[-1])
> call remove(sessions, -1)
> endwhile
> endif
> let sessplitted=map(copy(sessions),
> \'split(v:val, ''\v%(\\@<!%(\\\\)*)@<=,'')')
> let sesdirs=map(copy(sessplitted), '((empty(v:val))?(""):(v:val[0]))')
> let sesfiles=map(copy(sessplitted), '((empty(v:val))?([]):(v:val[1:]))')
> execute "cd ".fnameescape(resolve(fnamemodify('.', ':p')))
> let curdir=escape(fnamemodify('.', ':p'), ',\')
> return [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]
> endfunction
> let s:_functions['s:InitSes']=function('s:InitSes')
> function s:MakeSession()
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> let files=sort(map(filter(map(filter(range(1, bufnr('$')),
> \ 'getbufvar(v:val, "&bt")!=#"help"'),
> \ 'bufname(v:val)'),
> \ 'filereadable(v:val)'),
> \ 'escape(fnamemodify(resolve(fnamemodify(v:val, ":p")),
> ":~:."), ",\\")'))
> if empty(files)
> return
> endif
> let sesstr=join([curdir]+files, ',')
> let sindex=index(sessions, sesstr)
> if sindex==-1
> let sindex=index(sessions, '')
> endif
> if sindex==-1
> let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
> call add(sessions, sesstr)
> else
> let sesname=os#JoinPath(sesdir, sindex.'.vim')
> let sessions[sindex]=sesstr
> endif
> execute 'mksession! '.fnameescape(sesname)
> call writefile(sessions, sesfile, 'b')
> endfunction
> let s:_functions['s:MakeSession']=function('s:MakeSession')
> function s:LoadSession(bang, ...)
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> if a:0 && string(+a:1)==#a:1 && a:1<len(sessions) &&
> \!empty(sessions[a:1])
> let dirsessions=[[+a:1, sesdirs[a:1], sessions[a:1]]]
> else
> let dirsessions=filter(map(copy(sesdirs),
> \ '[v:key, v:val, sessions[v:key]]'),
> \ 'v:val[1]==#curdir'.
> \ ((a:0)?(' && v:val[2]=~?a:1'):('')))
> endif
> if len(dirsessions)==1 || (!empty(dirsessions) && a:bang)
> let sesid=dirsessions[0][0]
> let sesname=os#JoinPath(sesdir, sesid.'.vim')
> execute 'source '.fnameescape(sesname)
> call delete(sesname)
> if sesid==(len(sessions)-1)
> call remove(sessions, -1)
> else
> let sessions[sesid]=""
> endif
> call writefile(sessions, sesfile, 'b')
> endif
> endfunction
> let s:_functions['s:LoadSession']=function('s:LoadSession')
> function s:PrintSessions()
> let [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]=s:InitSes()
> call map(sessions,
> \'printf("%'.len(len(sessions)-1).'u %s", v:key, v:val)')
> echo join(sessions, "\n")
> endfunction
> let s:_functions['s:PrintSessions']=function('s:PrintSessions')
> autocmd VimLeavePre * call s:MakeSession()
> command -nargs=? -bang LoadSession call s:LoadSession(<bang>0, <q-args>)
> command -bar PrintSessions call s:PrintSessions()
> let s:_commands+=['LoadSession', 'PrintSessions']
> endif
> "▲2
> I am going to evolve this into plugin sometime.
> Original message:
> > On Apr 15, 1:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «syntax coloring»,
> > > sent 11:06:33 15 April 2011, Friday
> > > by rameo:
> > > > When I start VIM it shows my tabs and reloads my buffers from the last
> > > > time.
> > > > I use a session to do this.
> > > > au VimEnter * exe "so d:\\Session.vim"
> > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > You have made just the same mistake as me some time ago: all
> > > filetype-related files are loaded using an autocommand, but by default
> > > no autocommands are allowed when you are executing an autocommand, so
> > > you should add `nested' just after the pattern. By the way, why do you
> > > use `exe'? The following works as well:
> > > augroup SaveRestoreSessions
> > > autocmd!
> > > autocmd VimEnter * nested source D:\session.vim
> > > autocmd VimLeave * nested mksession! D:\session.vim
> > > augroup END
> > > See `:h autocmd-nested' for more details.
> > > Original message:
> > > > When I start VIM it shows my tabs and reloads my buffers from the last
> > > > time.
> > > > I use a session to do this.
> > > > au VimEnter * exe "so d:\\Session.vim"
> > > > au VimLeave * exe "'mksession! d:\\Session.vim'"
> > > > My reopened files do not have syntax coloring.
> > > > I have to do ":e" in every file where I need syntax coloring to view
> > > > syntax coloring.
> > > > I know that I can add "localoptions" in sessionoptions but this slows
> > > > down my vim (I noted that it uses 20-25% more CPU). Without
> > > > "localoptions" my vim is much faster.
> > > > How do you resolve this?
> > > > Don't you use sessions?
> > > signature.asc
> > > < 1KViewDownload
> > Great! It does work.
> > Thanks a lot!
> > Please let me ask you one more question...
> > How do you close this session and reopens a custom one (happens once
> > in a while)?
> signature.asc
> < 1KViewDownload
(I don't know what happens but messages are shown empty (even aften
writing text inside).)
----------------------------------------------
I don't know why I had argdel * after mksession.
...oh...maybe I know... not enouth knowledge of vim :)
You are doing a strange things again: 1. You should either rename `MakeSession' to `ClearArgs' (because `MakeSession' will confuse somebody (maybe even you) who will read you code as it does not makes any sessions) or, better, move `mksession!' call inside a function. 2. Why are you again writing `execute'? 3. You don't need `nested' for mksession, you need it only for VimEnter. 4. Never write anything user-specific to application folder, it may be purged by application update, removed by the package manager (if any) or uninstaller, or you may have to create more then one user on the machine.
> On Apr 15, 9:14 pm, ZyX <zyx....@gmail.com> wrote: > > Reply to message «Re: syntax coloring», > > sent 23:02:40 15 April 2011, Friday
> > by rameo: > > > Tnx.. this is what I added: > > > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> > Reread help. This is false: you should not use strikes around `argdel *' > > and you should have bar before `endif' just like you have before > > `argdel'.
> > > I noted that (even after a buffer delete :bd) certain buffers do > > > remain in "session.vim" > > > I had no troubles anymore after removing "argdel *" and troubles again > > > after having changed the script as above.
> > I know this issue. In this case you should have `argdel' before > > mksession, I don't get why you have it *after*.
> > Original message: > > > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote: > > > > Reply to message «Re: syntax coloring», > > > > sent 21:39:21 15 April 2011, Friday
> > > > by rameo: > > > > > Still have a little problem. > > > > > I had also a VimLeave argdel command in my _vimrc.
> > > > 1. Missing endif. > > > > 2. You don't need `exe' here. > > > > 3. I don't get why do you need this command at all.
> > > > Original message: > > > > > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote: > > > > > > Reply to message «Re: syntax coloring», > > > > > > sent 19:13:18 15 April 2011, Friday
> > > > > > by rameo: > > > > > > > Please let me ask you one more question... > > > > > > > How do you close this session and reopens a custom one (happens > > > > > > > once in a while)?
> > > > > > I don't use one continious vim session and don't load any > > > > > > sessions at vim startup (the `just the same error' meant that I > > > > > > used an autocommand in a similar way and got the same error, not > > > > > > that I used the same code). Instead I create a new session file > > > > > > almost each time when vim exits and load one of created sessions > > > > > > at vim startup: 1. due to virtual desktops I almost never close > > > > > > any of my projects' windows, 2. I use vim to quickly edit > > > > > > something from command-line, loading any sessions will discard > > > > > > the most significant part of vim invocation arguments for this > > > > > > use-case. > > > > > > Saving session at vim exit is for the case when I have to reload > > > > > > vim (mostly plugin or kernel updates). > > > > > > Here is my code:
> > > > > > > > You have made just the same mistake as me some time ago: all > > > > > > > > filetype-related files are loaded using an autocommand, but > > > > > > > > by default no autocommands are allowed when you are > > > > > > > > executing an autocommand, so you should add `nested' just
> You are doing a strange things again:
> 1. You should either rename `MakeSession' to `ClearArgs' (because `MakeSession'
> will confuse somebody (maybe even you) who will read you code as it does not
> makes any sessions) or, better, move `mksession!' call inside a function.
> 2. Why are you again writing `execute'?
> 3. You don't need `nested' for mksession, you need it only for VimEnter.
> 4. Never write anything user-specific to application folder, it may be purged by
> application update, removed by the package manager (if any) or uninstaller, or
> you may have to create more then one user on the machine.
> Original message:
> > On Apr 15, 9:14 pm, ZyX <zyx....@gmail.com> wrote:
> > > Reply to message «Re: syntax coloring»,
> > > sent 23:02:40 15 April 2011, Friday
> > > by rameo:
> > > > Tnx.. this is what I added:
> > > > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> > > Reread help. This is false: you should not use strikes around `argdel *'
> > > and you should have bar before `endif' just like you have before
> > > `argdel'.
> > > > I noted that (even after a buffer delete :bd) certain buffers do
> > > > remain in "session.vim"
> > > > I had no troubles anymore after removing "argdel *" and troubles again
> > > > after having changed the script as above.
> > > I know this issue. In this case you should have `argdel' before
> > > mksession, I don't get why you have it *after*.
> > > Original message:
> > > > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > Reply to message «Re: syntax coloring»,
> > > > > sent 21:39:21 15 April 2011, Friday
> > > > > by rameo:
> > > > > > Still have a little problem.
> > > > > > I had also a VimLeave argdel command in my _vimrc.
> > > > > 1. Missing endif.
> > > > > 2. You don't need `exe' here.
> > > > > 3. I don't get why do you need this command at all.
> > > > > Original message:
> > > > > > On Apr 15, 5:43 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > > > Reply to message «Re: syntax coloring»,
> > > > > > > sent 19:13:18 15 April 2011, Friday
> > > > > > > by rameo:
> > > > > > > > Please let me ask you one more question...
> > > > > > > > How do you close this session and reopens a custom one (happens
> > > > > > > > once in a while)?
> > > > > > > I don't use one continious vim session and don't load any
> > > > > > > sessions at vim startup (the `just the same error' meant that I
> > > > > > > used an autocommand in a similar way and got the same error, not
> > > > > > > that I used the same code). Instead I create a new session file
> > > > > > > almost each time when vim exits and load one of created sessions
> > > > > > > at vim startup: 1. due to virtual desktops I almost never close
> > > > > > > any of my projects' windows, 2. I use vim to quickly edit
> > > > > > > something from command-line, loading any sessions will discard
> > > > > > > the most significant part of vim invocation arguments for this
> > > > > > > use-case.
> > > > > > > Saving session at vim exit is for the case when I have to reload
> > > > > > > vim (mostly plugin or kernel updates).
> > > > > > > Here is my code:
> > You are doing a strange things again: > > 1. You should either rename `MakeSession' to `ClearArgs' (because > > `MakeSession' will confuse somebody (maybe even you) who will read you > > code as it does not makes any sessions) or, better, move `mksession!' > > call inside a function. 2. Why are you again writing `execute'? > > 3. You don't need `nested' for mksession, you need it only for VimEnter. > > 4. Never write anything user-specific to application folder, it may be > > purged by application update, removed by the package manager (if any) or > > uninstaller, or you may have to create more then one user on the > > machine.
> > Original message: > > > On Apr 15, 9:14 pm, ZyX <zyx....@gmail.com> wrote: > > > > Reply to message «Re: syntax coloring», > > > > sent 23:02:40 15 April 2011, Friday
> > > > by rameo: > > > > > Tnx.. this is what I added: > > > > > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> > > > Reread help. This is false: you should not use strikes around `argdel > > > > *' and you should have bar before `endif' just like you have before > > > > `argdel'.
> > > > > I noted that (even after a buffer delete :bd) certain buffers do > > > > > remain in "session.vim" > > > > > I had no troubles anymore after removing "argdel *" and troubles > > > > > again after having changed the script as above.
> > > > I know this issue. In this case you should have `argdel' before > > > > mksession, I don't get why you have it *after*.
> > > > Original message: > > > > > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote: > > > > > > Reply to message «Re: syntax coloring», > > > > > > sent 21:39:21 15 April 2011, Friday
> > > > > > by rameo: > > > > > > > Still have a little problem. > > > > > > > I had also a VimLeave argdel command in my _vimrc.
> > > > > > > > by rameo: > > > > > > > > > Please let me ask you one more question... > > > > > > > > > How do you close this session and reopens a custom one > > > > > > > > > (happens once in a while)?
> > > > > > > > I don't use one continious vim session and don't load any > > > > > > > > sessions at vim startup (the `just the same error' meant that > > > > > > > > I used an autocommand in a similar way and got the same > > > > > > > > error, not that I used the same code). Instead I create a > > > > > > > > new session file almost each time when vim exits and load > > > > > > > > one of created sessions at vim startup: 1. due to virtual > > > > > > > > desktops I almost never close any of my projects' windows, > > > > > > > > 2. I use vim to quickly edit something from command-line, > > > > > > > > loading any sessions will discard the most significant part > > > > > > > > of vim invocation arguments for this use-case. > > > > > > > > Saving session at vim exit is for the case when I have to > > > > > > > > reload vim (mostly plugin or kernel updates). > > > > > > > > Here is my code:
> > > You are doing a strange things again:
> > > 1. You should either rename `MakeSession' to `ClearArgs' (because
> > > `MakeSession' will confuse somebody (maybe even you) who will read you
> > > code as it does not makes any sessions) or, better, move `mksession!'
> > > call inside a function. 2. Why are you again writing `execute'?
> > > 3. You don't need `nested' for mksession, you need it only for VimEnter.
> > > 4. Never write anything user-specific to application folder, it may be
> > > purged by application update, removed by the package manager (if any) or
> > > uninstaller, or you may have to create more then one user on the
> > > machine.
> > > Original message:
> > > > On Apr 15, 9:14 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > Reply to message «Re: syntax coloring»,
> > > > > sent 23:02:40 15 April 2011, Friday
> > > > > by rameo:
> > > > > > Tnx.. this is what I added:
> > > > > > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> > > > > Reread help. This is false: you should not use strikes around `argdel
> > > > > *' and you should have bar before `endif' just like you have before
> > > > > `argdel'.
> > > > > > I noted that (even after a buffer delete :bd) certain buffers do
> > > > > > remain in "session.vim"
> > > > > > I had no troubles anymore after removing "argdel *" and troubles
> > > > > > again after having changed the script as above.
> > > > > I know this issue. In this case you should have `argdel' before
> > > > > mksession, I don't get why you have it *after*.
> > > > > Original message:
> > > > > > On Apr 15, 8:55 pm, ZyX <zyx....@gmail.com> wrote:
> > > > > > > Reply to message «Re: syntax coloring»,
> > > > > > > sent 21:39:21 15 April 2011, Friday
> > > > > > > by rameo:
> > > > > > > > Still have a little problem.
> > > > > > > > I had also a VimLeave argdel command in my _vimrc.
> > > > > > > > > by rameo:
> > > > > > > > > > Please let me ask you one more question...
> > > > > > > > > > How do you close this session and reopens a custom one
> > > > > > > > > > (happens once in a while)?
> > > > > > > > > I don't use one continious vim session and don't load any
> > > > > > > > > sessions at vim startup (the `just the same error' meant that
> > > > > > > > > I used an autocommand in a similar way and got the same
> > > > > > > > > error, not that I used the same code). Instead I create a
> > > > > > > > > new session file almost each time when vim exits and load
> > > > > > > > > one of created sessions at vim startup: 1. due to virtual
> > > > > > > > > desktops I almost never close any of my projects' windows,
> > > > > > > > > 2. I use vim to quickly edit something from command-line,
> > > > > > > > > loading any sessions will discard the most significant part
> > > > > > > > > of vim invocation arguments for this use-case.
> > > > > > > > > Saving session at vim exit is for the case when I have to
> > > > > > > > > reload vim (mostly plugin or kernel updates).
> > > > > > > > > Here is my code:
Reply to message «Re: syntax coloring», sent 12:13:11 16 April 2011, Saturday by rameo:
> Thank you.. > Nice to put the session file path in a variable. > (The only drawback is that it seems not to be enable to expand > variables as $HOME and $VIM)
Just use string concatenation (:h expr-.): `$HOME.'\vimsessions\main.vim'' instead of `'$HOME\vimsessions\main.vim''. And don't use $VIM, if your system is configured properly then you do not have write access to it at all.
> > > > You are doing a strange things again: > > > > 1. You should either rename `MakeSession' to `ClearArgs' (because > > > > `MakeSession' will confuse somebody (maybe even you) who will read > > > > you code as it does not makes any sessions) or, better, move > > > > `mksession!' call inside a function. 2. Why are you again writing > > > > `execute'? 3. You don't need `nested' for mksession, you need it > > > > only for VimEnter. 4. Never write anything user-specific to > > > > application folder, it may be purged by application update, removed > > > > by the package manager (if any) or uninstaller, or you may have to > > > > create more then one user on the machine.
> > > > Original message: > > > > > On Apr 15, 9:14 pm, ZyX <zyx....@gmail.com> wrote: > > > > > > Reply to message «Re: syntax coloring», > > > > > > sent 23:02:40 15 April 2011, Friday
> > > > > > by rameo: > > > > > > > Tnx.. this is what I added: > > > > > > > autocmd VimLeave * if argc() != 0 | 'argdel *' endif
> > > > > > Reread help. This is false: you should not use strikes around > > > > > > `argdel *' and you should have bar before `endif' just like you > > > > > > have before `argdel'.
> > > > > > > I noted that (even after a buffer delete :bd) certain buffers > > > > > > > do remain in "session.vim" > > > > > > > I had no troubles anymore after removing "argdel *" and > > > > > > > troubles again after having changed the script as above.
> > > > > > I know this issue. In this case you should have `argdel' before > > > > > > mksession, I don't get why you have it *after*.
> > > > > > > > > > by rameo: > > > > > > > > > > > Please let me ask you one more question... > > > > > > > > > > > How do you close this session and reopens a custom one > > > > > > > > > > > (happens once in a while)?
> > > > > > > > > > I don't use one continious vim session and don't load any > > > > > > > > > > sessions at vim startup (the `just the same error' meant > > > > > > > > > > that I used an autocommand in a similar way and got the > > > > > > > > > > same error, not that I used the same code). Instead I > > > > > > > > > > create a new session file almost each time when vim > > > > > > > > > > exits and load one of created sessions at vim startup: > > > > > > > > > > 1. due to virtual desktops I almost never close any of > > > > > > > > > > my projects' windows, 2. I use vim to quickly edit > > > > > > > > > > something from command-line, loading any sessions will > > > > > > > > > > discard the most significant part of vim invocation > > > > > > > > > > arguments for this use-case. > > > > > > > > > > Saving session at vim exit is for the case when I have to > > > > > > > > > > reload vim (mostly plugin or kernel updates). > > > > > > > > > > Here is my code: