Serĉanto de Scio 2019-09-10 21:19:31 +10:00
parent a3b98b94e6
commit daa644097d
Signed by: sercanto
GPG key ID: A4122FF3971B6865

258
.vimrc
View file

@ -1,169 +1,183 @@
"" Preferred global default settings: " Vim configuration moved to Nix files
set number "
set background=dark " https://source.mcwhirter.io/craige/mio-ops/src/branch/master/Deployments/vim.nix
set smartindent "
set tabstop=4 " Preferred global default settings:
set shiftwidth=4 "set number
set expandtab "set background=dark
syntax enable "set smartindent
colorscheme solarized "set tabstop=4
set t_Co=256 " use 265 colors in vim "set shiftwidth=4
"set expandtab
"syntax enable
"colorscheme solarized
"set t_Co=256 " use 265 colors in vim
" hi Normal guibg=NONE ctermbg=NONE " hi Normal guibg=NONE ctermbg=NONE
hi SpellBad cterm=underline "hi SpellBad cterm=underline
match ErrorMsg '\s\+$' "match ErrorMsg '\s\+$'
set rtp+=/run/current-system/sw/share/vim-plugins/vim-airline "set rtp+=/run/current-system/sw/share/vim-plugins/vim-airline
set rtp+=/run/current-system/sw/share/vim-plugins/vim-airline-themes "set rtp+=/run/current-system/sw/share/vim-plugins/vim-airline-themes
set rtp+=/run/current-system/sw/share/vim-plugins/neocomplete-vim "set rtp+=/run/current-system/sw/share/vim-plugins/neocomplete-vim
let g:airline_powerline_fonts = 1 "let g:airline_powerline_fonts = 1
let g:airline_theme='solarized' "let g:airline_theme='solarized'
set laststatus=2 "set laststatus=2
call togglebg#map("<F10>") "call togglebg#map("<F10>")
" Set up the status line so it's colored and always on " Set up the status line so it's colored and always on
set laststatus=2 "set laststatus=2
" highlight StatusLine cterm=none ctermbg=black ctermfg=244 " highlight StatusLine cterm=none ctermbg=black ctermfg=244
"highlight StatusLineNC cterm=none ctermbg=black ctermfg=244 "highlight StatusLineNC cterm=none ctermbg=black ctermfg=244
"highlight VertSplit cterm=none ctermbg=black ctermfg=244 "highlight VertSplit cterm=none ctermbg=black ctermfg=244
"highlight LineNr cterm=none ctermbg=black ctermfg=244 "highlight LineNr cterm=none ctermbg=black ctermfg=244
" Removes trailing spaces: " Removes trailing spaces:
function! TrimWhiteSpace() "function! TrimWhiteSpace()
%s/\s\+$//e " %s/\s\+$//e
endfunction "endfunction
nnoremap <silent> <Leader>RemoveTrailingWhiteSpace :call TrimWhiteSpace()<CR> "nnoremap <silent> <Leader>RemoveTrailingWhiteSpace :call TrimWhiteSpace()<CR>
autocmd FileWritePre * :call TrimWhiteSpace() "autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileAppendPre * :call TrimWhiteSpace() "autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FilterWritePre * :call TrimWhiteSpace() "autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd BufWritePre * :call TrimWhiteSpace() "autocmd BufWritePre * :call TrimWhiteSpace()
" Transparent editing of gpg encrypted files. " Transparent editing of gpg encrypted files.
" By Wouter Hanegraaff <wouter@blub.net> " By Wouter Hanegraaff <wouter@blub.net>
augroup encrypted "augroup encrypted
au! " au!
" First make sure nothing is written to ~/.viminfo while editing " First make sure nothing is written to ~/.viminfo while editing
" an encrypted file. " an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo= " autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk " We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile " autocmd BufReadPre,FileReadPre *.gpg set noswapfile
" Switch to binary mode to read the encrypted file " Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg set bin " autocmd BufReadPre,FileReadPre *.gpg set bin
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2 " autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null " autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
" Switch to normal mode for editing " Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg set nobin " autocmd BufReadPost,FileReadPost *.gpg set nobin
autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save " autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r") " autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing " Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null " autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
" Undo the encryption so we are back in the normal text, directly " Undo the encryption so we are back in the normal text, directly
" after the file has been written. " after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg u " autocmd BufWritePost,FileWritePost *.gpg u
augroup END "augroup END
" Add files ending in md to the list of files recognised as markdown: " Add files ending in md to the list of files recognised as markdown:
autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown "autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
" My Markdown environment " My Markdown environment
function! MarkdownSettings() "function! MarkdownSettings()
set textwidth=79 " set textwidth=79
set spell spelllang=en_au " set spell spelllang=en_au
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.mdwn :call MarkdownSettings() "autocmd BufNewFile,BufFilePre,BufRead *.mdwn :call MarkdownSettings()
autocmd BufNewFile,BufFilePre,BufRead *.md :call MarkdownSettings() "autocmd BufNewFile,BufFilePre,BufRead *.md :call MarkdownSettings()
" My ReStructured Text environment " My ReStructured Text environment
function! ReStructuredSettings() "function! ReStructuredSettings()
set textwidth=79 " set textwidth=79
set spell spelllang=en_au " set spell spelllang=en_au
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.rst :call ReStructuredSettings() "autocmd BufNewFile,BufFilePre,BufRead *.rst :call ReStructuredSettings()
autocmd BufNewFile,BufFilePre,BufRead *.txt :call ReStructuredSettings() "autocmd BufNewFile,BufFilePre,BufRead *.txt :call ReStructuredSettings()
" My LaTeX environment: " My LaTeX environment:
function! LaTeXSettings() "function! LaTeXSettings()
set textwidth=79 " set textwidth=79
set spell spelllang=en_au " set spell spelllang=en_au
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.tex :call LaTeXSettings() "autocmd BufNewFile,BufFilePre,BufRead *.tex :call LaTeXSettings()
" Settings for my Haskell environment: " Settings for my Haskell environment:
function! HaskellSettings() "function! HaskellSettings()
set tabstop=4
set shiftwidth=4
set expandtab
set textwidth=79
endfunction
autocmd BufNewFile,BufFilePre,BufRead *.hs :call HaskellSettings()
" Settings for my Golang environment:
function! GoSettings()
set tabstop=7
set shiftwidth=7
set noexpandtab
endfunction
autocmd BufNewFile,BufFilePre,BufRead *.go :call GoSettings()
" Settings for my Python environment:
function! PythonSettings()
set tabstop=4
set shiftwidth=4
set expandtab
set textwidth=79
set spell!
endfunction
autocmd BufNewFile,BufFilePre,BufRead *.py :call PythonSettings()
" My Mutt environment
function! MuttSettings()
set textwidth=79
set spell spelllang=en_au
" set tabstop=4 " set tabstop=4
" set shiftwidth=4 " set shiftwidth=4
" set expandtab " set expandtab
endfunction " set textwidth=79
autocmd BufNewFile,BufFilePre,BufRead /tmp/mutt-* :call MuttSettings() "endfunction
autocmd BufNewFile,BufFilePre,BufRead /tmp/neomutt-* :call MuttSettings() "autocmd BufNewFile,BufFilePre,BufRead *.hs :call HaskellSettings()
" Settings for my Nix environment:
"function! NixSettings()
" set tabstop=2
" set shiftwidth=2
" set expandtab
" set textwidth=79
" set filetype=nix
"endfunction
"autocmd BufNewFile,BufFilePre,BufRead *.nix :call NixSettings()
" Settings for my Golang environment:
"function! GoSettings()
" set tabstop=7
" set shiftwidth=7
" set noexpandtab
"endfunction
"autocmd BufNewFile,BufFilePre,BufRead *.go :call GoSettings()
" Settings for my Python environment:
"function! PythonSettings()
" set tabstop=4
" set shiftwidth=4
" set expandtab
" set textwidth=79
" set spell!
"endfunction
"autocmd BufNewFile,BufFilePre,BufRead *.py :call PythonSettings()
" My Mutt environment
"function! MuttSettings()
" set textwidth=79
" set spell spelllang=en_au
"set tabstop=4
"set shiftwidth=4
"set expandtab
"endfunction
"autocmd BufNewFile,BufFilePre,BufRead /tmp/mutt-* :call MuttSettings()
"autocmd BufNewFile,BufFilePre,BufRead /tmp/neomutt-* :call MuttSettings()
" Settings for my C environment: " Settings for my C environment:
function! CSettings() "function! CSettings()
set tabstop=2 " set tabstop=2
set shiftwidth=2 " set shiftwidth=2
set expandtab " set expandtab
set textwidth=79 " set textwidth=79
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.c :call CSettings() "autocmd BufNewFile,BufFilePre,BufRead *.c :call CSettings()
" Settings for my YAML environment: " Settings for my YAML environment:
function! YAMLSettings() "function! YAMLSettings()
set tabstop=2 " set tabstop=2
set shiftwidth=2 " set shiftwidth=2
set expandtab " set expandtab
set textwidth=79 " set textwidth=79
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.yaml :call YAMLSettings() "autocmd BufNewFile,BufFilePre,BufRead *.yaml :call YAMLSettings()
" Settings for my Bash environment: " Settings for my Bash environment:
function! BashSettings() "function! BashSettings()
set tabstop=4 " set tabstop=4
set shiftwidth=4 " set shiftwidth=4
set expandtab " set expandtab
set textwidth=79 " set textwidth=79
set spell! " set spell!
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead *.sh :call BashSettings() "autocmd BufNewFile,BufFilePre,BufRead *.sh :call BashSettings()
" My Bzr commit environment " My Bzr commit environment
function! BzrSettings() "function! BzrSettings()
set textwidth=79 " set textwidth=79
set spell spelllang=en_au " set spell spelllang=en_au
set tabstop=4 " set tabstop=4
set shiftwidth=4 " set shiftwidth=4
set expandtab " set expandtab
endfunction "endfunction
autocmd BufNewFile,BufFilePre,BufRead bzr_* :call BzrSettings() "autocmd BufNewFile,BufFilePre,BufRead bzr_* :call BzrSettings()