Procházet zdrojové kódy

add vimrc with minimal plugins

Viktor Grahn před 3 roky
rodič
revize
b2258dd43f
1 změnil soubory, kde provedl 85 přidání a 0 odebrání
  1. 85 0
      .vimrc-server

+ 85 - 0
.vimrc-server

@@ -0,0 +1,85 @@
+" Customized .vimrc for server
+" https://gogs.viktorsvensson.se/viktor/public/src/master/.vimrc-server
+
+" 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=<F12> "Press <F12> 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 <space>-o
+map <Space>o :call NERDTreeToggleCustom()<CR>