aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pluggins.vim1
-rw-r--r--.vimrc82
-rw-r--r--.zshrc3
-rwxr-xr-xinstall.sh24
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 <C-J> <C-W><C-J>
-nnoremap <C-K> <C-W><C-K>
-nnoremap <C-L> <C-W><C-L>
-nnoremap <C-H> <C-W><C-H>
-
-" spit resizing
-nnoremap zh <C-W>>
-nnoremap zl <C-W><
-nnoremap zj <C-W>-
-nnoremap zk <C-W>+
-
" 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 <C-J> <C-W><C-J>
+nnoremap <C-K> <C-W><C-K>
+nnoremap <C-L> <C-W><C-L>
+nnoremap <C-H> <C-W><C-H>
+
" 'Y' yank to the end of the line
noremap Y y$
-
" solves annoying delay went exiting insert mode
-imap <ESC> <C-C>
-" jj or kk to exit insert mode
-imap jj <ESC>
-imap kk <ESC>
+inoremap <ESC> <C-C>
+" kj to exit insert mode
+inoremap kj <ESC>
" remove visual mode keybinding
-map Q <ESC>
+noremap Q <nop>
+" remove command line window keybinding
+noremap q: <nop>
" incsearch
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
+" move line up and down
+nnoremap _ ddkP
+nnoremap + ddp
+" long move up/down
+nnoremap ( 10k
+nnoremap ) 10j
+" tag nagigation
+nnoremap <leader>] <C-]>
+nnoremap <leader>t <C-t>
+" buffer navigation
+nnoremap <leader>n :bn<CR>
+nnoremap <leader>p :bp<CR>
+nnoremap <leader><TAB> :b#<CR>
+nnoremap <leader>l :ls<CR>
+" file manipulation with leader
+nnoremap <leader>w :w<CR>
+nnoremap <leader>x :x<CR>
+
+" open vimrc in split
+nnoremap <leader>rc :vsplit $MYVIMRC<cr>
+" source vimrc
+nnoremap <leader>src :source $MYVIMRC<cr>
+
+" file toggle
+nnoremap <leader>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