dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit a4160c66b4e7a34c62576eaa555e0ae3477178e1
parent 864f32cb7f1f3431b8beb346327001ec26ab00ce
Author: bharatvaj.ph <bharatvaj.ph@zohocorp.com>
Date:   Fri, 22 Apr 2022 23:57:01 +0530

Use augroup for loading plugins in vim

This change has significant startup time improvements

Remove GREP_OPTIONS from .profile as it is deprecated

NOTE
----
The plugins are not loading automatically. Fix it in the upcoming commits.

Diffstat:
M.config/alacritty/alacritty.yml | 3+++
M.config/vim/vimrc | 70+++++++++++++++++++++++++++++++++++++++++-----------------------------
M.profile | 1-
3 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml @@ -7,3 +7,6 @@ import: - ~/.config/alacritty/unix.yml live_config_reload: true + +shell: + program: cmd diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -1,43 +1,19 @@ -" Use XDG Paths for vim -set runtimepath^='$XDG_CONFIG_HOME/vim' -set runtimepath+='$XDG_DATA_HOME/vim' -set runtimepath+='$XDG_CONFIG_HOME/vim/after' - -set packpath^=$XDG_DATA_HOME/vim - -let g:netrw_home = $XDG_DATA_HOME . "/vim" -call mkdir($XDG_DATA_HOME . "/vim/spell", 'p') -set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p') - -set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p') -set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p') -set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p') - -if !has('nvim') | set viminfofile=$XDG_CACHE_DIR/vim/viminfo | endif - -" Line number -"Adapted from https://jeffkreeftmeijer.com/vim-number/ -set number -augroup numbertoggle - autocmd! - autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif - autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif -augroup END +if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif " General +set number set mouse= set nocursorline -syntax on set exrc -set scrolloff=8 + " Turn backup off set nobackup set nowb set noswapfile " Map leader to space -nnoremap <SPACE> <Nop> -let mapleader = " " +nnoremap <space> <Nop> +let mapleader = <space> " Enable hidden buffers set hidden @@ -76,6 +52,42 @@ set laststatus=1 " Keybindings source $XDG_CONFIG_HOME/vim/keybindings/keybindings.vim +set nowrapscan +set lazyredraw +set ttyfast + +" Plugins +source $XDG_CONFIG_HOME/vim/plugin/plugin.vim + +" Keybindings +source $XDG_CONFIG_HOME/vim/keybindings/keybindings.vim + +function! s:load_plugins(t) abort + " Use XDG Paths for vim + set packpath^=$XDG_DATA_HOME/vim + syntax on + set synmaxcol=128 + " TODO compile hard constants somewhere based on OS + set runtimepath^='$XDG_CONFIG_HOME/vim' + set runtimepath+='$XDG_DATA_HOME/vim' + set runtimepath+='$XDG_CONFIG_HOME/vim/after' + + + let g:netrw_home = $XDG_DATA_HOME . "/vim" + " call mkdir($XDG_DATA_HOME . "/vim/spell", 'p') + " set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p') + + " set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p') + " set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p') + " set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p') + packadd vim-surround +endfunction + +augroup user_cmds + autocmd! + autocmd VimEnter * call timer_start(20, function('s:load_plugins')) +augroup END + if has("win32") if executable("pwsh") set shell=pwsh diff --git a/.profile b/.profile @@ -1,4 +1,3 @@ -export GREP_OPTIONS='--color=auto' export GREP_COLOR='1;35;40' # XDG