This is the version of vim that I am using
vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI. Features included (+) or not (-):
+acl -farsi -mouse_sysmouse -tag_any_white
+arabic +file_in_path +mouse_urxvt +tcl
+autocmd +find_in_path +mouse_xterm +termguicolors
+autochdir +float +multi_byte +terminal
-autoservername +folding +multi_lang +terminfo
-balloon_eval -footer -mzscheme +termresponse
+balloon_eval_term +fork() +netbeans_intg +textobjects
-browse +gettext +num64 +textprop
++builtin_terms -hangul_input +packages +timers
+byte_offset +iconv +path_extra +title
+channel +insert_expand +perl -toolbar
+cindent +job +persistent_undo +user_commands
-clientserver +jumplist +postscript +vartabs
-clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +virtualedit
+cmdline_hist +langmap -python +visual
+cmdline_info +libcall +python3 +visualextra
+comments +linebreak +quickfix +viminfo
+conceal +lispindent +reltime +vreplace
+cryptv +listcmds +rightleft +wildignore
+cscope +localmap +ruby +wildmenu
+cursorbind +lua +scrollbind +windows
+cursorshape +menu +signs +writebackup
+dialog_con +mksession +smartindent -X11
+diff +modify_fname +sound -xfontset
+digraphs +mouse +spell -xim
-dnd -mouseshape +startuptime -xpm
-ebcdic +mouse_dec +statusline -xsmp
+emacs_tags +mouse_gpm -sun_workshop -xterm_clipboard
+eval -mouse_jsbterm +syntax -xterm_save
+ex_extra +mouse_netterm +tag_binary
+extra_search +mouse_sgr -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-iU6mZD/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.7 -lm
This is my vimrc
.vimrc
set nocompatible
set incsearch
set hlsearch
set number relativenumber
set encoding=utf-8
set noswapfile
set smartindent
set undodir=~/.vim/undodir
set undofile
let mapleader = " "
syntax enable
filetype plugin indent on
set path+=**
set wildmenu
let $RTP=split(&runtimepath,',')[0]
let $RC="$HOME/.vimrc"
" Ctrl-[ for finding definition
command! MakeTags !ctags -R .
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" Declare the list of plugins.
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'junegunn/seoul256.vim'
Plug 'preservim/nerdtree'
Plug 'ap/vim-css-color'
Plug 'ajmwagar/vim-deus'
Plug 'dbeniamine/cheat.sh-vim'
Plug 'valloric/youcompleteme'
Plug 'powerline/powerline' , {'rtp': 'powerline/bindings/vim/'}
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
set guifont=Source\ Code\ Pro\ for\ Powerline
set background=dark " Setting dark mode
colorscheme deus
I would like to fix this Error such that the correct Characters are displayed I am using vim not gvim and I tried to add a font but it didn't work. What I am doing wrong?
This answer is for everyone, who wants to install powerline only in vim in the windows terminal (using wsl Ubuntu 20.04). It took me quite some time.
The reason why I had this issue was that glyphs where missing in the windows terminal font. I tried to install the powerline fonts according to the documentation(https://powerline.readthedocs.io/en/latest/installation/linux.html#fontconfig) as @romainl suggested but that didn't work. Furthermore I tried to install all powerline fonts from the github(https://github.com/powerline/fonts), I ran both the installation scripts. The one for windows in the powershell console according to this blog() and the one for Linux on the Ubuntu WSL Machine according to the documentation. Didn't work either.
Then I stumbled upon a blog post of Microsoft(https://learn.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup), where the person installed a theming framework oh-my-posh. However, I neither wanted to install a theming framework nor a special version of git. Furthermore I only wanted to install powerline in vim not in my whole console. This was the moment when I asked myself: did I miss something? And indeed I did catch a little detail. The answer was to install a the Cascadia Mono PL font (https://github.com/microsoft/cascadia-code/releases) which includes the missing glyphs. Just download the zip and double click on the font. Furthermore I had to set the fontface in the setting.json of the windows terminal (which can open with pressing (CTRL + ,
) in the terminal). Your settings should look something like this:
{
"guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
"hidden": false,
"name": "Ubuntu-20.04",
"fontFace": "Cascadia Code PL",
"padding" : "0, 0, 0, 0",
"source": "Windows.Terminal.Wsl"
},
Now that the prerequisites are handled, I can talk about the correct settings you need to set in your .vimrc in order to use powerline in vim. First of all you should use a plugin manager I would recommend vim-plug(https://github.com/junegunn/vim-plug) simply because it is maintained and I use it. After installing vim-plug you only need to add the following one line to your .vimrc between the import statements:
Plug 'powerline/powerline' , {'rtp': 'powerline/bindings/vim/'}
The conclusion is that it doesn't matter how many fonts you install in the wsl machine and you do not need to set the guifont in the windows terminal because it does nothing. This is why the documentation of didn't really help because it missed a little information which I needed to connect the dots.
UPDATE:
Windows changed its font naming, the new name in the new windows terminal settings page is Cascadia Code PL Regular