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 '
# Twitter Vid DL
alias twitter='dl_twitter_vid "" '
alias twt='dl_twitter_vid "" '
# Misc
alias download-mp4='dl_mp4'

135
vimrc
View File

@ -92,20 +92,41 @@ let g:campo_theme_use_rainbow_parens = 1
" ignored or always stripped; see below.
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
" specific files by setting this to a list of filenames. This has no effect
" when g:campo_strip_trailing_whitespace is 0.
" specific directories by setting this to a list of full directory 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 = ['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 = []
" 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 = []
""""""""""""""
" SEARCH
""""""""""""""
@ -402,28 +423,43 @@ augroup campoCmds
" Remove trailing whitespace when saving any file.
function! s:StripTrailingWhitespaces()
let l:filename = expand('%:t')
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)
for ignore in g:campo_files_to_ignore_when_stripping_trailing_whitespace
if ignore == l:filename
for filename in g:campo_files_to_ignore_when_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'))
return
endif
endfor
endif
else
if len(g:campo_files_to_force_stripping_trailing_whitespace)
let l:found_match = 0
for name in g:campo_files_to_force_stripping_trailing_whitespace
if name == l:filename
let l:found_match = 0
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
break
endif
endfor
if l:found_match == 0
return
endif
else
endif
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
endif
endif
@ -597,7 +633,7 @@ function! s:CreateCtags()
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)
echo "Skipping ctags generation"
"echo "Skipping ctags generation"
return
endif
@ -1199,26 +1235,43 @@ function! StopRunTask()
call HideAsyncResults()
endfunction
function! ExecuteRunScript()
exec "AsyncRun! -post=call\\ StopRunTask() ./run %"
endfunction
function! Build()
let l:extension = tolower(expand('%:e'))
if l:extension == "jai"
exec "AsyncRun! -save=2 jai %"
function! Build(optimized=0)
let l:params = ''
if tolower(expand('%:e')) == "jai"
if a:optimized == 1
let l:params .= '-release '
endif
exec "AsyncRun! -save=2 jai % " . l:params
else
exec "AsyncRun! -save=2 ./build* %"
if a:optimized == 1
let l:params .= '-o '
endif
exec "AsyncRun! -save=2 ./build* " . l:params
endif
endfunction
function! SilentBuild()
function! SilentBuild(optimized=0)
AsyncStop
let l:params = ''
let l:extension = tolower(expand('%:e'))
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
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
endfunction
@ -1236,12 +1289,15 @@ nnoremap <leader>bc :call ToggleBuildResults()<cr>
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
" Execute build script
nnoremap <leader>b :call Build()<cr>
nnoremap <F8> :call SilentBuild()<cr>
nnoremap <leader>b :call Build(0)<cr>
nnoremap <F8> :call SilentBuild(0)<cr>
" Execute optimized build script
nnoremap <leader>bb :call Build(1)<cr>
" Execute run script
nnoremap <leader>br :call ExecuteRunScript()<cr>
nnoremap <F9> :call ExecuteRunScript()<cr>
nnoremap <leader>br :call RunExe()<cr>
nnoremap <F9> :call RunExe()<cr>
nnoremap <leader>bs :AsyncStop<cr>
@ -1362,9 +1418,12 @@ function! RenameFile()
let l:old_name = expand('%')
let l:new_name = input('New file name: ', expand('%'), 'file')
if l:new_name != '' && l:new_name != l:old_name
exec 'saveas' l:new_name
exec '!rm' l:old_name
redraw!
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 'silent! !rm' l:old_name
redraw!
endif
endif
endfunction
noremap <leader>n :call RenameFile()<cr>