Loading ...
Sorry, an error occurred while loading the content.

114150Left-align after separator on status line?

Expand Messages
  • Nathan Neff
    Apr 30, 2010
    • 0 Attachment
      Currently, I have the status line displaying Vim's
      current working directory.

      I like having the cwd on the right side of the status line.

      I would like to align the cwd as far left to the separator
      as possible, so that it doesn't shift around when I navigate
      from column 1 to column 10, (likewise row 1 to row 10).

      I've tried many variations of the sprintf syntax, and can't get
      the current working directory not to shift around depending on the
      line # and col # that I'm on.

      Any ideas?

      function! MyStatusLine()
      let l:statline = '%=' "left/right separator
      let l:statline = l:statline . '%-20{" | " . fnamemodify(getcwd(),
      ":t") . " | "}'
      let l:statline = l:statline . '%l, %v of %L' "cursor line/total lines
      return l:statline
      endfunction

      " Status Line
      set laststatus=2
      set statusline=%!MyStatusLine()

      Thanks,
      --Nate

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 3 messages in this topic