Add support for vim-devicons
authorStefan Huber <shuber@sthu.org>
Sat, 21 Mar 2020 13:59:04 +0000 (14:59 +0100)
committerStefan Huber <shuber@sthu.org>
Sat, 21 Mar 2020 13:59:04 +0000 (14:59 +0100)
gvimrc
init.vim
install.sh
plugins.vim

diff --git a/gvimrc b/gvimrc
index d99a44fe0d1fa77bd3fb5d06d3040c48dd8bd78c..1956f8b839b5797d0d1fe6fd3ccf08829cfcbec0 100644 (file)
--- a/gvimrc
+++ b/gvimrc
@@ -1,6 +1,6 @@
 set columns=100
 set lines=53
 
-set guifont=Hack\ 9,Liberation\ Mono\ for\ Powerline\ 10,DejaVu\ Sans\ Mono\ 10,Monospace\ 10
+set guifont=Hack\ NF\ 9,Hack\ 9,Liberation\ Mono\ for\ Powerline\ 10,DejaVu\ Sans\ Mono\ 10,Monospace\ 10
 
 set mousehide
index fd7e77d2a201700756727def8b22c6896457adf9..e4ed9a13b07cc5dcb700521112edb9b7666bfc5b 100644 (file)
--- a/init.vim
+++ b/init.vim
@@ -43,6 +43,9 @@ syntax on
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Some global plugin settings
 
+" Enable loading of devicons
+let g:enable_plugin_devicons = 1
+
 runtime plugsetup.vim
 
 " Attention: Must be run after plugsetup.vim
index b6ce4d78021614f5f337c1df98464b347fe83617..4a5ee5aeeee503b92a308651ad673d55037c2ee2 100755 (executable)
@@ -25,13 +25,23 @@ check_py3()
 check_prog()
 {
     if which "$1" > /dev/null; then
-        echo "$1 found"
+        echo "$1 found."
     else
         echo "$1 not found. Aborting."
         exit
     fi
 }
 
+check_font()
+{
+    if fc-list | grep -q "$1"; then
+        echo "Font $1 found."
+    else
+        echo "Font $1 not found. Either install it or clear g:enable_plugin_devicons."
+        exit
+    fi
+}
+
 check_requirements()
 {
     check_prog aspell
@@ -39,6 +49,7 @@ check_requirements()
     check_prog git
     check_vim +python3
     check_py3 neovim
+    check_font "Hack NF"
 }
 
 backup() {
index 2b36d0ad8b6ae0f4e180ffa4d98f76767a417f22..0e25290ce4ca3a7e9adceeb7c04b6f42a88b7bd1 100644 (file)
@@ -1,3 +1,8 @@
+function! Cond(cond, ...)
+  let opts = get(a:000, 0, {})
+  return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
+endfunction
+
 Plug 'mhinz/vim-startify'
 
 Plug 'vim-airline/vim-airline'
@@ -15,6 +20,8 @@ Plug 'scrooloose/nerdcommenter'
 Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
 Plug 'Xuyuanp/nerdtree-git-plugin', {'on': 'NERDTreeToggle'}
 
+Plug 'ryanoasis/vim-devicons', Cond(g:enable_plugin_devicons)
+
 Plug 'neomake/neomake'
 Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'}