Compare commits
8 Commits
bc21059ea6
...
e175fefa18
Author | SHA1 | Date | |
---|---|---|---|
e175fefa18 | |||
2a6522b4b7 | |||
dc88f6cc36 | |||
65500a66ea | |||
a2c5c8a4d6 | |||
7d928a25ea | |||
4b6d506d7b | |||
05c46303c8 |
18
.aliases
18
.aliases
|
@ -189,6 +189,11 @@ alias ls='ls -F --color'
|
|||
alias l='ls -lh'
|
||||
alias ll='ls -lha'
|
||||
|
||||
mkcd() {
|
||||
mkdir -p "${1}"
|
||||
cd "${1}"
|
||||
}
|
||||
|
||||
alias aliases='vim ~/.aliases'
|
||||
alias al='aliases'
|
||||
|
||||
|
@ -993,8 +998,8 @@ alias yt-list-desc='download_youtube_uploads_list 1 '
|
|||
|
||||
alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
alias yt-1440='download_youtube_vid "400+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1440-shortname='download_youtube_vid "400+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1440='download_youtube_vid "620+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1440-shortname='download_youtube_vid "620+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1080='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
alias yt-1080-shortname='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
alias yt-720='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
|
||||
|
@ -1002,8 +1007,8 @@ alias yt-720-shortname='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSC
|
|||
#TRANSCRIPTION ON
|
||||
alias ytt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-shortname-t='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-1440-t='download_youtube_vid "400+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-1440-shortname-t='download_youtube_vid "400+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-1440-t='download_youtube_vid "620+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-1440-shortname-t='download_youtube_vid "620+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-1080-t='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
alias yt-1080-shortname-t='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_ON'
|
||||
alias yt-720-t='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
|
||||
|
@ -1011,7 +1016,7 @@ alias yt-720-shortname-t='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSC
|
|||
#---------------------------
|
||||
alias yt-playlist='download_youtube_playlist ""'
|
||||
alias yt-playlist-list='download_youtube_playlist_list '
|
||||
alias yt-playlist-1440='download_youtube_playlist "400+140"'
|
||||
alias yt-playlist-1440='download_youtube_playlist "620+140"'
|
||||
alias yt-playlist-1080='download_youtube_playlist "137+140"'
|
||||
alias yt-playlist-720='download_youtube_playlist "136+140"'
|
||||
alias yt-playlist-tiny='download_youtube_playlist "160+140"'
|
||||
|
@ -1136,9 +1141,10 @@ alias compress-video-hard='_compress_video_hard'
|
|||
|
||||
alias cv='compress-video'
|
||||
alias cvh='compress-video-hard'
|
||||
alias tv='trim-video'
|
||||
alias jv='join-video'
|
||||
alias nv='normalize-volume'
|
||||
alias na='normalize-volume'
|
||||
alias tv='trim-video'
|
||||
|
||||
####################################################################################################
|
||||
# Git
|
||||
|
|
308
.vimrc
308
.vimrc
|
@ -235,13 +235,13 @@ Plug 'sir-pinecone/errormarker.vim' " Build error hig
|
|||
Plug 'sir-pinecone/vim-ripgrep' " Fast grep-like search. Requires ripgrep; install Rust package: `cargo install ripgrep`.
|
||||
Plug 'sir-pinecone/vim-qargs', " For the GlobalReplaceIt function (i.e. search and replace).
|
||||
Plug 'sir-pinecone/AnsiEsc.vim' " Ansi escape sequences concealed, but highlighted as specified.
|
||||
Plug 'sir-pinecone/ctrlp.vim', " Fuzzy file, buffer, mru, tag, etc finder.
|
||||
Plug 'vim-airline/vim-airline', { 'commit': 'c7460aa' } " Enhanced status/tabline.
|
||||
Plug 'embear/vim-localvimrc', { 'commit': '0206f5f' } " Add a .lvimrc to a folder to override .vimrc config.
|
||||
Plug 'tpope/vim-fugitive', { 'commit': '46eaf89' } " Git wrapper (I particularly like :Gblame, which I've wrapped as :Blame)
|
||||
Plug 'tpope/tpope-vim-abolish', { 'commit': 'dcbfe06' } " Search for, substitute, and abbreviate multiple variants of a word. Add to `after/plugin/abolish.vim`
|
||||
Plug 'tpope/vim-obsession', { 'commit': 'fe9d3e1' } " @flagged for removal. Continuously updated session files (tracks window positions, open folds, etc).
|
||||
Plug 'itchyny/vim-cursorword', { 'commit': '74a97c4' } " Underlines all instances of the symbol under the cursor. Requires a ctags file.
|
||||
Plug 'ctrlpvim/ctrlp.vim', { 'commit': '7c972cb' } " (prev stable: d93d978) Fuzzy file, buffer, mru, tag, etc finder.
|
||||
Plug 'skywind3000/asyncrun.vim', { 'commit': '61cc308' } " (prev stable: 58d23e7) Async commands.
|
||||
Plug 'airblade/vim-gitgutter', { 'commit': 'fe0e8a2' } " Displays a git diff in the vim gutter and allows staging/unstaging of hunks.
|
||||
Plug 'majutsushi/tagbar', { 'commit': '5d6990e' } " Generates ctags on-demand and shows the current file's symbols. Doesn't support existing ctag files, so no Jai support.
|
||||
|
@ -689,8 +689,7 @@ fu! CreateCtags()
|
|||
" First determine if we're in a root drive directory. If we are then
|
||||
" we bail because we don't want to recurse across the entire drive!
|
||||
let l:path = expand('%:p:h')
|
||||
let l:path_without_slashes = substitute(l:path, "/", "", "g")
|
||||
if (strchars(l:path) - strchars(l:path_without_slashes)) <= 1
|
||||
if IsRootDrive(l:path)
|
||||
call PrintError("Not going to run ctags because the file is in a root drive directory")
|
||||
return
|
||||
endif
|
||||
|
@ -763,6 +762,10 @@ call Cabbrev('WQ', 'call WriteCurrentFileAndCreateCtagsThenQuit()')
|
|||
" Faster way to open a file in the same directory.
|
||||
" <tab> will autocomplete the expansion here because we set wildcharm to <tab>.
|
||||
nnoremap <leader>e :e %:p:h/<tab>
|
||||
" Jai folders
|
||||
nnoremap <leader>ee :e <C-r>=g:campo_jai_path<CR>/<tab>
|
||||
nnoremap <leader>em :e <C-r>=g:campo_jai_path<CR>/modules/<tab>
|
||||
nnoremap <leader>eh :e <C-r>=g:campo_jai_path<CR>/how_to/<tab>
|
||||
|
||||
nnoremap <leader>w :call WriteCurrentFileAndCreateCtags()<cr>
|
||||
nnoremap <leader>x :call WriteCurrentFileAndCreateCtagsThenQuit()<cr>
|
||||
|
@ -1037,6 +1040,52 @@ command -nargs=0 EditColorScheme call EditColorScheme()
|
|||
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
|
||||
fu! IsRootDrive(path) abort
|
||||
let l:path_without_slashes = substitute(a:path, "/", "", "g")
|
||||
return strchars(l:path_without_slashes) <= 1
|
||||
endfu
|
||||
|
||||
fu! IsPathContained(path1, path2) abort
|
||||
let l:normalized_path1 = substitute(fnamemodify(a:path1, ':p'), '\', '/', 'g')
|
||||
let l:normalized_path2 = substitute(fnamemodify(a:path2, ':p'), '\', '/', 'g')
|
||||
|
||||
" Ensure paths end with a directory separator
|
||||
if l:normalized_path1[-1:] != '/'
|
||||
let l:normalized_path1 .= '/'
|
||||
endif
|
||||
if l:normalized_path2[-1:] != '/'
|
||||
let l:normalized_path2 .= '/'
|
||||
endif
|
||||
|
||||
echo l:normalized_path1
|
||||
echo l:normalized_path2
|
||||
|
||||
return match(l:normalized_path1, '^' . escape(l:normalized_path2, '\')) != -1
|
||||
endfu
|
||||
|
||||
fu! CountChar(str, char) abort
|
||||
" Remove all characters that are not the target character.
|
||||
let l:filtered = substitute(a:str, '[^' . a:char . ']', '', 'g')
|
||||
return strlen(l:filtered)
|
||||
endfu
|
||||
|
||||
fu! WindowsToUnixPath(str) abort
|
||||
let l:result = substitute(a:str, '\\', '/', 'g')
|
||||
return l:result
|
||||
endfu
|
||||
|
||||
fu! ConvertQuickfixPathsToUnixSlashes()
|
||||
let l:qflist = getqflist()
|
||||
for i in range(len(l:qflist))
|
||||
let l:bufnr = l:qflist[i]['bufnr']
|
||||
if l:bufnr != -1 && bufexists(l:bufnr)
|
||||
let l:filename = bufname(l:bufnr)
|
||||
let l:filename = substitute(l:filename, '\\', '/', 'g')
|
||||
let l:qflist[i]['module'] = l:filename
|
||||
endif
|
||||
endfor
|
||||
call setqflist(l:qflist)
|
||||
endfu
|
||||
|
||||
"##################################################################################
|
||||
" COMPILING CODE
|
||||
|
@ -1139,7 +1188,14 @@ fu! StopRunTask()
|
|||
call HideAsyncResults()
|
||||
endfu
|
||||
|
||||
fu! Build(optimized=0, silent=0)
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
" @incomplete use the same path searching from RunProgram
|
||||
fu! Build(optimized=0, silent=0) abort
|
||||
let l:async_cmd = "AsyncRun! "
|
||||
if a:silent
|
||||
let l:async_cmd .= "-post=call\\ HideAsyncResults() "
|
||||
|
@ -1147,7 +1203,7 @@ fu! Build(optimized=0, silent=0)
|
|||
|
||||
let l:is_jai = 0
|
||||
let l:has_jai_build_file = 0
|
||||
let l:has_jai_first_file = 1
|
||||
let l:has_jai_first_file = 0
|
||||
|
||||
let l:ext = tolower(expand('%:e'))
|
||||
let l:current_dir = expand('%:p:h')
|
||||
|
@ -1163,16 +1219,16 @@ fu! Build(optimized=0, silent=0)
|
|||
if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/first.jai") || ((l:one_dir_back != "/") && (filereadable(l:one_dir_back . "/build.jai") || filereadable(l:one_dir_back . "/first.jai")))
|
||||
let l:has_jai_build_file = 1
|
||||
|
||||
if filereadable(l:current_dir . "/build.jai") == 1
|
||||
if filereadable(l:current_dir . "/build.jai")
|
||||
let l:cmd = "jai ". l:current_dir . "/build.jai"
|
||||
elseif filereadable(l:current_dir . "/first.jai") == 1
|
||||
elseif filereadable(l:current_dir . "/first.jai")
|
||||
let l:cmd = "jai ". l:current_dir . "/first.jai"
|
||||
let l:has_jai_first_file = 1
|
||||
else
|
||||
" It's one directory back. We don't want to include '../' in
|
||||
" the cmd because then our reported paths in the program get
|
||||
" botched, e.g. path shown in an assert error.
|
||||
if filereadable(l:one_dir_back . "/build.jai") == 1
|
||||
if filereadable(l:one_dir_back . "/build.jai")
|
||||
let l:cmd = "jai " . l:one_dir_back . "/build.jai"
|
||||
else
|
||||
let l:cmd = "jai " . l:one_dir_back . "/first.jai"
|
||||
|
@ -1183,7 +1239,16 @@ fu! Build(optimized=0, silent=0)
|
|||
let l:cmd = "jai % "
|
||||
endif
|
||||
else
|
||||
let l:cmd .= './build* '
|
||||
if filereadable("build") && !isdirectory("build")
|
||||
let l:cmd .= './build '
|
||||
elseif filereadable("build.sh")
|
||||
let l:cmd .= './build.sh '
|
||||
elseif filereadable("build.bat")
|
||||
let l:cmd .= './build.bat '
|
||||
else
|
||||
let l:cmd .= './build* '
|
||||
endif
|
||||
|
||||
if a:optimized == 1
|
||||
let l:cmd .= ' -o'
|
||||
endif
|
||||
|
@ -1219,11 +1284,6 @@ fu! Build(optimized=0, silent=0)
|
|||
else
|
||||
echo "Compiling debug " . expand('%:t')
|
||||
endif
|
||||
|
||||
" If there's a local modules/ directory then we'll import it.
|
||||
if isdirectory(l:current_dir . "/modules")
|
||||
let l:cmd .= " -import_dir modules"
|
||||
endif
|
||||
endif
|
||||
|
||||
if g:campo_jai_metaprogram_args != ""
|
||||
|
@ -1242,66 +1302,179 @@ fu! Build(optimized=0, silent=0)
|
|||
exec l:async_cmd . l:cmd
|
||||
endfu
|
||||
|
||||
fu! RunProgram()
|
||||
let l:ran = 0
|
||||
fu! RunProgram() abort
|
||||
if tolower(expand('%:e')) == "py"
|
||||
exec "AsyncRun! python %"
|
||||
return
|
||||
endif
|
||||
|
||||
" Sometimes vim mixes unix and windows slashes so we need to normalize and
|
||||
" use this in future fnamemodify calls (can't use expand with a string
|
||||
" that doesn't contain wildcards).
|
||||
let l:full_path = WindowsToUnixPath(expand('%'))
|
||||
|
||||
let l:file_exe_name = fnamemodify(l:full_path, ':t:r').'.exe' " Just the filename without the path
|
||||
|
||||
" Easy case is the current file has an exe with the same name in the
|
||||
" same directory. We run that if found.
|
||||
if filereadable(fnamemodify(l:full_path, ':p:h') . '/' . l:file_exe_name)
|
||||
exec 'AsyncRun! ' . fnamemodify(l:full_path, ':p:h') . '/' . l:file_exe_name
|
||||
return
|
||||
endif
|
||||
|
||||
" We start by looking for something to run relative to the current file's
|
||||
" path. If nothing is found then we start over looking in the current
|
||||
" working directory (the directory vim was opened in).
|
||||
let l:current_path = fnamemodify(l:full_path, ':p:h')
|
||||
|
||||
if !RunProgramInDirectory(l:current_path, l:file_exe_name)
|
||||
let l:cwd = getcwd()
|
||||
if !RunProgramInDirectory(l:cwd, l:file_exe_name)
|
||||
call PrintError("No exe or run script found in current file path '" . l:current_path . "' or working directory '". l:cwd ."'")
|
||||
endif
|
||||
endif
|
||||
endfu
|
||||
|
||||
|
||||
fu! RunProgramInDirectory(starting_path, file_exe_name) abort
|
||||
let l:search_path = a:starting_path
|
||||
let l:ext = tolower(expand('%:e'))
|
||||
let l:path_to_use = ""
|
||||
let l:also_search_for_cpp_run_script = 0 " Covers the case of having a run-cpp file in a jai project.
|
||||
|
||||
if l:ext == "jai"
|
||||
" Maybe the current file has an exe, i.e. wasn't compiled with a build script.
|
||||
if filereadable(expand('%:p:r') . '.exe')
|
||||
let l:ran = 1
|
||||
exec "AsyncRun! " . expand('%:p:r') . ".exe"
|
||||
elseif tolower(expand('%:h:t')) == "modules" || tolower(expand('%:h:h:t')) == "modules"
|
||||
" This is likely a jai module inside a project. We will want to do the exe/run script checks in the parent project folder.
|
||||
" The :h:h tests for a module inside a folder, e.g. modules/Basic/module.jai
|
||||
echo "module"
|
||||
if tolower(expand('%:h:t')) == "modules"
|
||||
let l:path_to_use = "/.."
|
||||
else
|
||||
let l:path_to_use = "/../.."
|
||||
" Check if we're editing inside a modules file and if so then get a
|
||||
" path that takes us outside of it. We'll use that path for finding an
|
||||
" exe or run script.
|
||||
let l:pos = match(l:search_path, "modules")
|
||||
if l:pos != -1
|
||||
" e.g. if the current path is
|
||||
" /z/jai/examples/wasm/modules/Blah/blah.jai then this is /z/jai/examples/wasm/
|
||||
let l:module_root_path = l:search_path[:l:pos-1]
|
||||
|
||||
" We don't want to proceed if the path is in the jai compiler's modules folder.
|
||||
let l:jai_path = tolower(g:campo_jai_path)
|
||||
if l:jai_path[-1:] != '/'
|
||||
let l:jai_path .= '/'
|
||||
endif
|
||||
|
||||
"echo 'modules root path: ' . l:module_root_path . ' | jai path: ' . l:jai_path
|
||||
if tolower(l:module_root_path) == l:jai_path
|
||||
"echo 'inside jai modules. Aborting run'
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:search_path = l:module_root_path
|
||||
endif
|
||||
elseif l:ext == "py"
|
||||
let l:ran = 1
|
||||
exec "AsyncRun! python %"
|
||||
elseif l:ext == "cpp" || l:ext == "c" || l:ext == "h" || l:ext == "inc"
|
||||
let l:also_search_for_cpp_run_script = 1
|
||||
endif
|
||||
|
||||
if l:ran == 0
|
||||
" First check the current file's directory (and one directory back)
|
||||
" for a run script, falling back to the current working directory (and
|
||||
" one directory back) of the editor.
|
||||
if filereadable(expand('%:h') . '/run')
|
||||
echo "file here"
|
||||
exec "AsyncRun! " . expand('%:h') . "/run"
|
||||
elseif filereadable(expand('%:h') . '/../run')
|
||||
" Handles editing a file in a code/ or src/ and there's a run script one directory back.
|
||||
echo "file one back"
|
||||
exec "AsyncRun! " . expand('%:h') . "/../run"
|
||||
elseif filereadable("run")
|
||||
echo "cwd here"
|
||||
exec "AsyncRun! ./run"
|
||||
elseif filereadable("../run")
|
||||
" Handles editing a file in a code/ or src/ and there's a run script one directory back.
|
||||
echo "cwd one back"
|
||||
exec "AsyncRun! ../run"
|
||||
else
|
||||
" Final attempt is to run any exe that's found nearby.
|
||||
" We start with an exe relative to the open file's path.
|
||||
let l:files = systemlist('ls '.expand('%:h').''.l:path_to_use.'/*.exe 2>/dev/null')
|
||||
if len(l:files) > 0
|
||||
exec "AsyncRun! " . l:files[0]
|
||||
else
|
||||
" Last attempt is any exe in the current working directory.
|
||||
let l:files = systemlist('ls *.exe 2>/dev/null')
|
||||
if len(l:files) > 0
|
||||
exec "AsyncRun! " . l:files[0]
|
||||
else
|
||||
call PrintError("No exe or run script found!")
|
||||
endif
|
||||
endif
|
||||
let l:search_path = fnamemodify(l:search_path, ':p') " Normalize the path just in case.
|
||||
|
||||
" Search the current path for a run script, an exe with the current
|
||||
" filename, a bin/filename exe, a run_tree/filename exe - if nothing is
|
||||
" found then repeat one directory back when the current folder doesn't
|
||||
" contain a .git/ or it's not a root directory, e.g. /z/.
|
||||
"
|
||||
" If nothing is found after exhausting the search then we start over and
|
||||
" find the first exe with any name.
|
||||
|
||||
fu! TryRun(path) abort
|
||||
if filereadable(a:path)
|
||||
exec "AsyncRun! " . a:path
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfu
|
||||
|
||||
let l:current_path = l:search_path
|
||||
while 1
|
||||
" run script
|
||||
if l:also_search_for_cpp_run_script
|
||||
if TryRun(l:current_path . 'run-cpp') | return 1 | endif
|
||||
endif
|
||||
if TryRun(l:current_path . 'run') | return 1 | endif
|
||||
|
||||
" run_tree/run script
|
||||
if l:also_search_for_cpp_run_script
|
||||
if TryRun(l:current_path . 'run_tree/run-cpp') | return 1 | endif
|
||||
endif
|
||||
if TryRun(l:current_path . 'run_tree/run') | return 1 | endif
|
||||
|
||||
" filename exe
|
||||
if TryRun(l:current_path . a:file_exe_name) | return 1 | endif
|
||||
|
||||
" bin/filename exe
|
||||
if TryRun(l:current_path. 'bin/' . a:file_exe_name) | return 1 | endif
|
||||
|
||||
" run_tree/filename exe
|
||||
if TryRun(l:current_path. 'run_tree/' . a:file_exe_name) | return 1 | endif
|
||||
|
||||
" Only go back a directory if the current path doesn't have a .git folder or we're not in a root drive path.
|
||||
if isdirectory(l:current_path . '.git') || IsRootDrive(l:current_path)
|
||||
break
|
||||
endif
|
||||
|
||||
let l:current_path = fnamemodify(l:current_path."../", ':p')
|
||||
endwhile
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Start over but look for the first exe. The user will confirm if they
|
||||
" want to run it.
|
||||
"
|
||||
" @improve maybe provide the first 4 or 5 exes found and let them input
|
||||
" which one they want?
|
||||
|
||||
fu! GetFirstExePath(path)
|
||||
let l:files = systemlist('ls '.a:path.'*.exe 2>/dev/null')
|
||||
if len(l:files) > 0
|
||||
return l:files[0]
|
||||
endif
|
||||
return ""
|
||||
endfu
|
||||
|
||||
let l:current_path = l:search_path
|
||||
let l:exe_to_confirm = ""
|
||||
|
||||
while 1
|
||||
let l:exe = GetFirstExePath(l:current_path)
|
||||
if l:exe != ""
|
||||
let l:exe_to_confirm = l:exe
|
||||
break
|
||||
endif
|
||||
|
||||
" bin/filename exe
|
||||
let l:exe = GetFirstExePath(l:current_path."bin/")
|
||||
if l:exe != ""
|
||||
let l:exe_to_confirm = l:exe
|
||||
break
|
||||
endif
|
||||
|
||||
" run_tree/filename exe
|
||||
let l:exe = GetFirstExePath(l:current_path."run_tree/")
|
||||
if l:exe != ""
|
||||
let l:exe_to_confirm = l:exe
|
||||
break
|
||||
endif
|
||||
|
||||
" Only go back a directory if the current path doesn't have a .git folder or we're not in a root drive path.
|
||||
if isdirectory(l:current_path . '.git') || IsRootDrive(l:current_path)
|
||||
break
|
||||
endif
|
||||
|
||||
let l:current_path = fnamemodify(l:current_path."../", ':p')
|
||||
endwhile
|
||||
|
||||
if l:exe_to_confirm != ""
|
||||
let l:confirm = confirm("Found exe ".l:exe_to_confirm." - run this?", "&Yes\n&No")
|
||||
if l:confirm == 1
|
||||
exec "AsyncRun! " . l:exe_to_confirm
|
||||
return 1
|
||||
endif
|
||||
redraw!
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfu
|
||||
|
||||
" Show results window the moment the async job starts
|
||||
|
@ -1363,7 +1536,10 @@ fu! Search(path, search_args, case_insensitive=0)
|
|||
|
||||
let l:format = 'Rg ' . l:rg_args . ' ' . a:path . ' -e %s'
|
||||
let l:cmd = printf(l:format, shellescape(l:escaped_term))
|
||||
|
||||
exec l:cmd
|
||||
|
||||
call ConvertQuickfixPathsToUnixSlashes()
|
||||
endfu
|
||||
|
||||
fu! SearchExt(path, search_args, case_insensitive=0)
|
||||
|
@ -1528,9 +1704,9 @@ fu! RenameFile()
|
|||
if l:confirm == 1
|
||||
exec 'saveas' l:new_name
|
||||
exec 'silent! !rm' l:old_name
|
||||
redraw!
|
||||
endif
|
||||
endif
|
||||
redraw!
|
||||
endfu
|
||||
noremap <leader>n :call RenameFile()<cr>
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@ if [[ $# > 2 ]]; then
|
|||
use_gpu=$3
|
||||
fi
|
||||
|
||||
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
|
||||
# Found the following to work best with vids containing text (e.g. programming vid): 21 for CPU encoding and 28 for GPU (similar bitrates).
|
||||
use_crf=21
|
||||
if [[ $use_gpu -eq 1 ]]; then
|
||||
use_crf=25
|
||||
use_crf=28
|
||||
fi
|
||||
|
||||
compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu
|
||||
|
|
|
@ -65,8 +65,6 @@ function encode() {
|
|||
fi
|
||||
|
||||
if [[ $use_gpu -eq 1 ]]; then
|
||||
# File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
|
||||
|
||||
# RTX 3080
|
||||
ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user