" Customized .vimrc for server " https://gogs.viktorsvensson.se/viktor/public/raw/master/.vimrc-server " Set nocompatible to be able to source the file using vim -u set nocompatible " Install curl if missing if !executable("curl") echo "Installing curl" silent !apt update && apt -y install curl echo "Done installing curl" endif " Install curl if missing if !executable("git") echo "Installing git" silent !apt update && apt -y install git echo "Done installing git" endif " Plugin manager if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif " Plugins call plug#begin('~/.vim/plugged') Plug 'preservim/nerdtree' Plug 'tpope/vim-commentary' call plug#end() filetype plugin indent on syntax on set autoindent set backspace=2 set background=dark set cursorcolumn set cursorline set expandtab set history=1000 set hlsearch set incsearch set nowrap set number set numberwidth=4 set pastetoggle= "Press when paste-alot set preserveindent set ruler set shiftround set shiftwidth=2 set shortmess=atI set showcmd set showmatch set smartindent set smarttab set splitright set tabstop=2 set whichwrap+=<,>,[,],h,l set undofile set undodir=~/.vim/undo if !isdirectory($HOME."/.vim/undo") call mkdir($HOME."/.vim/undo", "p") endif " Close NERDTree on opening file let NERDTreeQuitOnOpen=1 " Show hidden files let NERDTreeShowHidden=1 function! NERDTreeToggleCustom() " If NERDTree is open in the current buffer if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1) exe ":NERDTreeClose" elseif bufname('%') != "" exe ":NERDTreeFind" else exe ":NERDTreeCWD" endif endfunction " Toggle NERDTree on -o map o :call NERDTreeToggleCustom() colorscheme ron