From fdb9d0baf798c147360a2ca44ea6761abf7f96c3 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 6 Mar 2020 16:50:46 +0100 Subject: Vim madness started, fix install.sh typo --- .pluggins.vim | 1 + .vimrc | 82 +++++++++++++++++++++++++++++++++++++++-------------------- .zshrc | 3 ++- install.sh | 24 +++++++++-------- 4 files changed, 72 insertions(+), 38 deletions(-) diff --git a/.pluggins.vim b/.pluggins.vim index 45d0976..1c60958 100644 --- a/.pluggins.vim +++ b/.pluggins.vim @@ -6,6 +6,7 @@ call plug#begin() Plug 'tomtom/tcomment_vim' " mininal commenter Plug 'itchyny/lightline.vim' " minimal status bar + " bloat?? Plug 'romainl/vim-cool' " disable highlight after search Plug 'haya14busa/incsearch.vim' " better incsearch diff --git a/.vimrc b/.vimrc index 6b8dd5b..6ff14c7 100644 --- a/.vimrc +++ b/.vimrc @@ -2,24 +2,25 @@ " vimrc " """""""""" -" source pluggins +" load pluggins source $HOME/dotfiles/.pluggins.vim - " common let mapleader = ' ' " set leader key to space -syntax enable " enable syntax -set hidden " keep change in buffer when quitting window -set noswapfile " disable swap files +let maplocalleader = '-' " set file local leader key to backslash set nocompatible " not compatible with vi -filetype plugin indent on " allow to add specific rules for certain type of file -set number relativenumber " line number relative to cursor +set number " line number +set relativenumber " line number relative to cursor +set numberwidth=1 " line numbers gutter autowidth set cursorline " highlight current line set noshowmatch " dont jump to pair bracket set autoread " reload files when changes happen outside vim +set hidden " keep change in buffer when quitting window +set noswapfile " disable swap files set scrolloff=2 " line padding when scrolling -set encoding=utf-8 " utf-8 encoding set textwidth=89 " when line wrap occurs +set encoding=utf-8 " utf-8 encoding +filetype plugin indent on " allow to add specific rules for certain type of file " browse list with tab set wildmode=longest,list,full @@ -31,18 +32,6 @@ set splitbelow set splitright set fcs+=vert:\ " no split separator -" split navigation -nnoremap -nnoremap -nnoremap -nnoremap - -" spit resizing -nnoremap zh > -nnoremap zl < -nnoremap zj - -nnoremap zk + - " tab set expandtab " tab to space set tabstop=4 " tab size @@ -62,6 +51,8 @@ set laststatus=2 " always a statusline (all window) set showcmd " show current partial command in the bottom right set noshowmode " dont show current mode (i.e --INSERT--) +" fold +set foldmethod=indent " create fold based on the text indent " ctrlp pluggin " directory to ignore when searching in file tree @@ -75,24 +66,61 @@ colorscheme onedark let g:lightline = {} let g:lightline.colorscheme = 'one' " lightline theme to onedark -" mappings +"""""""""""" +" mappings " +"""""""""""" + +" split navigation +nnoremap +nnoremap +nnoremap +nnoremap + " 'Y' yank to the end of the line noremap Y y$ - " solves annoying delay went exiting insert mode -imap -" jj or kk to exit insert mode -imap jj -imap kk +inoremap +" kj to exit insert mode +inoremap kj " remove visual mode keybinding -map Q +noremap Q +" remove command line window keybinding +noremap q: " incsearch map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) +" move line up and down +nnoremap _ ddkP +nnoremap + ddp +" long move up/down +nnoremap ( 10k +nnoremap ) 10j +" tag nagigation +nnoremap ] +nnoremap t +" buffer navigation +nnoremap n :bn +nnoremap p :bp +nnoremap :b# +nnoremap l :ls +" file manipulation with leader +nnoremap w :w +nnoremap x :x + +" open vimrc in split +nnoremap rc :vsplit $MYVIMRC +" source vimrc +nnoremap src :source $MYVIMRC + +" file toggle +nnoremap z zi " remove trailing white space on save autocmd BufWritePre * %s/\s\+$//e +" initialise buf for fold toggle +autocmd BufReadPre * :normal zMzi + " real tab in c file for school projects autocmd Filetype c setlocal noexpandtab diff --git a/.zshrc b/.zshrc index 3e752e9..325f929 100644 --- a/.zshrc +++ b/.zshrc @@ -21,7 +21,7 @@ zstyle ':completion:*' matcher-list '' \ 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=*' 'r:|=* l:|=* r:|=*' # case insensitive zmodload zsh/complist compinit -_comp_options+=(globdots) +# _comp_options+=(globdots) # vim keybindings in tab completion menu (https://www.youtube.com/watch?v=eLEo4OQ-cuQ) bindkey -M menuselect 'h' vi-backward-char @@ -66,6 +66,7 @@ export XDG_CONFIG_HOME="/home/charles/.config/" export XDG_DATA_HOME="/home/charles/.data/" export EDITOR="vim" +export TERM="xterm-256color" # set tab to 4 spaces tabs 4 diff --git a/install.sh b/install.sh index d866f32..4076d59 100755 --- a/install.sh +++ b/install.sh @@ -8,18 +8,18 @@ [ -z $DOTDIR ] && DOTDIR=`pwd` # Creating links -ls -sf $DOTDIR/.zshrc $HOME/.zshrc -ls -sf $DOTDIR/.vimrc $HOME/.vimrc +ln -sf $DOTDIR/.zshrc $HOME/.zshrc +ln -sf $DOTDIR/.vimrc $HOME/.vimrc [ ! -d $HOME/.xmonad ] && mkdir $HOME/.xmonad -ls -sf $DOTDIR/xmonad.hs $HOME/.xmonad/xmonad.hs +ln -sf $DOTDIR/xmonad.hs $HOME/.xmonad/xmonad.hs -ls -sf $DOTDIR/.gdbinit $HOME/.gdbinit -ls -sf $DOTDIR/.ghci $HOME/.ghci -ls -sf $DOTDIR/.gitconfig $HOME/.gitconfig +ln -sf $DOTDIR/.gdbinit $HOME/.gdbinit +ln -sf $DOTDIR/.ghci $HOME/.ghci +ln -sf $DOTDIR/.gitconfig $HOME/.gitconfig [ ! -d $HOME/.config ] && mkdir $HOME/.config -ls -sf $DOTDIR/redshift.conf $HOME/.config/redshift.conf +ln -sf $DOTDIR/redshift.conf $HOME/.config/redshift.conf ################ # dependencies # @@ -33,10 +33,14 @@ vim -c "PlugInstall" -c "qa" # zsh pluggins [ ! -d $HOME/.zsh ] && make $HOME/.zsh # pure theme -git clone https://github.com/sindresorhus/pure $HOME/.zsh/pure +[ ! -d $HOME/.zsh/pure ] && \ + git clone https://github.com/sindresorhus/pure \ + $HOME/.zsh/pure # syntax hightlighting -git clone https://github.com/zsh-users/zsh-syntax-highlighting \ +[ ! -d $HOME/.zsh/zsh-syntax-highlighting ] && \ + git clone https://github.com/zsh-users/zsh-syntax-highlighting \ $HOME/.zsh/zsh-syntax-highlighting # you should use -git clone https://github.com/MichaelAquilina/zsh-you-should-use \ +[ ! -d $HOME/.zsh/zsh-you-should-use ] && \ + git clone https://github.com/MichaelAquilina/zsh-you-should-use \ $HOME/.zsh/zsh-you-should-use -- cgit