I'm starting on VIM (yes, just VIM, not NeoVIM or any other) and I have a StatusLine configured in my .vimrc and which shows the current mode I'm in and all modes are shown correctly except... when I enter Command-line mode (" : ") I want the statusline to show "COMMAND" and it shows "NORMAL" (I added a screenshot at the bottom showing the StatusLine).
I'm looking for a solution where I don't have to install any plugin. I searched a lot for this problem and I didn't find anything related with this specific problem... Thanks!
Here is the .vimrc
(StatusLine stuff begins where it says " >>>>> Status line") :
Note: I know that I have "set noshowmode", but I already did "set showmode" and it didn't work. I only did "set noshowmode" because I don't need the mode to be shown twice...
" ------------------ VIM Configuration -------------------------
set nocompatible " VI compatible mode is disabled so that VIm things work
syntax on " enable syntax processing
syntax enable
set encoding=utf-8
filetype indent on " load filetype-specific indent files
filetype on
filetype plugin on " load filetype specific plugin files
" >>>>> Spaces & Tabs
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smartindent
" ----------------------------------------------------------
" >>>>> Buffers
set hidden " Allows having hidden buffers without saving them
" ----------------------------------------------------------
" >>>>> UI Config
set number " show line numbers
set colorcolumn=80 "Know where I am
highlight ColorColumn ctermbg=white
set nowrap
set scrolloff=8
set wildmenu " visual autocomplete for command menu
set nobackup " backup file is immediately deleted upon successfully writing the original file.
set noswapfile
let python_highlight_all=1
set omnifunc=syntaxcomplete#Complete
" ----------------------------------------------------------
" >>>>> Searching
set path+=**
set incsearch " search as characters are entered
set ignorecase " Ignore case in searches by default
set smartcase " But make it case sensitive if an uppercase is entered
" ----------------------------------------------------------
" >>>>> Status line
" status bar colors
au InsertEnter * hi statusline guifg=black guibg=#d7afff ctermfg=black ctermbg=magenta
au InsertLeave * hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan
hi statusline guifg=black guibg=#8fbfdc ctermfg=black ctermbg=cyan
" default: set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)
" Status Line Custom
let g:currentmode={
\ 'n' : 'Normal',
\ 'no' : 'Normal·Operator Pending',
\ 'v' : 'Visual',
\ 'V' : 'V·Line',
\ '^V' : 'V·Block',
\ 's' : 'Select',
\ 'S' : 'S·Line',
\ '^S' : 'S·Block',
\ 'i' : 'Insert',
\ 'R' : 'Replace',
\ 'Rv' : 'V·Replace',
\ 'c' : 'Command',
\ 'cv' : 'Vim Ex',
\ 'ce' : 'Ex',
\ 'r' : 'Prompt',
\ 'rm' : 'More',
\ 'r?' : 'Confirm',
\ '!' : 'Shell',
\ 't' : 'Terminal'
\}
set laststatus=2
set noshowmode
set statusline=
set statusline+=%0*\ %n\ " Buffer number
set statusline+=%1*\ %<%F%m%r%h%w\ " File path, modified, readonly, helpfile, preview
set statusline+=%3*│ " Separator
set statusline+=%2*\ %Y\ " FileType
set statusline+=%3*│ " Separator
set statusline+=%2*\ %{''.(&fenc!=''?&fenc:&enc).''} " Encoding
set statusline+=\ (%{&ff}) " FileFormat (dos/unix..)
set statusline+=%= " Right Side
set statusline+=%2*\ col:\ %02v\ " Column number
set statusline+=%3*│ " Separator
set statusline+=%1*\ ln:\ %02l/%L\ (%3p%%)\ " Line number / total lines, percentage of document
set statusline+=%0*\ %{toupper(g:currentmode[mode()])}\ " The current mode
hi User1 ctermfg=007 ctermbg=239 guibg=#4e4e4e guifg=#adadad
hi User2 ctermfg=007 ctermbg=236 guibg=#303030 guifg=#adadad
hi User3 ctermfg=236 ctermbg=236 guibg=#303030 guifg=#303030
hi User4 ctermfg=239 ctermbg=239 guibg=#4e4e4e guifg=#4e4e4e
" ----------------------------------------------------------
" >>>>> Netrw (File Tree)
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
let g:netrw_winsize = 75
" ----------------------------------------------------------