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 --- .vimrc | 82 ++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 27 deletions(-) (limited to '.vimrc') 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 -- cgit