Giter Site home page Giter Site logo

Tab label in a workspace about vim-ctrlspace HOT 7 OPEN

jeeeem avatar jeeeem commented on June 2, 2024
Tab label in a workspace

from vim-ctrlspace.

Comments (7)

Konfekt avatar Konfekt commented on June 2, 2024

This seems to be the relevant code to save the tab labels:

" autoload/ctrlspace/workspaces.vim (lines 351-373)
for t in range(1, lastTab)
    let data = {
                \ "label": ctrlspace#util#Gettabvar(t, "CtrlSpaceLabel"),
                \ "autotab": ctrlspace#util#GettabvarWithDefault(t, "CtrlSpaceAutotab", 0)
                \ }

    let ctrlspaceList = ctrlspace#api#Buffers(t)

    let bufs = []

    for [nr, bname] in items(ctrlspaceList)
        let bufname = fnamemodify(bname, ":.")

        if !filereadable(bufname)
            continue
        endif

        call add(bufs, bufname)
    endfor

    let data.bufs = bufs
    call add(tabData, data)
endfor

and this to load them:

" autoload/ctrlspace/workspaces.vim (lines 223-233)
for ol in oldLines
    if ol ==# startMarker
        let inWorkspace = 1
    elseif ol ==# endMarker
        let inWorkspace = 0
    elseif inWorkspace
        let ol = substitute(ol, "let t:ctrlspace_label", "let t:CtrlSpaceLabel", "")
        let ol = substitute(ol, "let t:ctrlspace_autotab", "let t:CtrlSpaceAutotab", "")
        call add(lines, ol)
    endif
endfor

from vim-ctrlspace.

Konfekt avatar Konfekt commented on June 2, 2024

Perhaps the labels are saved fine, but the buffers are loaded afterwards and their names set as labels? However, why does this not happen for the first tab?

from vim-ctrlspace.

Konfekt avatar Konfekt commented on June 2, 2024

I cannot reproduce with the latest master. In cs_workspaces there are two lines starting let t:CtrlSpaceLabel = ... that set the tab labels of the two tabs correctly after loading the workspace.

Could you reproduce with a minimal vimrc?

from vim-ctrlspace.

jeeeem avatar jeeeem commented on June 2, 2024

Perhaps the labels are saved fine, but the buffers are loaded afterwards and their names set as labels? However, why does this not happen for the first tab?

I'm not really sure, but I remember when I tried your repo before it was merged to master, the tab labels was working. Then I checked that your fork was already merged I installed ctrl-space again with this repo, and this happened. But I'm not really sure if I have installed some plugins or what that may be the cause of this.

I cannot reproduce with the latest master. In cs_workspaces there are two lines starting let t:CtrlSpaceLabel = ... that set the tab labels of the two tabs correctly after loading the workspace.

Could you reproduce with a minimal vimrc?

I'll try this week.

from vim-ctrlspace.

Konfekt avatar Konfekt commented on June 2, 2024

I remember when I tried your repo before it was merged to master, the tab labels was working.

Then this could be due to my old version 8.0.1568 of Vim. Maybe it is due to

" autoload/ctrlspace/workspaces.vim (lines 388-429)
for cmd in readfile("CS_SESSION")
    if cmd =~# "^lcd "
        continue
    elseif cmd =~# "^badd\>"
        let baddList = matchlist(cmd, '\v^badd \+\d+ (\f+)$')
        if exists("baddList[1]") && filereadable(baddList[1])
            call add(lines, cmd)
        endif
    elseif
    \    ((cmd =~# '^edit \f\+') && (tabIndex == 0))
    \ || (!has('patch-8.1.149') && cmd =~# '^tabedit \f\+')
    \ || ( has('patch-8.1.149') && cmd ==# 'tabnext')
    " NB: check patch-8.1.149 for backend vim mksession change
        let data = tabData[tabIndex]

        if cmd =~# '^tabedit \f\+'
            call add(lines, 'tabedit')
        elseif cmd ==# 'tabnext'
            call add(lines, cmd)
        endif

        for b in data.bufs
            call add(lines, 'edit ' . fnameescape(b))
        endfor

        if cmd =~# '^tabedit \f\+'
            " turn 'tabedit ...' into 'edit ...'
            call add(lines, cmd[3:])
        endif

        if !empty(data.label)
            call add(lines, "let t:CtrlSpaceLabel = '" . substitute(data.label, "'", "''","g") . "'")
        endif
        if !empty(data.autotab)
            call add(lines, "let t:CtrlSpaceAutotab = " . data.autotab)
        endif

        let tabIndex += 1
    else
        call add(lines, cmd)
    endif
endfor

from vim-ctrlspace.

Konfekt avatar Konfekt commented on June 2, 2024

Please paste the relevant lines of cs_workspaces where the tab lables are set.

from vim-ctrlspace.

Konfekt avatar Konfekt commented on June 2, 2024

I can neither reproduce with Vim 8.1.892 > 8.1.149. Could you check if the statusline plug-in intervenes? There are some checks for airline in the repo's code, for example.

from vim-ctrlspace.

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.