dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit f0ea71ef0ac89bb37c9162ae8d388002b7b30d98 (patch)
parent a8329ff6814fda7857e75b4dfcaf081ca4457a4e
Author: Alex Karle <alex@karle.co>
Date:   Wed,  6 Nov 2019 23:13:16 -0500

vim: further vimrc cleanup (see log)

While splitting my autoload functions into "utils" and "vimrc" was, at
the time, a seemingly forward-looking move, I've trended towards
slimming down my config over time, and more files is more of a pain to
manage.

This commit merges all the autoloaded functions (really only two in
use...) into one vimrc.vim . It deletes the warn function, which is not
currently in use.

Diffstat:
Dvim/autoload/utils.vim | 23-----------------------
Mvim/autoload/vimrc.vim | 14++++++++++++++
Mvim/vimrc | 2+-
3 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/vim/autoload/utils.vim b/vim/autoload/utils.vim @@ -1,23 +0,0 @@ -" autoload/utils.vim -- utility functions to support vimrc -" -" See `:h autoload-functions` for explanation of autoloading and performance - -" A function to execute a command and return to the old position -" CREDIT: http://vimcasts.org/episodes/tidying-whitespace/ -function! utils#CMDPreserve(command) abort - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - execute a:command - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) -endfunction - -function! utils#warn(msg) abort - echohl WarningMsg - echo 'vimrc: ' . a:msg - echohl None -endfunction diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim @@ -12,3 +12,17 @@ function! vimrc#ToggleColorColumn() abort set colorcolumn="" endif endfunction + +" A function to execute a command and return to the old position +" CREDIT: http://vimcasts.org/episodes/tidying-whitespace/ +function! vimrc#CMDPreserve(command) abort + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + execute a:command + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) +endfunction diff --git a/vim/vimrc b/vim/vimrc @@ -134,7 +134,7 @@ nnoremap <C-l> <C-w>l nnoremap <C-p> :set paste \| put + \| set nopaste<CR> " Clear trailing whitespace (through regexp) -nnoremap <leader><space> :call utils#CMDPreserve("%s/\\s\\+$//e")<CR> +nnoremap <leader><space> :call vimrc#CMDPreserve("%s/\\s\\+$//e")<CR> " edit in current buffer dir nnoremap <leader>e :e %:h/