Cleaned up .vimrc formatting, added banner template
This commit is contained in:
3
.vim/templates/banner
Normal file
3
.vim/templates/banner
Normal file
@@ -0,0 +1,3 @@
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# ==>
|
||||
#
|
||||
94
.vimrc
94
.vimrc
@@ -1,4 +1,4 @@
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> .vimrc
|
||||
|
||||
set nocompatible " be iMproved, required
|
||||
@@ -6,7 +6,6 @@ set number " turn on line numbers
|
||||
set relativenumber " lines are numbered relative to current line
|
||||
set scrolloff=8 " number of lines to keep above and below the cursor
|
||||
set noerrorbells visualbell t_vb= " no sound on errors
|
||||
autocmd! bufwritepost .vimrc source ~/.vimrc " When vimrc is edited, reload it
|
||||
|
||||
set autoread " set to auto read when a file is changed from the outside
|
||||
"set cursorcolumn " highlight current column
|
||||
@@ -14,8 +13,16 @@ set cursorline " highlight current row
|
||||
set incsearch " make search act like search in modern browsers
|
||||
set showmatch " show matching brackets when text indicator is over them
|
||||
|
||||
set term=xterm-256color " LOTS of colors
|
||||
set path+=** " Search Globally
|
||||
set wildmenu
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
autocmd! bufwritepost .vimrc source ~/.vimrc " When vimrc is edited, reload it
|
||||
|
||||
syntax enable
|
||||
filetype plugin on
|
||||
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> From Vim Zero: https://www.oliversherouse.com/2017/08/21/vim_zero.html
|
||||
|
||||
" General
|
||||
@@ -40,7 +47,7 @@ set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Plugins
|
||||
|
||||
"" Installation with VimPlug
|
||||
@@ -54,18 +61,15 @@ endif
|
||||
" ...one step above 'nocompatible' mode: a universal set of defaults that (hopefully) everyone can agree on.
|
||||
Plug 'tpope/vim-sensible'
|
||||
|
||||
" Syntax hilights for multiple languages
|
||||
" Syntax highlights for multiple languages
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
|
||||
" Syntax hilights for markdown
|
||||
" Syntax highlights for markdown
|
||||
Plug 'tpope/vim-markdown'
|
||||
|
||||
" one stop shop for vim color schemes.
|
||||
Plug 'flazz/vim-colorschemes'
|
||||
|
||||
" Vim Wiki (about time)
|
||||
Plug 'vimwiki/vimwiki'
|
||||
|
||||
" Command Line Fuzzy Finder - https://github.com/junegunn/fzf
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
@@ -75,13 +79,7 @@ Plug 'tpope/vim-fugitive'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ==> VimWiki (https://www.youtube.com/watch?v=ONh95PNBW-Q)
|
||||
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown'}
|
||||
filetype plugin on
|
||||
syntax on
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Colors
|
||||
"
|
||||
"set termguicolors
|
||||
@@ -96,7 +94,7 @@ highlight VertSplit ctermbg=black guibg=black ctermfg=darkgray guifg=darkgray
|
||||
highlight statuslinenc ctermbg=darkgray guibg=darkgray
|
||||
highlight statusline ctermbg=darkred guibg=darkred
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Autocompletion
|
||||
|
||||
"let s:python_version=3
|
||||
@@ -104,13 +102,13 @@ highlight statusline ctermbg=darkred guibg=darkred
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
set shortmess+=c " Turn off completion messages
|
||||
|
||||
" ----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" => Statusline
|
||||
" Ideas from http://got-ravings.blogspot.com/2008/08/vim-pr0n-making-statuslines-that-own.html
|
||||
|
||||
set laststatus=2 " always show statusline
|
||||
set statusline= " clear on reload
|
||||
set statusline+=[%n] " buffer number
|
||||
set statusline+=[\ b%n\ ] " buffer number
|
||||
set statusline+=\ %f " filename
|
||||
set statusline+=\ [%{strlen(&fenc)?&fenc:'none'}, " file encoding
|
||||
set statusline+=\ %{&ff}] " file format
|
||||
@@ -118,17 +116,17 @@ set statusline+=\ %y " filetype
|
||||
set statusline+=\ %H\ %m\ %r\ %W " flags
|
||||
set statusline+=%= " left/right separator
|
||||
set statusline+=l:%l/%L " cursor line/total lines
|
||||
set statusline+=\ c:%c, " cursor column
|
||||
set statusline+=\ c:%c " cursor column
|
||||
set statusline+=\ %P " percent through file
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" => Keymaps: Doing more things at once
|
||||
|
||||
" turn off search hilight
|
||||
nnoremap <leader><space> :nohls <enter>
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Keymaps: Buffers
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Keymaps: Buffers
|
||||
|
||||
" <ctrl>-H to move to previous buffer
|
||||
nnoremap <C-H> :bp <enter>
|
||||
@@ -142,16 +140,17 @@ nnoremap <Leader>q :bd <enter>
|
||||
noremap <Leader>x "+
|
||||
" <F5> to refresh buffer
|
||||
nnoremap <F5> <C-R>:checktime <CR>
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Keymaps: With ripgrep and FZF
|
||||
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Keymaps: With ripgrep and FZF
|
||||
|
||||
" <leader> p to open files
|
||||
map <Leader>p :Files<CR>
|
||||
" search buffers
|
||||
nmap ; :Buffers<CR>
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Keymaps: Text bubbling (http://vimcasts.org/episodes/bubbling-text/)
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Keymaps: Text bubbling (http://vimcasts.org/episodes/bubbling-text/)
|
||||
|
||||
" Bubble single lines
|
||||
nmap <C-k> ddkP
|
||||
@@ -159,33 +158,30 @@ nmap <C-j> ddp
|
||||
" Bubble multiple lines
|
||||
vmap <C-k> xkP`[V`]
|
||||
vmap <C-j> xp`[V`]
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Keymaps: More sane movement keys
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Keymaps: More sane movement keys
|
||||
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Keymaps: Date and Time stamps
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Keymaps: Date and Time stamps
|
||||
|
||||
imap <F2> <C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR>
|
||||
imap <F3> <C-R>=strftime("%Y-%m-%d %a")<CR>
|
||||
imap <F4> <C-R>=strftime("%H:%M")<CR>
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Spellcheck
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Spellcheck
|
||||
" Horrible colors! I hate spellchecker's red highlight, so I changed it
|
||||
" (http://stackoverflow.com/questions/6008921/how-do-i-change-the-highlight-style-in-vim-spellcheck)
|
||||
" Vim Colors: (http://alvinalexander.com/linux/vi-vim-editor-color-scheme-syntax)
|
||||
|
||||
" Toggle spell check with F10
|
||||
nnoremap <F10> :setlocal spell! spelllang=en_us<CR>
|
||||
" Save custom dictionary in ~/Documents
|
||||
set spell spelllang=en_us
|
||||
" set spellfile=$HOME/Documents/en.utf-8.add
|
||||
" Save custom dictionary in nextcloud so it's available on all machines
|
||||
set spellfile=/home/chawley/nextcloud-overlook/notes/system/en.utf-8.add
|
||||
hi clear SpellBad
|
||||
hi clear SpellCap
|
||||
@@ -199,8 +195,8 @@ hi SpellCap cterm=underline ctermbg=black ctermfg=darkred
|
||||
"hi SpellErrors cterm=underline,bold ctermfg=blue
|
||||
hi SpellErrors cterm=underline ctermbg=black ctermfg=darkred
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ===> Spellcheck: only certain file types https://robots.thoughtbot.com/vim-spell-checking
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Spellcheck: only certain file types https://robots.thoughtbot.com/vim-spell-checking
|
||||
|
||||
" turn off for files with no extension
|
||||
autocmd BufRead,BufNewFile * setlocal nospell
|
||||
@@ -212,11 +208,18 @@ autocmd BufRead,BufNewFile *.mkd setlocal spell
|
||||
" turn on for text files
|
||||
autocmd BufRead,BufNewFile *.txt setlocal spell
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" => Templates
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Snippets
|
||||
" Pasting pre-made things
|
||||
|
||||
" section banner
|
||||
nnoremap ,ban :-1read $HOME/.vim/templates/banner<CR>jA
|
||||
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Templates
|
||||
" Doing special things with certain filetypes
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Templates: shell scripts (.sh)
|
||||
|
||||
autocmd BufNewFile *.sh so $HOME/.vim/templates/sh
|
||||
@@ -227,7 +230,7 @@ autocmd BufWritePre,filewritepre *.sh execute "normal ma"
|
||||
autocmd BufWritePre,filewritepre *.sh exe "g/REVISION:.*/s//REVISION: " .strftime("%c")
|
||||
autocmd bufWritePost,filewritepost *.sh execute "normal `a"
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Templates: python scripts (.py)
|
||||
|
||||
autocmd BufNewFile *.py so $HOME/.vim/templates/py
|
||||
@@ -238,7 +241,7 @@ autocmd BufWritePre,filewritepre *.py execute "normal ma"
|
||||
autocmd BufWritePre,filewritepre *.py exe "g/REVISION:.*/s//REVISION: " .strftime("%c")
|
||||
autocmd bufWritePost,filewritepost *.py execute "normal `a"
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> Templates: markdown documents (.md, .mkd)
|
||||
|
||||
autocmd BufNewFile *.md,*.mkd so $HOME/.vim/templates/md
|
||||
@@ -247,8 +250,9 @@ autocmd BufWritePre,filewritepre *.md,*.mkd execute "normal ma"
|
||||
autocmd BufWritePre,filewritepre *.md,*.mkd exe "g/Updated:.*/s//Updated: " .strftime("%c")
|
||||
autocmd bufWritePost,filewritepost *.md,*.mkd execute "normal `a"
|
||||
|
||||
" -----------------------------------------------------------------------------------------------------
|
||||
" ---------------------------------------------------------------------------------------------------------------------
|
||||
" ==> netrw - NERDtree like setup (https://shapeshed.com/vim-netrw/)
|
||||
|
||||
let g:netrw_banner = 0
|
||||
let g:netrw_liststyle = 3
|
||||
let g:netrw_browse_split = 4
|
||||
|
||||
Reference in New Issue
Block a user