commit 7d640d2e9f2ca4f7eb560989372daa353ea42bd0
parent 237b3961234382b8d84b970d0165d795d5622a09
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 17 Jul 2018 18:49:23 +0200
Organised and updated vimrc
Diffstat:
M | vimrc | | | 126 | +++++++++++++++++++++++++++++++++++++++++-------------------------------------- |
1 file changed, 65 insertions(+), 61 deletions(-)
diff --git a/vimrc b/vimrc
@@ -1,3 +1,4 @@
+"====== GENERAL ======"
" Update file when changed from the outside
set autoread
@@ -6,18 +7,56 @@ set binary
" No swp please, I save all the time
set noswapfile
-" Highlight current line
-set cursorline
" Hide buffers instead of closing
set hidden
-" Line settings
+" Dont redraw while executing macros
+set lazyredraw
+
+" Encoding
+set encoding=utf-8 nobomb
+set fileencoding=utf-8
+set fileencodings=utf-8
+set fileformats=unix,dos,mac
+
+" Hide the annoying banner in netrw explorer
+let g:netrw_banner = 0
+
+" Send more characters at a given time
+set ttyfast
+
+" Show partial command on last line
+set showcmd
+
+" ======= Colors and Fonts ======== "
+" Syntax highlighting
+syntax on
+
+" Enable dark background
+set background=dark
+
+" Enable 256 colormode
+set t_Co=256
+
+" Mouse tweak
+set mousemodel=popup
+
+"====== EDITOR ======"
+" Highlight current line
+set cursorline
+
+" Text wrap sucks
set nowrap
+
+" Linebreak when obsessive
+set lbr
+set tw=500
+
+" Numbered lines
set number
set numberwidth=3
-" Indentation settings
" I want spaces
set expandtab
@@ -30,24 +69,21 @@ set softtabstop=4
set shiftround
set copyindent
-" Linebreak when obsessive
-set lbr
-set tw=500
-
" Auto indent
set ai
" Smart indent
set si
-" Wrapping
-set nowrap
+" Folding
+set foldmethod=indent
" Status bar
set laststatus=2
-" Folding
-set foldmethod=indent
+" Show matching brackets
+set showmatch
+set mat=2
" Searching
set ignorecase
@@ -55,29 +91,23 @@ set hlsearch
set incsearch
set smartcase
-" Show matching brackets
-set showmatch
-set mat=2
-
-" Dont redraw while executing macros
-set lazyredraw
-
" Set 80-char column (off by default)
" set colorcolumn=80
highlight ColorColumn ctermbg=233
-" Encoding
-set encoding=utf-8
-set fileencoding=utf-8
-set fileencodings=utf-8
-
-" netrw configs
-let g:netrw_banner = 0
-
" Backspace tweaks
set backspace=indent,eol,start
set whichwrap+=<,>,h,l
+" How to split new windows
+set splitbelow splitright
+
+"====== COMMANDS ======"
+let mapleader="," " Set the mapleader to be ,
+
+" So I don't have to mash shift all the time
+nnoremap ; :
+
" Fat finger fixes
cnoreabbrev W! w!
cnoreabbrev Q! q!
@@ -89,6 +119,11 @@ cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
+map q: <Nop>
+
+" Custom mappings
+nnoremap <leader>dif :Diff<cr>
+nnoremap <leader>/ :noh<cr>
" Custom commands
command Todo vimgrep /TODO\C/ **/*.* | copen
@@ -96,6 +131,8 @@ command Note vimgrep /NOTE\C/ **/*.* | copen
command Fix vimgrep /FIXME\C/ **/*.* | copen
command CDC cd %:p:h
command Maketab set noet ts=2 | %retab!
+command Diff w !diff % -
+command Diffc w !git diff % -
" Retain visual mode after > and <
vmap < <gv
@@ -105,38 +142,5 @@ vmap > >gv
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
-
-" For encoding/formats
-set encoding=utf-8 nobomb
-set fileformats=unix,dos,mac
-
-" Send more characters at a given time
-set ttyfast
-
-" Show partial command on last line
-set showcmd
-
-" How to split new windows
-set splitbelow splitright
-
-" ======= Colors and Fonts ======== "
-
-" Syntax highlighting
-syntax on
-
-" Enable dark background
-set background=dark
-
-" Enable 256 colormode
-set t_Co=256
-
-" Mouse tweak
-set mousemodel=popup
-
-" ====== COMMANDS/MAPPINGS ======= "
-
-let mapleader="," " Set the mapleader to be ,
-
-nnoremap ; :
-map q: <Nop>
+" stfu and write the file
cmap w!! w !sudo tee > /dev/null %