move commands to separate file

This commit is contained in:
Ray Elliott 2021-09-08 22:22:51 +01:00
parent ca70b402c4
commit d389e1fed1
2 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,5 @@
" SpacesToTabs {{{
" TODO - ake a proper regex substitution
function! s:spacestotabs() function! s:spacestotabs()
%s/^ / /e %s/^ / /e
%s/^ / /e %s/^ / /e
@ -7,3 +9,19 @@ function! s:spacestotabs()
%s/^ / /e %s/^ / /e
endfunction endfunction
command SpacesToTabs call s:spacestotabs() command SpacesToTabs call s:spacestotabs()
"}}}
" TrimWhitespace {{{
command! -range=% TrimWhitespace let b:wv = winsaveview() |
\ keeppattern <line1>,<line2>s/\s\+$// |
\ call winrestview(b:wv)
"}}}
" Scratch, ScratchVertical {{{
command! Scratch new | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile
command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile
"}}}
"
"

View File

@ -181,17 +181,6 @@ function! ToggleHighlights() abort "{{{
endfunction endfunction
"}}} "}}}
"----------------------------------------------------------------------------}}} "----------------------------------------------------------------------------}}}
"#commands{{{
" TrimWhitespace{{{
command! -range=% TrimWhitespace let b:wv = winsaveview() |
\ keeppattern <line1>,<line2>s/\s\+$// |
\ call winrestview(b:wv)
"}}}
" Scratch, ScratchVertical{{{
command! Scratch new | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile
command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile
"}}}
"}}}
" #settings {{{ " #settings {{{
scriptencoding utf-8 scriptencoding utf-8