Git Product home page Git Product logo

Comments (4)

lmintmate avatar lmintmate commented on May 20, 2024

A clarification: In regards to the problem where I couldn't change g:modusline_colors['t'], I experimented some more and found out I needed to put in my vimrc the entirety of the g:modusline_colors variables (as can be seen in the code block in the README) so that vim wouldn't crash. Afterwards, I only changed g:modusline_colors['t'] to let g:modusline_colors['t'] = '%#StatusLineTerm#', which remedies the problem somewhat. It should thus be made clearer in the README that one needs to paste all the variables in the README, even if they only want to change a single one, for this to work. Alternatively, a way to change only a single variable without vim not opening correctly would be highly appreciated. Unfortunately, I don't know enough vimscript myself to attempt anything like that. Thanks again in advance.

from vim-modusline.

sunaku avatar sunaku commented on May 20, 2024

Hmm, the singular override should work properly if executed after this plugin is loaded:

" Step 1. make sure the plugin is loaded first... 
" (refer to your favorite Vim plugin manager's documentation on how to achieve this)
" Step 2. now you can perform the singular override
let g:modusline_colors['t'] = '%#StatusLineTerm#'

Alternatively, you can register a VimEnter autocommand hook to run when Vim starts up:

autocmd VimEnter * call s:customize_modusline()
function! s:customize_modusline() abort
  " do your customization here, inside this function
  let g:modusline_colors['t'] = '%#StatusLineTerm#'
endfunction

Alternatively, you can override the ModuslineColor() function to differ when modus=t:

function! ModuslineColor(modus) abort
  if a:modus == 't'
    return '%#StatusLineTerm#'
  endif
  return get(g:modusline_colors, a:modus, '%#ErrorMsg#')
endfunction

from vim-modusline.

lmintmate avatar lmintmate commented on May 20, 2024

I use vim plug, and place the plugin settings section (where I put the setting for modusline) of my vimrc after plug#end, so it should normally work - after all, all the other settings there work fine. I used your autocommand solution (didn't try overriding the ModusLineColor() function) and this one worked. The autocommand solution seems also better for configuring multiple colors, because in the meanwhile I also changed the look of Replace (g:modusline_colors['R']), and simply placed this additional customization inside the function, while with a conditional (which is used in the override method), I'd have to say if a:modus = 't' or 'R' or something of that sort and would get it wrong.
tl;dr: I verified that I placed the setting in the correct place in my vimrc. I then tried the autocommand method and it worked.

from vim-modusline.

sunaku avatar sunaku commented on May 20, 2024

👍 I'm glad it worked out, enjoy! 🌈

from vim-modusline.

Related Issues (1)

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.