Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8921227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:29:11+00:00 2026-06-15T06:29:11+00:00

I was trying to customize my status line in Vim 7.3 when I encoutered

  • 0

I was trying to customize my status line in Vim 7.3 when I encoutered a problem.

I’m trying to put SVN informations in the status line, so I made something like this :

function! DrawStatusLine()
    let svn = system("svn info")
    let l:status = " "
    let l:status = l:status . svn
    let l:status = l:status . "%t"       "tail of the filename
    let l:status = l:status . "%*"
    let l:status = l:status . "[%{strlen(&fenc)?&fenc:'none'}," "file encoding
    let l:status = l:status . "%{&ff}]" "file format
    let l:status = l:status . "%h"      "help file flag
    let l:status = l:status . "%m"      "modified flag
    let l:status = l:status . "%r"      "read only flag
    let l:status = l:status . "%="      "left/right separator
    let l:status = l:status . "%c,"     "cursor column
    let l:status = l:status . "%l/%L"   "cursor line/total lines
    let l:status = l:status . "\ %P"    "percent through file
    return l:status
endfunction

set statusline=%!DrawStatusLine()

But after this call to sytem(), the cursor is moving very slowly. system seems to be called every time I move the cursor (actually, it seems to be called every time something happens in the window).

Do you have an idea why I get this behaviour ?

Here is the rest of my .vimrc, I use no exotic plugins and I am under Cygwin (Windows XP).

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
    finish
endif

" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" Management of console or GUI settings.
if has("gui_running")
    " We are in gVim
    " Linux
    if has("gui_gtk2")
        :set guifont=DejaVu\ Sans\ Mono\ 11
    " Windows
    elseif has("gui_win32")
        :set guifont=DejaVu_Sans_Mono:h11:cANSI:
    endif
else
    " We are in a console
    set background=dark
endif

" Manage colors.
if filereadable($VIMRUNTIME . "/colors/wombat256.vim") ||
            \ filereadable($VIM . "/vimfiles/colors/wombat256.vim") ||
            \ filereadable($HOME . "/.vim/colors/wombat256.vim")
    colorscheme wombat256
elseif filereadable($VIMRUNTIME . "/colors/wombat.vim") ||
            \ filereadable($VIM . "/vimfiles/colors/wombat.vim") ||
            \ filereadable($HOME . "/.vim/colors/wombat.vim")
    colorscheme wombat
else
    colorscheme desert
endif

" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
let &guioptions = substitute(&guioptions, "t", "", "g")

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
    set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
    syntax on
    set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

    " Enable file type detection.
    " Use the default filetype settings, so that mail gets 'tw' set to 72,
    " 'cindent' is on in C files, etc.
    " Also load indent files, to automatically do language-dependent indenting.
    filetype plugin indent on

    " Put these in an autocmd group, so that we can delete them easily.
    augroup vimrcEx
        autocmd!

        " For all text files set 'textwidth' to 78 characters.
        autocmd FileType text setlocal textwidth=78

        " When editing a file, always jump to the last known cursor position.
        " Don't do it when the position is invalid or when inside an event handler
        " (happens when dropping a file on gvim).
        " Also don't do it when the mark is in the first line, that is the default
        " position when opening a file.
        autocmd BufReadPost *
                    \ if line("'\"") > 1 && line("'\"") <= line("$") |
                    \   exe "normal! g`\"" |
                    \ endif

    augroup END

else

    set autoindent " always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
    command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
                \ | wincmd p | diffthis
endif

" Update the path with the dir where we opened Vim
set path=.,$PWD/**
" Now that we set the path to be recursive, disable
" the option that looking for completion in included files.
" Indeed, it can slow the process hard. We use tags instead.
set complete-=i

" Allow editing everywhere
set virtualedit=all

" No bells
set errorbells
set novisualbell
set vb t_vb=

" Show status bar
set laststatus=2
let loaded_matchparen = 1

" Draw the status line.
" Status line that rocks.
function! DrawStatusLine()
    let svn = system("svn info")
    let l:status = " "
    let l:status = l:status . "%t"       "tail of the filename
    let l:status = l:status . "%*"
    let l:status = l:status . "[%{strlen(&fenc)?&fenc:'none'}," "file encoding
    let l:status = l:status . "%{&ff}]" "file format
    let l:status = l:status . "%h"      "help file flag
    let l:status = l:status . "%m"      "modified flag
    let l:status = l:status . "%r"      "read only flag
    let l:status = l:status . "%="      "left/right separator
    let l:status = l:status . "%c,"     "cursor column
    let l:status = l:status . "%l/%L"   "cursor line/total lines
    let l:status = l:status . "\ %P"    "percent through file
    return l:status
endfunction

set statusline=%!DrawStatusLine()

" Highlight current line
set cursorline

" Add visible lines when start or end of the screen (3 lines)
set scrolloff=3

" Backup
set nobackup

" No preview in ins-completion.
set completeopt=menu

" Commands completion on status line.
set wildmenu

" Don't redraw while executing macros
set lazyredraw

" K = :help
set keywordprg=

" Diff always vertical
set diffopt+=vertical

" Use utf-8
set encoding=utf-8
set fileencoding=utf-8

" Remember buffer changes when jumping around.
set hidden

"""""""""""""""""
" Developpement "
"""""""""""""""""

" Line numbers
set nu

" Tabulation of 4 spaces
set expandtab
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4

" Show when a line exceeds 80 chars
highlight Overlength ctermbg=red ctermfg=white guibg=#592929

" Highlight Tabs and Spaces
" highlight Tab ctermbg=darkgray guibg=darkgray
" au BufWinEnter * let w:m2=matchadd('Tab', '/[^\t]\zs\t\+/', -1)
highlight Space ctermbg=darkblue guibg=darkblue
augroup matches
    autocmd!
    autocmd BufWinEnter * match Overlength /\%81v.*/
    autocmd BufWinEnter * let w:m3=matchadd('Space', '\s\+$\| \+\ze\t', -1)
    " Matches are memory greedy, shut them when the window is left
    " Mybe it is redondant.
    autocmd BufWinLeave * call clearmatches()
