summaryrefslogtreecommitdiff
path: root/.vimrc
diff options
context:
space:
mode:
authortinfoil-hat <mail@tinfoil-hat.net>2022-11-05 15:01:02 +0100
committertinfoil-hat <mail@tinfoil-hat.net>2022-11-05 15:01:02 +0100
commitd650d5a4ad38642d83fb2d83ddff8fd12917627d (patch)
tree53e59d01e9550639a798de6b1b856d794505506c /.vimrc
downloaddotfiles-d650d5a4ad38642d83fb2d83ddff8fd12917627d.tar.gz
dotfiles-d650d5a4ad38642d83fb2d83ddff8fd12917627d.tar.bz2
dotfiles-d650d5a4ad38642d83fb2d83ddff8fd12917627d.zip
Update 2022-11-05 15:01 Linux/x86_64
Diffstat (limited to '.vimrc')
-rw-r--r--.vimrc99
1 files changed, 99 insertions, 0 deletions
diff --git a/.vimrc b/.vimrc
new file mode 100644
index 0000000..1f39919
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,99 @@
+" Disable compatibility with vi which can cause unexpected issues.
+set nocompatible
+
+" Colour
+colo desert
+
+" With a map leader it's possible to do extra key combinations
+" like <leader>w saves the current file
+let mapleader = ","
+
+" Enable type file detection. Vim will be able to try to detect the type of file in use.
+filetype on
+
+" Enable plugins and load plugin for the detected file type.
+filetype plugin on
+
+" Load an indent file for the detected file type.
+filetype indent on
+
+" Turn syntax highlighting on.
+syntax on
+
+" Add numbers to each line on the left-hand side.
+set number
+
+" Highlight cursor line underneath the cursor horizontally.
+set cursorline
+
+" Highlight cursor line underneath the cursor vertically.
+" set cursorcolumn
+
+" Set shift width to 4 spaces.
+set shiftwidth=4
+
+" Set tab width to 4 columns.
+set tabstop=4
+
+" Use space characters instead of tabs.
+set expandtab
+
+" Do not save backup files.
+set nobackup
+
+" Do not wrap lines. Allow long lines to extend as far as the line goes.
+set nowrap
+
+" While searching though a file incrementally highlight matching characters as you type.
+set incsearch
+
+" Ignore capital letters during search.
+set ignorecase
+
+" Override the ignorecase option if searching for capital letters.
+" This will allow you to search specifically for capital letters.
+set smartcase
+
+" Show matching words during a search.
+set showmatch
+
+" Use highlighting when doing a search.
+set hlsearch
+
+" Set the commands to save in history default number is 20.
+set history=1000
+
+" Enable auto completion menu after pressing TAB.
+set wildmenu
+
+" Make wildmenu behave like similar to Bash completion.
+set wildmode=list:longest
+
+" There are certain files that we would never want to edit with Vim.
+" Wildmenu will ignore files with these extensions.
+set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
+
+" Enable 256 colors palette in Gnome Terminal
+if $COLORTERM == 'gnome-terminal'
+ set t_Co=256
+endif
+
+" Returns true if the color hex value is light
+function! IsHexColorLight(color) abort
+ let l:raw_color = trim(a:color, '#')
+
+ let l:red = str2nr(substitute(l:raw_color, '(.{2}).{4}', '1', 'g'), 16)
+ let l:green = str2nr(substitute(l:raw_color, '.{2}(.{2}).{2}', '1', 'g'), 16)
+ let l:blue = str2nr(substitute(l:raw_color, '.{4}(.{2})', '1', 'g'), 16)
+
+ let l:brightness = ((l:red * 299) + (l:green * 587) + (l:blue * 114)) / 1000
+
+ return l:brightness > 155
+endfunction
+
+func! WordProcessorMode()
+ setlocal textwidth=80
+ setlocal smartindent
+ setlocal spell spelllang=en_us
+ setlocal noexpandtab
+endfu