Update vimrc

This commit is contained in:
Michael Campagnaro 2022-12-05 21:12:30 -05:00 committed by Michael Campagnaro
parent c1e333e7db
commit 7c828c01f1
2 changed files with 98 additions and 39 deletions

View File

@ -860,7 +860,7 @@ alias vimeo-compressed='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_ON'
alias ig-download-and-hflip='dl_instagram_vid_and_hflip ' alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
# Twitter Vid DL # Twitter Vid DL
alias twitter='dl_twitter_vid "" ' alias twt='dl_twitter_vid "" '
# Misc # Misc
alias download-mp4='dl_mp4' alias download-mp4='dl_mp4'

127
vimrc
View File

@ -92,20 +92,41 @@ let g:campo_theme_use_rainbow_parens = 1
" ignored or always stripped; see below. " ignored or always stripped; see below.
let g:campo_strip_trailing_whitespace = 1 let g:campo_strip_trailing_whitespace = 1
" When set to 1, the whitespace stripping force/ignore file filters below will
" be expected to have full paths to the files, otherwise just the filename is
" required.
let g:campo_use_full_paths_for_whitespace_stripping_file_filters = 1
" If g:campo_strip_trailing_whitespace is 1 then you can stop stripping in " If g:campo_strip_trailing_whitespace is 1 then you can stop stripping in
" specific files by setting this to a list of filenames. This has no effect " specific directories by setting this to a list of full directory paths.
" when g:campo_strip_trailing_whitespace is 0. " This has no effect when g:campo_strip_trailing_whitespace is 0.
" "
" e.g. let g:campo_files_to_ignore_when_stripping_trailing_whitespace = ['app.h', 'config.h'] " e.g. let g:campo_directories_to_ignore_when_stripping_trailing_whitespace = ['/z/modules', '/d/build']
let g:campo_directories_to_ignore_when_stripping_trailing_whitespace = []
" If g:campo_strip_trailing_whitespace is 1 then you can stop stripping in
" specific files by setting this to a list of full file paths.
" This has no effect when g:campo_strip_trailing_whitespace is 0.
"
" e.g. let g:campo_files_to_ignore_when_stripping_trailing_whitespace = ['/z/modules/test.h', '/d/build/config.h']
let g:campo_files_to_ignore_when_stripping_trailing_whitespace = [] let g:campo_files_to_ignore_when_stripping_trailing_whitespace = []
" If g:campo_strip_trailing_whitespace is 0 then you can force whitespace
" stripping in specific files by setting this to a list of filenames. This has
" no effect when g:campo_strip_trailing_whitespace is 1.
" e.g. let g:campo_files_to_force_stripping_trailing_whitespace = ['app.h', 'config.h'] " If g:campo_strip_trailing_whitespace is 0 then you can force whitespace
" stripping in specific directories by setting this to a list of full paths.
" This has no effect when g:campo_strip_trailing_whitespace is 1.
"
" e.g. let g:campo_directories_to_force_stripping_trailing_whitespace = ['/z/modules '/d/build']
let g:campo_directories_to_force_stripping_trailing_whitespace = []
" If g:campo_strip_trailing_whitespace is 0 then you can force whitespace
" stripping in specific files by setting this to a list of full file paths.
" This has no effect when g:campo_strip_trailing_whitespace is 1.
"
" e.g. let g:campo_files_to_force_stripping_trailing_whitespace = ['/z/modules/test.h', '/d/build/config.h']
let g:campo_files_to_force_stripping_trailing_whitespace = [] let g:campo_files_to_force_stripping_trailing_whitespace = []
"""""""""""""" """"""""""""""
" SEARCH " SEARCH
"""""""""""""" """"""""""""""
@ -402,28 +423,43 @@ augroup campoCmds
" Remove trailing whitespace when saving any file. " Remove trailing whitespace when saving any file.
function! s:StripTrailingWhitespaces() function! s:StripTrailingWhitespaces()
let l:filename = expand('%:t')
if g:campo_strip_trailing_whitespace == 1 if g:campo_strip_trailing_whitespace == 1
if len(g:campo_directories_to_ignore_when_stripping_trailing_whitespace)
for path in g:campo_directories_to_ignore_when_stripping_trailing_whitespace
if path == expand('%:p:h')
return
endif
endfor
endif
if len(g:campo_files_to_ignore_when_stripping_trailing_whitespace) if len(g:campo_files_to_ignore_when_stripping_trailing_whitespace)
for ignore in g:campo_files_to_ignore_when_stripping_trailing_whitespace for filename in g:campo_files_to_ignore_when_stripping_trailing_whitespace
if ignore == l:filename if (g:campo_use_full_paths_for_whitespace_stripping_file_filters == 1 && filename == expand('%:p')) || (g:campo_use_full_paths_for_whitespace_stripping_file_filters == 0 && filename == expand('%:t'))
return return
endif endif
endfor endfor
endif endif
else else
if len(g:campo_files_to_force_stripping_trailing_whitespace)
let l:found_match = 0 let l:found_match = 0
for name in g:campo_files_to_force_stripping_trailing_whitespace
if name == l:filename if len(g:campo_directories_to_force_stripping_trailing_whitespace)
for path in g:campo_directories_to_force_stripping_trailing_whitespace
if path == expand('%:p:h')
let l:found_match = 1 let l:found_match = 1
break break
endif endif
endfor endfor
if l:found_match == 0
return
endif endif
else
if l:found_match == 0 && len(g:campo_files_to_force_stripping_trailing_whitespace)
for filename in g:campo_files_to_force_stripping_trailing_whitespace
if (g:campo_use_full_paths_for_whitespace_stripping_file_filters == 1 && filename == expand('%:p')) || (g:campo_use_full_paths_for_whitespace_stripping_file_filters == 0 && filename == expand('%:t'))
let l:found_match = 1
break
endif
endfor
endif
if l:found_match == 0
return return
endif endif
endif endif
@ -597,7 +633,7 @@ function! s:CreateCtags()
let l:extension = tolower(expand('%:e')) let l:extension = tolower(expand('%:e'))
if (g:campo_force_ctags_regardless_of_extension == 0) && (index(g:campo_extensions_that_run_ctags, l:extension) < 0) if (g:campo_force_ctags_regardless_of_extension == 0) && (index(g:campo_extensions_that_run_ctags, l:extension) < 0)
echo "Skipping ctags generation" "echo "Skipping ctags generation"
return return
endif endif
@ -1199,26 +1235,43 @@ function! StopRunTask()
call HideAsyncResults() call HideAsyncResults()
endfunction endfunction
function! ExecuteRunScript() function! Build(optimized=0)
exec "AsyncRun! -post=call\\ StopRunTask() ./run %" let l:params = ''
endfunction if tolower(expand('%:e')) == "jai"
if a:optimized == 1
function! Build() let l:params .= '-release '
let l:extension = tolower(expand('%:e')) endif
if l:extension == "jai" exec "AsyncRun! -save=2 jai % " . l:params
exec "AsyncRun! -save=2 jai %"
else else
exec "AsyncRun! -save=2 ./build* %" if a:optimized == 1
let l:params .= '-o '
endif
exec "AsyncRun! -save=2 ./build* " . l:params
endif endif
endfunction endfunction
function! SilentBuild() function! SilentBuild(optimized=0)
AsyncStop AsyncStop
let l:params = ''
let l:extension = tolower(expand('%:e')) let l:extension = tolower(expand('%:e'))
if l:extension == "jai" if l:extension == "jai"
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() jai %" if a:optimized == 1
let l:params .= '-release '
endif
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() jai % " . l:params
else else
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() ./build* %" if a:optimized == 1
let l:params .= '-o '
endif
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() ./build* " . l:params
endif
endfunction
function! RunExe()
if tolower(expand('%:e')) == "jai"
exec "AsyncRun! " . expand('%:p:r') . ".exe"
else
exec "AsyncRun! -post=call\\ StopRunTask() ./run %"
endif endif
endfunction endfunction
@ -1236,12 +1289,15 @@ nnoremap <leader>bc :call ToggleBuildResults()<cr>
noremap <F10> :call HideBuildResultsAndClearErrors()<cr> noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
" Execute build script " Execute build script
nnoremap <leader>b :call Build()<cr> nnoremap <leader>b :call Build(0)<cr>
nnoremap <F8> :call SilentBuild()<cr> nnoremap <F8> :call SilentBuild(0)<cr>
" Execute optimized build script
nnoremap <leader>bb :call Build(1)<cr>
" Execute run script " Execute run script
nnoremap <leader>br :call ExecuteRunScript()<cr> nnoremap <leader>br :call RunExe()<cr>
nnoremap <F9> :call ExecuteRunScript()<cr> nnoremap <F9> :call RunExe()<cr>
nnoremap <leader>bs :AsyncStop<cr> nnoremap <leader>bs :AsyncStop<cr>
@ -1362,10 +1418,13 @@ function! RenameFile()
let l:old_name = expand('%') let l:old_name = expand('%')
let l:new_name = input('New file name: ', expand('%'), 'file') let l:new_name = input('New file name: ', expand('%'), 'file')
if l:new_name != '' && l:new_name != l:old_name if l:new_name != '' && l:new_name != l:old_name
let l:confirm = confirm("Rename ".l:old_name." to ".l:new_name."?", "&Yes\n&No")
if l:confirm == 1
exec 'saveas' l:new_name exec 'saveas' l:new_name
exec '!rm' l:old_name exec 'silent! !rm' l:old_name
redraw! redraw!
endif endif
endif
endfunction endfunction
noremap <leader>n :call RenameFile()<cr> noremap <leader>n :call RenameFile()<cr>