augroup END

set list listchars=tab:\ \ ,trail:.


" Redraw status line when saving.
" autocmd BufWritePost * set statusline=%!DrawStatusLine()

" Special indentation for switch / case
" Indentation when in unclosed (.
set cino=l1,(0

" Load Doxygen syntax
let g:load_doxygen_syntax=1

"""""""""""""""""
" Taglist
"""""""""""""""""
let Tlist_Use_Right_Window=1

"""""""""""""""""
" cscope
"""""""""""""""""
if has("cscope") && executable("cscope") && !has("gui_win32")
    set csto=0
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
        cs add cscope.out
    endif
    " abbreviations
    cnoreabbrev csf cs find
    set csverb
endif

"""""""""""""
"  Mapping  "
"""""""""""""

" Don't use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","

" After repeating command, return where we were.
map . .`[

" Switch tab.
noremap <A-h> gT
noremap <A-l> gt
" For dummy terminals
noremap <Esc>h gT
noremap <Esc>l gt

" Remap the Esc command
inoremap kj <Esc>
inoremap lk <Esc>

" Better for wrapped lines
nnoremap j gj
nnoremap k gk

" omnicompletion : words
inoremap <leader>, <C-x><C-o>

" Turn off highlighting in search.
nmap <leader>/ :nohlsearch<CR>

" edit .vimrc
nmap <silent> <leader>ev :tabnew $HOME/.vimrc<CR>
" source .vimrc
nmap <silent> <leader>sv :so $HOME/.vimrc<CR>

nnoremap <silent><leader>dh :call SVNDiff()<CR>

" Build C symbols.
function! BuildSymbols()
    if has("cscope") && executable("cscope") && !has("gui_win32")
        " kill all connection.
        execute "cs kill -1"
        execute "!ctags -R && cscope -Rb"
        execute "cs add cscope.out"
    else
        execute "!ctags -R"
    endif
endfunction

" Run Vim diff on HEAD copy in SVN.
function! SVNDiff()
    let fn = expand("%:p")
    let newfn = fn .  ".HEAD"
    let catstat = system("svn cat " . fn . " > " . newfn)
    if catstat == 0
        execute 'diffsplit ' . newfn
        execute 'set filetype=c'
    else
        echo "*** ERROR: svn cat failed for ". fn . " (as " . newfn . ")"
    endif
endfunction

" Build symbols with F2.
nnoremap <F2> :call BuildSymbols()<CR>

" Taglist with F3
nnoremap <F3> :TlistToggle<CR>

" Open a explorer on a vertical split of 26.
nnoremap <F4> :26Vexplore<CR>

" When you forgot to open the file as sudo.
cmap w!! %!sudo tee > /dev/null %
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:29:12+00:00Added an answer on June 15, 2026 at 6:29 am

    This is expected behaviour: the whole statusline is updated each time you move your cursor thus your svn info is executed everytime you do something. Possibly many times per second.

    That’s obviously a waste since the svn status of the current file is not going to change 10 times per second.

    You should cache this information and only retrieve it on write or every n minutes or something along that line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to customize a status bar so it will look like this
Currently I'm trying to customize delte button in UITableViewCell. Now I've got something like
Trying to customize Symfony2 form to produce html code looking like the following example:
im trying to customize this page indicator with half succes, but after many hours
I am trying to customize an Ext.form.Slider in Sencha Touch 1.1. This is my
I've been trying to customize a portion of PHP script for this. I want
I am trying to customize this script so that instead of a user's recent
I am currently trying to customize an example such as this ... http://bl.ocks.org/1377729 to
I'm trying to customize the logging functionality of codeigniter. I found this forum thread
I am trying to customize the delete function in jqGrid. I have enabled the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.