Compare commits

..

8 Commits

143 changed files with 229 additions and 293 deletions

View File

@@ -189,7 +189,7 @@ alias ls='ls -F --color'
alias l='ls -lh' alias l='ls -lh'
alias ll='ls -lha' alias ll='ls -lha'
alias aliases='vim ~/.dotfiles/aliases' alias aliases='vim ~/.aliases'
alias al='aliases' alias al='aliases'
if [[ "${platform,,}" == *'ming'* ]]; then if [[ "${platform,,}" == *'ming'* ]]; then
@@ -365,7 +365,7 @@ function my_transcribe_video() {
# catches most words. Small and medium can do better word detection at # catches most words. Small and medium can do better word detection at
# times, but suffer from bad punctuation. Medium is particularly bad and # times, but suffer from bad punctuation. Medium is particularly bad and
# not adding commas and periods. # not adding commas and periods.
transcribe-video "$file" "$output" base tiny transcribe-video "$file" "$output" tiny base
} }
function my_transcribe_video_all_models() { function my_transcribe_video_all_models() {
@@ -517,9 +517,11 @@ download_youtube_playlist_list() {
} }
download_youtube_uploads_list() { download_youtube_uploads_list() {
local url="$1" local include_descriptions="$1"
local output_name="$2"
shift 2 local url="$2"
local output_name="$3"
shift 3
local opts="$@" local opts="$@"
if [[ $url == "" || $output_name == "" ]]; then if [[ $url == "" || $output_name == "" ]]; then
@@ -527,9 +529,16 @@ download_youtube_uploads_list() {
return return
fi fi
printf "${BOLD}Downloading Youtube uploads list\n\n${NORMAL}" local cmd=""
if [[ $include_descriptions == "1" ]]; then
printf "${BOLD}Downloading Youtube uploads list with descriptions\n\n${NORMAL}"
cmd="yt-dlp.exe --ignore-errors -O \"@@@ %(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download --get-description $opts $url"
else
printf "${BOLD}Downloading Youtube uploads list\n\n${NORMAL}"
cmd="yt-dlp.exe --ignore-errors -O \"%(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download $opts $url"
fi
local cmd="yt-dlp.exe --ignore-errors -O \"%(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download $opts $url"
eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string. eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string.
printf "${BOLD}Finished downloading the upload list\n${NORMAL}" printf "${BOLD}Finished downloading the upload list\n${NORMAL}"
@@ -918,7 +927,8 @@ download_from_m3u8() {
#------------------------------------------------- #-------------------------------------------------
# YouTube Vid DL # YouTube Vid DL
#------------------------------------------------- #-------------------------------------------------
alias yt-list='download_youtube_uploads_list ' alias yt-list='download_youtube_uploads_list 0 '
alias yt-list-desc='download_youtube_uploads_list 1 '
alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF' alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF'
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF' alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
@@ -1126,7 +1136,7 @@ alias gaup='git add --update -p'
alias gb='git branch -v' alias gb='git branch -v'
alias gbb='git bisect bad' alias gbb='git bisect bad'
alias gbd='git branch -D' alias gbd='git branch -D'
alias gbdr='git branch -Dr' alias gbdr='git branch -Dr' # Delete a remote tracking branch; useful when the remote no longer exists and branch pruning isn't removing the lingering tracking branches.
alias gbg='git bisect good' alias gbg='git bisect good'
alias gbl='git branch --all' alias gbl='git branch --all'
alias gblm='git blame -wMC' alias gblm='git blame -wMC'
@@ -1227,10 +1237,11 @@ alias gsp3='git stash pop stash@{3}'
alias gsp4='git stash pop stash@{4}' alias gsp4='git stash pop stash@{4}'
alias gsp5='git stash pop stash@{6}' alias gsp5='git stash pop stash@{6}'
alias gsp6='git stash pop stash@{7}' alias gsp6='git stash pop stash@{7}'
alias gt='git tag -s' # Signed alias gt='git tag' # Unsigned
alias gta='git tag -a' alias gta='git tag -a'
alias gtd='git tag -d' alias gtd='git tag -d'
alias gtl='git tag -l' alias gtl='git tag -l'
alias gts='git tag -s' # Signed
alias gx='git reset --hard' alias gx='git reset --hard'
alias gxx='git reset --hard HEAD~1' alias gxx='git reset --hard HEAD~1'
alias gxom='git reset --hard origin/master' alias gxom='git reset --hard origin/master'

View File

View File

@@ -13,16 +13,20 @@ esac
export PLATFORM=$platform export PLATFORM=$platform
export PLATFORM_OS=$platform_os export PLATFORM_OS=$platform_os
test -f "$HOME/.env.platform" && . "$HOME/.env.platform" os_lower="${platform_os,,}"
test -f "$HOME/dotfiles/${os_lower}/env.platform" && . "$HOME/dotfiles/${os_lower}/env.platform"
test -f "$HOME/.env.common-pre" && . "$HOME/.env.common-pre" test -f "$HOME/.env.common-pre" && . "$HOME/.env.common-pre"
test -f "$HOME/.env.private" && . "$HOME/.env.private" test -f "$HOME/.env.private" && . "$HOME/.env.private"
test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post" test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post"
test -f "$HOME/.aliases" && . "$HOME/.aliases" test -f "$HOME/.aliases" && . "$HOME/.aliases"
test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common" test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common"
test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private" test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private"
if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then
test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH
#TODO: remove this
test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH
fi fi

View File

@@ -1,5 +1,4 @@
[include] [include]
path = ~/.gitconfig.platform
path = ~/.gitconfig.private path = ~/.gitconfig.private
[init] [init]
defaultBranch = master defaultBranch = master
@@ -7,11 +6,25 @@
summary = true summary = true
tool = vimdiff tool = vimdiff
[core] [core]
excludesfile = ~/.gitignore excludesfile = ~/.gitignore.global
hookspath = ~/.git_hooks hookspath = ~/.git_hooks
preloadindex = true preloadindex = true
fscache = true fscache = true
editor = vim editor = vim
# I used to have this set to true, which would result in checked out files
# being converted to CRLF line endings and commits converting to LF. I'm
# tired of this conversion shit though so I'm turning it off and will be
# enforcing LF line endings via a combination of editorconfig and
# gitattribute files on a per-project basis. This should make sure that
# anyone contributing to my projects will be committing LF line endings.
# The only exception is that the gitattributes files will commit batch
# files with CRLF to avoid Windows glitches.
#
# I used these posts for reference:
# https://markentier.tech/posts/2021/10/autocrlf-true-considered-harmful/
# https://troyready.com/blog/git-windows-dont-convert-line-endings.html
#
autocrlf = false
[push] [push]
default = upstream default = upstream
[pull] [pull]

10
.gitignore vendored
View File

@@ -1,9 +1 @@
vim/.netrwhist *
vim/bundle/*
vim/plugged/*
vim/undo
vim/undo/*
vim/autoload/plug.vim.old
config/openbox/lxde-rc.xml
*.pyc
!bin

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "vim/bundle/Vundle.vim"]
path = vim/bundle/Vundle.vim
url = https://github.com/VundleVim/Vundle.vim.git

View File

View File

@@ -271,3 +271,7 @@ memcpy
strlen strlen
u8 u8
s64 s64
Sculpey
grey
googly
favour

BIN
.vim/spell/en.utf-8.add.spl Normal file

Binary file not shown.

View File

@@ -26,12 +26,12 @@ let s:uname = system("echo -n \"$(uname)\"")
let g:vim_dir = $HOME . "/.vim" let g:vim_dir = $HOME . "/.vim"
let mapleader="," let mapleader=","
function! IsWindows() fu! IsWindows()
if s:uname =~ "mingw" || s:uname =~ "msys" if s:uname =~ "mingw" || s:uname =~ "msys"
return 1 return 1
endif endif
return 0 return 0
endfunction endfu
if has('termguicolors') if has('termguicolors')
set termguicolors set termguicolors
@@ -40,12 +40,12 @@ if has('termguicolors')
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif endif
function! PrintError(msg) abort fu! PrintError(msg) abort
exec 'normal! \<Esc>' exec 'normal! \<Esc>'
echohl ErrorMsg echohl ErrorMsg
echomsg a:msg echomsg a:msg
echohl None echohl None
endfunction endfu
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -193,13 +193,13 @@ let g:campo_custom_ctags_args = ""
" call g:SetExtraCtagsPaths([g:campo_jai_path.'/tags']) " call g:SetExtraCtagsPaths([g:campo_jai_path.'/tags'])
" "
" You can see what your ctags search list is set to in the editor with :echo &tags " You can see what your ctags search list is set to in the editor with :echo &tags
function! g:SetExtraCtagsPaths(paths_array) fu! g:SetExtraCtagsPaths(paths_array)
let l:list = './tags,tags' " This is the default tags list set by vim. let l:list = './tags,tags' " This is the default tags list set by vim.
for path in a:paths_array for path in a:paths_array
let l:list .= ',' . path let l:list .= ',' . path
endfor endfor
let &tags=l:list let &tags=l:list
endfunction endfu
"################################################################################## "##################################################################################
@@ -374,6 +374,8 @@ set complete-=i " Don't scan all included files since it's rea
set termguicolors set termguicolors
syntax on " Enable highlighting for syntax syntax on " Enable highlighting for syntax
let g:netrw_dirhistmax = 0 " Disable netrw
set wildmenu set wildmenu
set wildmode=longest,list,full set wildmode=longest,list,full
set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/* set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/*
@@ -382,7 +384,8 @@ if executable('rg')
set grepprg=rg\ --vimgrep\ --hidden " Requires ripgrep to be installed. set grepprg=rg\ --vimgrep\ --hidden " Requires ripgrep to be installed.
endif endif
set list listchars=tab:»·,trail" Show trailing whitespace. " Show trailing tabs and whitespace.
set listchars=tab:»\ ,trail,extends:>,precedes:<,nbsp:+
set timeoutlen=250 ttimeoutlen=0 " Don't set it too low otherwise you won't be able to type use multi-key sequences. set timeoutlen=250 ttimeoutlen=0 " Don't set it too low otherwise you won't be able to type use multi-key sequences.
@@ -475,7 +478,7 @@ augroup campoCmds
autocmd BufWritePost ~/.vimrc_templates.private silent! source $MYVIMRC autocmd BufWritePost ~/.vimrc_templates.private silent! source $MYVIMRC
" Remove trailing whitespace when saving any file. " Remove trailing whitespace when saving any file.
function! StripTrailingWhitespaces() fu! StripTrailingWhitespaces()
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) if len(g:campo_directories_to_ignore_when_stripping_trailing_whitespace)
for path in g:campo_directories_to_ignore_when_stripping_trailing_whitespace for path in g:campo_directories_to_ignore_when_stripping_trailing_whitespace
@@ -570,7 +573,7 @@ augroup END
" Suspend vim process and return to the shell. Can return to vim with `fg`. " Suspend vim process and return to the shell. Can return to vim with `fg`.
nnoremap <leader>z <c-z> nnoremap <leader>z <c-z>
" edit a file " Edit a file
nnoremap <leader>e :e nnoremap <leader>e :e
" Open the vimrc file for editing / reload vimrc file. " Open the vimrc file for editing / reload vimrc file.
@@ -614,8 +617,22 @@ noremap <c-h> <c-w><Left>
noremap <leader>m :vsplit<cr> noremap <leader>m :vsplit<cr>
noremap <leader>mm :split<cr> noremap <leader>mm :split<cr>
" Forward delete and replace a word. " Faster way to activate the 'a' register. This is useful for putting different
noremap <leader>d ciw " lines of text into the 'a' register and then pasting it as a group.
" You need to first use `<leader>a` and then subsequent use is <leader>A.
" The paste command will use this content until you do something with a
" different register. You can later paste the 'a' contents using `<leader>a p`
" This overwrites the contents of a.
noremap <leader>a "a
" This appends to a.
noremap <leader>aa "A
" Backward replace word including cursor character.
noremap <leader>d cvb
" Forward replace word.
noremap <leader>e cw
" Allow fast pasting by accessing the system clipboard register. " Allow fast pasting by accessing the system clipboard register.
noremap <leader>p "+p noremap <leader>p "+p
@@ -657,7 +674,7 @@ nnoremap <c-g> :%s///g<left><left>
" order to only call it once for a group of saves I've had to remap the " order to only call it once for a group of saves I've had to remap the
" various save commands to a function call. " various save commands to a function call.
function! CreateCtags() fu! CreateCtags()
" Only allow one instance of ctags to run in this directory at any given time. " Only allow one instance of ctags to run in this directory at any given time.
let l:lock_file = "ctags.lock" let l:lock_file = "ctags.lock"
if filereadable(l:lock_file) || filereadable("newtags") if filereadable(l:lock_file) || filereadable("newtags")
@@ -711,54 +728,64 @@ endfun
" These write functions below will not be reloaded because they initiate the " These write functions below will not be reloaded because they initiate the
" save. So if you make changes to them then you need to manually reload this " save. So if you make changes to them then you need to manually reload this
" file using <leader>rv or whatever. :ReloadVimrcError " file using <leader>rv or whatever. :ReloadVimrcError
function! WriteCurrentFileAndCreateCtags() fu! WriteCurrentFileAndCreateCtags()
write! write!
call CreateCtags() call CreateCtags()
endfunction endfu
function! WriteCurrentFileAndCreateCtagsThenQuit() fu! WriteCurrentFileAndCreateCtagsThenQuit()
write! write!
call CreateCtags() call CreateCtags()
quit quit
endfunction endfu
" @fixme Sometimes a :wa that saves multiple files causes vim to hang and use a lot of CPU. " @fixme Sometimes a :wa that saves multiple files causes vim to hang and use a lot of CPU.
function! WriteAllModifiedFilesAndCreateCtags() fu! WriteAllModifiedFilesAndCreateCtags()
wall! wall!
call CreateCtags() call CreateCtags()
endfunction endfu
cnoreabbrev w :call WriteCurrentFileAndCreateCtags() " Create a command abbreviation that only applies when it's at the beginning
cnoreabbrev W :call WriteCurrentFileAndCreateCtags() " of a ex command. If you were to do a normal cnoreabbrev or cabbrev then the
cnoreabbrev wa :call WriteAllModifiedFilesAndCreateCtags() " subsitution can happen anywhere in the command line. It was mostly affecting
cnoreabbrev Wa :call WriteAllModifiedFilesAndCreateCtags() " my text search; I'd type '/w' and it would be replaced with the call to save
cnoreabbrev WA :call WriteAllModifiedFilesAndCreateCtags() " and create ctags.
cnoreabbrev wq :call WriteCurrentFileAndCreateCtagsThenQuit() fu! Cabbrev(key, value)
cnoreabbrev Wq :call WriteCurrentFileAndCreateCtagsThenQuit() exe printf('cabbrev <expr> %s (getcmdtype() == ":" && getcmdpos() <= %d) ? %s : %s',
cnoreabbrev WQ :call WriteCurrentFileAndCreateCtagsThenQuit() \ a:key, len(a:key)+1, string(a:value), string(a:key))
endfu
call Cabbrev('w', 'call WriteCurrentFileAndCreateCtags()')
call Cabbrev('W', 'call WriteCurrentFileAndCreateCtags()')
call Cabbrev('wa', 'call WriteAllModifiedFilesAndCreateCtags()')
call Cabbrev('Wa', 'call WriteAllModifiedFilesAndCreateCtags()')
call Cabbrev('WA', 'call WriteAllModifiedFilesAndCreateCtags()')
call Cabbrev('wq', 'call WriteCurrentFileAndCreateCtagsThenQuit()')
call Cabbrev('Wq', 'call WriteCurrentFileAndCreateCtagsThenQuit()')
call Cabbrev('WQ', 'call WriteCurrentFileAndCreateCtagsThenQuit()')
nnoremap <leader>w :call WriteCurrentFileAndCreateCtags()<cr> nnoremap <leader>w :call WriteCurrentFileAndCreateCtags()<cr>
nnoremap <leader>x :call WriteCurrentFileAndCreateCtagsThenQuit()<cr> nnoremap <leader>x :call WriteCurrentFileAndCreateCtagsThenQuit()<cr>
nnoremap <leader>q :q<cr> nnoremap <leader>q :q<cr>
cnoreabbrev Q q call Cabbrev('Q', 'q')
cnoreabbrev Qa qa call Cabbrev('Qa', 'qa')
command! Qa qall command! Qa qall
" Disable Ex mode. " Disable Ex mode.
noremap Q <Nop> noremap Q <Nop>
"################################################################################## "##################################################################################
" MULTIPURPOSE TAB KEY " MULTIPURPOSE TAB KEY
"################################################################################## "##################################################################################
function! InsertTabWrapper()
fu! InsertTabWrapper()
let l:col = col('.') - 1 let l:col = col('.') - 1
if !l:col || getline('.')[l:col - 1] !~ '\k' if !l:col || getline('.')[l:col - 1] !~ '\k'
return "\<tab>" return "\<tab>"
else else
return "\<c-p>" return "\<c-p>"
endif endif
endfunction endfu
inoremap <tab> <c-r>=InsertTabWrapper()<cr> inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-n> inoremap <s-tab> <c-n>
@@ -860,12 +887,12 @@ let g:rg_window_height = g:quickfix_pane_height
" window and cmdline events but wasn't able to find anything that fired AFTER " window and cmdline events but wasn't able to find anything that fired AFTER
" the tag command. So we're instead just setting the tags list once for the " the tag command. So we're instead just setting the tags list once for the
" session and not bothering with changing it on the fly. See g:SetExtraCtagsPaths " session and not bothering with changing it on the fly. See g:SetExtraCtagsPaths
function! CtrlP_Search(search_path) fu! CtrlP_Search(search_path)
" If a:search_path is empty then ctrlp will use g:ctrlp_working_path_mode to determine the cwd to search in. " If a:search_path is empty then ctrlp will use g:ctrlp_working_path_mode to determine the cwd to search in.
execute 'CtrlP ' . a:search_path execute 'CtrlP ' . a:search_path
endfunction endfu
function! CtrlP_JaiSearch(jai_rel_search_path) fu! CtrlP_JaiSearch(jai_rel_search_path)
if g:campo_jai_path == '' if g:campo_jai_path == ''
call PrintError("g:campo_jai_path isn't set!") call PrintError("g:campo_jai_path isn't set!")
return return
@@ -879,7 +906,7 @@ function! CtrlP_JaiSearch(jai_rel_search_path)
return return
endif endif
call CtrlP_Search(l:path) call CtrlP_Search(l:path)
endfunction endfu
" CtrlP File Searching " CtrlP File Searching
noremap <leader>g :call CtrlP_Search('')<cr> " Search in current directory noremap <leader>g :call CtrlP_Search('')<cr> " Search in current directory
@@ -929,7 +956,7 @@ let s:light_rainbow = ['red', 'green', 'magenta', 'cyan', 'yellow', 'white', 'gr
let s:dark_rainbow = ['darkblue', 'red', 'black', 'darkgreen', 'darkyellow', 'darkred', 'darkgray'] let s:dark_rainbow = ['darkblue', 'red', 'black', 'darkgreen', 'darkyellow', 'darkred', 'darkgray']
let s:rainbow_theme = g:campo_light_dark_mode let s:rainbow_theme = g:campo_light_dark_mode
function! UpdateRainbowConf() fu! UpdateRainbowConf()
let g:rainbow_conf = { let g:rainbow_conf = {
\ 'ctermfgs': (s:rainbow_theme == "light"? s:dark_rainbow : s:light_rainbow) \ 'ctermfgs': (s:rainbow_theme == "light"? s:dark_rainbow : s:light_rainbow)
\} \}
@@ -937,11 +964,11 @@ function! UpdateRainbowConf()
"\ '*': 0, " Disable all "\ '*': 0, " Disable all
"\ 'c++': {} " Only enable c++ "\ 'c++': {} " Only enable c++
"\ } "\ }
endfunction endfu
call UpdateRainbowConf() call UpdateRainbowConf()
function! ReloadRainbow() fu! ReloadRainbow()
if g:campo_theme_use_rainbow_parens if g:campo_theme_use_rainbow_parens
if exists(':RainbowToggle') if exists(':RainbowToggle')
call UpdateRainbowConf() call UpdateRainbowConf()
@@ -954,7 +981,7 @@ function! ReloadRainbow()
call rainbow#clear() call rainbow#clear()
endif endif
endif endif
endfunction endfu
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@@ -976,15 +1003,15 @@ noremap <leader>l :call ToggleLightDarkTheme()<cr>
let s:current_light_dark_mode = g:campo_light_dark_mode let s:current_light_dark_mode = g:campo_light_dark_mode
function! ToggleLightDarkTheme() fu! ToggleLightDarkTheme()
if s:current_light_dark_mode == 'light' if s:current_light_dark_mode == 'light'
call ChangeLightDarkMode('dark', 0) call ChangeLightDarkMode('dark', 0)
else else
call ChangeLightDarkMode('light', 0) call ChangeLightDarkMode('light', 0)
endif endif
endfunction endfu
function! ChangeLightDarkMode(mode, onlySetTheme) fu! ChangeLightDarkMode(mode, onlySetTheme)
if a:mode == 'light' if a:mode == 'light'
let s:rainbow_theme = 'light' let s:rainbow_theme = 'light'
let s:theme = g:campo_light_theme let s:theme = g:campo_light_theme
@@ -1005,7 +1032,7 @@ function! ChangeLightDarkMode(mode, onlySetTheme)
if !a:onlySetTheme if !a:onlySetTheme
exec 'AirlineTheme' a:mode exec 'AirlineTheme' a:mode
endif endif
endfunction endfu
" Set the intial light/dark mode. " Set the intial light/dark mode.
if g:campo_light_dark_mode =~ 'light' if g:campo_light_dark_mode =~ 'light'
@@ -1015,14 +1042,14 @@ else
endif endif
" Open the current color scheme for editing. " Open the current color scheme for editing.
function! EditColorScheme() fu! EditColorScheme()
let l:path = g:vim_dir . '/colors/' . s:theme . '.vim' let l:path = g:vim_dir . '/colors/' . s:theme . '.vim'
if filereadable(l:path) if filereadable(l:path)
execute 'vsplit ' . l:path execute 'vsplit ' . l:path
else else
call PrintError("Failed to open " . l:path . " for editing.") call PrintError("Failed to open " . l:path . " for editing.")
endif endif
endfunction endfu
command -nargs=0 EditColorScheme call EditColorScheme() command -nargs=0 EditColorScheme call EditColorScheme()
@@ -1106,10 +1133,10 @@ let errormarker_warninggroup = "BuildWarn"
let errormarker_infogroup = "BuildInfo" let errormarker_infogroup = "BuildInfo"
" I don't know how to map to a plugin command, so I'm wrapping it with a function...ugh. " I don't know how to map to a plugin command, so I'm wrapping it with a function...ugh.
function! ShowErrorAtCursor() fu! ShowErrorAtCursor()
" This is defined in errormarker.vim " This is defined in errormarker.vim
ErrorAtCursor ErrorAtCursor
endfunction endfu
nnoremap <leader>ce :call ShowErrorAtCursor()<cr> nnoremap <leader>ce :call ShowErrorAtCursor()<cr>
"///////////////////////////////////////////////// "/////////////////////////////////////////////////
@@ -1120,7 +1147,7 @@ nnoremap <leader>ce :call ShowErrorAtCursor()<cr>
" This will print the valid entries. You'll know parsing is correct when the " This will print the valid entries. You'll know parsing is correct when the
" entries have a type, line num, error message, etc. " entries have a type, line num, error message, etc.
function! ShowErrorEntries() fu! ShowErrorEntries()
" Prints out valid quickfix errors. " Prints out valid quickfix errors.
redraw! redraw!
for l:d in getqflist() for l:d in getqflist()
@@ -1128,7 +1155,7 @@ function! ShowErrorEntries()
echomsg l:d echomsg l:d
endif endif
endfor endfor
endfunction endfu
command -nargs=0 ShowErrorEntries call ShowErrorEntries() command -nargs=0 ShowErrorEntries call ShowErrorEntries()
" Jai " Jai
@@ -1162,25 +1189,25 @@ set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
" BUILD FUNCTIONS " BUILD FUNCTIONS
"///////////////////////////////////////////////// "/////////////////////////////////////////////////
function! HideBuildResultsAndClearErrors() fu! HideBuildResultsAndClearErrors()
RemoveErrorMarkers RemoveErrorMarkers
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0) call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
endfunction endfu
function! HideAsyncResults() fu! HideAsyncResults()
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0) call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
endfunction endfu
function! ToggleBuildResults() fu! ToggleBuildResults()
call asyncrun#quickfix_toggle(g:quickfix_pane_height) call asyncrun#quickfix_toggle(g:quickfix_pane_height)
endfunction endfu
function! StopRunTask() fu! StopRunTask()
AsyncStop AsyncStop
call HideAsyncResults() call HideAsyncResults()
endfunction endfu
function! Build(optimized=0, silent=0) fu! Build(optimized=0, silent=0)
let l:async_cmd = "AsyncRun! " let l:async_cmd = "AsyncRun! "
if a:silent if a:silent
let l:async_cmd .= "-post=call\\ HideAsyncResults() " let l:async_cmd .= "-post=call\\ HideAsyncResults() "
@@ -1267,9 +1294,9 @@ function! Build(optimized=0, silent=0)
" be generated so we're handling the save ourselves. " be generated so we're handling the save ourselves.
call WriteAllModifiedFilesAndCreateCtags() call WriteAllModifiedFilesAndCreateCtags()
exec l:async_cmd . l:cmd exec l:async_cmd . l:cmd
endfunction endfu
function! RunProgram() fu! RunProgram()
let l:ran = 0 let l:ran = 0
let l:ext = tolower(expand('%:e')) let l:ext = tolower(expand('%:e'))
let l:path_to_use = "" let l:path_to_use = ""
@@ -1329,7 +1356,7 @@ function! RunProgram()
endif endif
endif endif
endif endif
endfunction endfu
" Show results window the moment the async job starts " Show results window the moment the async job starts
augroup asyncPluginCmds augroup asyncPluginCmds
@@ -1371,7 +1398,7 @@ nnoremap <C-p> :cp<CR>
"################################################################################## "##################################################################################
" Search using ripgrep (first install with Rust: cargo install ripgrep). " Search using ripgrep (first install with Rust: cargo install ripgrep).
function! Search(path, search_args, case_insensitive=0) fu! Search(path, search_args, case_insensitive=0)
let l:helper = "Search '" . a:path . "' (" . (len(a:search_args) > 0 ? a:search_args . " | " : '') . (a:case_insensitive ? "INSENSITIVE" : "SENSITIVE") . "): " let l:helper = "Search '" . a:path . "' (" . (len(a:search_args) > 0 ? a:search_args . " | " : '') . (a:case_insensitive ? "INSENSITIVE" : "SENSITIVE") . "): "
let l:term = input(l:helper) let l:term = input(l:helper)
if empty(l:term) if empty(l:term)
@@ -1392,9 +1419,9 @@ function! Search(path, search_args, case_insensitive=0)
let l:format = 'Rg ' . l:rg_args . ' ' . a:path . ' -e %s' let l:format = 'Rg ' . l:rg_args . ' ' . a:path . ' -e %s'
let l:cmd = printf(l:format, shellescape(l:escaped_term)) let l:cmd = printf(l:format, shellescape(l:escaped_term))
exec l:cmd exec l:cmd
endfunction endfu
function! SearchExt(path, search_args, case_insensitive=0) fu! SearchExt(path, search_args, case_insensitive=0)
call inputsave() call inputsave()
let l:ext = input('Enter extension to search on (leave blank for files with no ext): ') let l:ext = input('Enter extension to search on (leave blank for files with no ext): ')
call inputrestore() call inputrestore()
@@ -1409,7 +1436,7 @@ function! SearchExt(path, search_args, case_insensitive=0)
let l:args = a:search_args." -g \"".l:ext."\"" let l:args = a:search_args." -g \"".l:ext."\""
call Search(a:path, l:args, a:case_insensitive) call Search(a:path, l:args, a:case_insensitive)
endfunction endfu
"///////////////////////////////////////////////// "/////////////////////////////////////////////////
" SEARCH IN CURRENT WORKING DIRECTORY " SEARCH IN CURRENT WORKING DIRECTORY
@@ -1485,7 +1512,7 @@ nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
" Replace text in a git repo's committed files. " Replace text in a git repo's committed files.
" The range identifier allows us to run this once when multiple lines are selected in a file. " The range identifier allows us to run this once when multiple lines are selected in a file.
function! GlobalReplaceIt(confirm_replacement) range fu! GlobalReplaceIt(confirm_replacement) range
if exists(':Ggrep') if exists(':Ggrep')
call inputsave() call inputsave()
if a:confirm_replacement if a:confirm_replacement
@@ -1538,7 +1565,7 @@ function! GlobalReplaceIt(confirm_replacement) range
else else
call PrintError("Unable to search since you're not in a git repo!") call PrintError("Unable to search since you're not in a git repo!")
endif endif
endfunction endfu
noremap <leader>r :call GlobalReplaceIt(0)<cr> noremap <leader>r :call GlobalReplaceIt(0)<cr>
noremap <leader>rr :call GlobalReplaceIt(1)<cr> noremap <leader>rr :call GlobalReplaceIt(1)<cr>
@@ -1547,7 +1574,7 @@ noremap <leader>rr :call GlobalReplaceIt(1)<cr>
" RENAME CURRENT FILE " RENAME CURRENT FILE
"################################################################################## "##################################################################################
function! RenameFile() fu! 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
@@ -1558,7 +1585,7 @@ function! RenameFile()
redraw! redraw!
endif endif
endif endif
endfunction endfu
noremap <leader>n :call RenameFile()<cr> noremap <leader>n :call RenameFile()<cr>
@@ -1566,19 +1593,19 @@ noremap <leader>n :call RenameFile()<cr>
" CENTER THE BUFFER " CENTER THE BUFFER
"################################################################################## "##################################################################################
function! CenterPane() fu! CenterPane()
" Centers the current pane as the middle 2 of 4 imaginary columns should " Centers the current pane as the middle 2 of 4 imaginary columns should
" be called in a window with a single pane. " be called in a window with a single pane.
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim " Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
lefta vnew lefta vnew
wincmd w wincmd w
exec 'vertical resize' string(&columns * 0.65) exec 'vertical resize' string(&columns * 0.65)
endfunction endfu
function! RemoveCenterPane() fu! RemoveCenterPane()
wincmd w wincmd w
close close
endfunction endfu
nnoremap <leader>cc :call CenterPane()<cr> nnoremap <leader>cc :call CenterPane()<cr>
nnoremap <leader>cd :call RemoveCenterPane()<cr> nnoremap <leader>cd :call RemoveCenterPane()<cr>
@@ -1591,7 +1618,7 @@ nnoremap <leader>cd :call RemoveCenterPane()<cr>
" Applies a clean view of the current buffer by turning off line " Applies a clean view of the current buffer by turning off line
" numbers, trailing spaces, tabs and git diff markers in the gutter. " numbers, trailing spaces, tabs and git diff markers in the gutter.
function! ToggleSimpleView() fu! ToggleSimpleView()
" I wasn't able to get this to apply to every copy of the same buffer, " I wasn't able to get this to apply to every copy of the same buffer,
" e.g. you have a split view showing the same file; only the active one " e.g. you have a split view showing the same file; only the active one
" will be affected, but they will share the same state! I tried many " will be affected, but they will share the same state! I tried many
@@ -1617,7 +1644,7 @@ function! ToggleSimpleView()
setlocal list setlocal list
exec 'GitGutterBufferEnable' exec 'GitGutterBufferEnable'
endif endif
endfunction endfu
nnoremap <leader>c :call ToggleSimpleView()<cr> nnoremap <leader>c :call ToggleSimpleView()<cr>

View File

View File

View File

@@ -1,11 +0,0 @@
# dotfiles
Various dotfiles and misc configs. Some of it is customized around my system setup
(like aliases pointing to paths) but you should be able to easily remove that stuff.
## Installing
There is an `install` script that facilitates the setup, however it's been a while since I did a
full system setup and this script may not be fully complete. An alternative method is to manually
symlink files in the root directory. OS specific configs are in their respective folders.

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Copies vim data from the home directory to the dotfiles repo.
set -e
src="$HOME/.vim"
dest="$HOME/.dotfiles/vim/"
if [ -d $src ]; then
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
fi

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Copies vim data from the dotfiles repo to the home directory.
set -e
src="$HOME/.dotfiles/vim"
dest="$HOME/.vim/"
if [ -d $src ]; then
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
fi

32
dotfiles/README.md Normal file
View File

@@ -0,0 +1,32 @@
# dotfiles
Various dotfiles and misc configs. Some of it is customized around my system
setup (like aliases pointing to paths) but you should be able to easily remove
that stuff.
This unpacks files one directory back, which is assumed to be your home
directory. The gitignore ignores all files by default. If you want to add a new
file this you need to add the `-f` flag to the git add command. This setup was
inspired by Gary Bernhardt and https://gist.github.com/meleu/053275b6842646b95491bf1af4a6ca0e
## Installing
```bash
# Go to your home directory.
cd ~
# Clone the repo with the "--no-checkout" option (so we can checkout the files in our home directory)
git clone --no-checkout <repo_url>/dotfiles.git
# Go to the created directory and change the worktree to the home direcory.
cd dotfiles
git config core.worktree '../../'
# Checkout the files. This will overwrite existing dotfiles with the same name.
git reset --hard origin/master
```
If you want to install optional OS specific stuff, like various packages, run the `install` script in this folder.
OS specific configs are in their respective folders.

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "$HOME/.dotfiles/script_helpers/all.sh" source "$HOME/dotfiles/script_helpers/all.sh"
cwd=$PWD cwd=$PWD
source_path="" source_path=""

View File

@@ -71,16 +71,24 @@ fi
output_name="$output_name_without_ext.${model}" output_name="$output_name_without_ext.${model}"
printf "\n${YELLOW}${BOLD}Transcribing $input_wav | model: $model | threads: $threads | output: $output_name ${NORMAL}\n"
# 1 core 31 threads has very fast pcm_to_mel conversion and then just one core doing most of the work. You get more accurate results this way.
# 2 core 16 is about half the time but it can have errors where the two pieces come together. This only gets more likely as the core count is increased.
# 8 threads, 4 cores is good too for tiny,small and 2 threads, 4 cores for medium.
threads=31 #keep a thread for me
cores=1
printf "\n${YELLOW}${BOLD}Transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name ${NORMAL}\n"
whisper_fullname="$(expand_path $(which whisper.exe))" whisper_fullname="$(expand_path $(which whisper.exe))"
whisper_path="$(dirname $whisper_fullname)" whisper_path="$(dirname $whisper_fullname)"
models_path="$whisper_path/models" models_path="$whisper_path/models"
whisper.exe --threads ${threads} -m "$models_path/ggml-${model}.en.bin" -otxt -osrt -f "$input_wav" -of "$output_name" --print-colors whisper.exe --processors ${cores} --threads ${threads} -m "$models_path/ggml-${model}.en.bin" -otxt -osrt -f "$input_wav" -of "$output_name" --print-colors --print-progress
error=$? error=$?
if [[ error -eq 0 ]]; then if [[ error -eq 0 ]]; then
printf "${GREEN}${BOLD}Done transcribing $input_wav | model: $model | threads: $threads | output: $output_name${NORMAL}\n" printf "${GREEN}${BOLD}Done transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
else else
printf "${GREEN}${BOLD}Error while transcribing $input_wav | model: $model | threads: $threads | output: $output_name${NORMAL}\n" printf "${GREEN}${BOLD}Error while transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
fi fi

View File

@@ -29,7 +29,7 @@ shift 2
models=("$@") models=("$@")
if [[ $input_video == "" || $output_name_without_ext == "" || ${#models[@]} -eq 0 ]]; then if [[ $input_video == "" || $output_name_without_ext == "" || ${#models[@]} -eq 0 ]]; then
printf "${BOLD}${RED}Usage: $0 <input.wav> <output name without extension> <list of model names to use>${NORMAL}\n" printf "${BOLD}${RED}Usage: $0 <input.mp4> <output name without extension> <list of model names to use>${NORMAL}\n"
exit 1 exit 1
fi fi

View File

@@ -2,8 +2,8 @@
# If you're getting signature errors, check out https://www.msys2.org/news/#2020-06-29-new-packagers and/or other news posts. # If you're getting signature errors, check out https://www.msys2.org/news/#2020-06-29-new-packagers and/or other news posts.
source "$HOME/.dotfiles/script_helpers/printing.sh" source "$HOME/dotfiles/script_helpers/printing.sh"
source "$HOME/.dotfiles/script_helpers/platform.sh" source "$HOME/dotfiles/script_helpers/platform.sh"
set -e set -e

89
install → dotfiles/install Executable file → Normal file
View File

@@ -4,7 +4,7 @@ if [[ $(uname) == 'Darwin' ]]; then
if ! command -v brew &>/dev/null if ! command -v brew &>/dev/null
then then
# We need to update bash, so we'll start with setting up homebrew. # We need to update bash, so we'll start with setting up homebrew.
./osx/pre_install ./macos/pre_install
exit exit
fi fi
fi fi
@@ -52,31 +52,6 @@ setup_zsh() {
if [[ $is_linux -eq 1 ]]; then if [[ $is_linux -eq 1 ]]; then
sudo apt install zsh sudo apt install zsh
fi fi
make_link .dotfiles/zsh/core .zsh
FILES=()
FILES+=('zshrc')
FILES+=('zlogin')
for file in "${FILES[@]}"
do
make_link .dotfiles/zsh/$file .$file
done
}
setup_bash() {
printf "${MAGENTA}==> ${NORMAL}Setting up bash...\n"
FILES=()
FILES+=('bashrc')
FILES+=('bash_profile')
FILES+=('inputrc')
for file in "${FILES[@]}"
do
make_link .dotfiles/bash/$file .$file
done
} }
#################################################################################################### ####################################################################################################
@@ -85,40 +60,6 @@ setup_bash() {
pushd "$HOME" &>/dev/null pushd "$HOME" &>/dev/null
make_link $dotfiles_dir .dotfiles 1 # expand source path in case we're reinstalling and the cwd is a symlink.
if [[ $is_windows -eq 1 ]]; then
do_vim_copy=1
if [[ -d "$PWD/.vim" ]]; then
printf "\n${BOLD}Vim folder already found at destination. Overwrite? [1,0]\n> ${NORMAL}"
read -e copy_vim
if [[ $copy_vim != "0" && $copy_vim != "1" ]]; then
fatal "Invalid value '$copy_vim'"
elif [[ $copy_vim == "0" ]]; then
do_vim_copy=0
printf "\n"
fi
fi
if [[ $do_vim_copy -eq 1 ]]; then
printf "${MAGENTA}==> ${NORMAL}Copying ${YELLOW}.dotfiles/vim${NORMAL} to ${YELLOW}$PWD/.vim${NORMAL}\n"
cp -r .dotfiles/vim .vim
fi
else
make_link .dotfiles/vim .vim
fi
FILES=()
FILES+=('env.loader')
FILES+=('aliases')
FILES+=('gitconfig')
FILES+=('vimrc')
FILES+=('curlrc')
for file in "${FILES[@]}"
do
make_link .dotfiles/$file .$file
done
set +e set +e
git_comp_filename=".git-completion.bash" git_comp_filename=".git-completion.bash"
printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n" printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n"
@@ -129,37 +70,19 @@ set -e
# Setup platform files # Setup platform files
######################### #########################
if [[ $is_windows -eq 1 ]]; then if [[ $is_macos -eq 1 ]]; then
printf "\n${BOLD}Setting up Windows${NORMAL}\n\n"
os_name="windows"
# Already using bash if running msys2.
setup_bash
elif [[ $is_macos -eq 1 ]]; then
printf "\n${BOLD}Setting up MacOS${NORMAL}\n\n" printf "\n${BOLD}Setting up MacOS${NORMAL}\n\n"
os_name="osx" $dotfiles_dir/macos/install
# might just switch back to bash since the zsh stuff is ancient.
setup_zsh setup_zsh
setup_bash
use_shell zsh use_shell zsh
elif [[ $is_linux -eq 1 ]]; then elif [[ $is_linux -eq 1 ]]; then
printf "\n${BOLD}Setting up Linux${NORMAL}\n\n" printf "\n${BOLD}Setting up Linux${NORMAL}\n\n"
os_name="linux" $dotfiles_dir/linux/install
setup_zsh
setup_bash
use_shell bash use_shell bash
fi fi
if [[ $os_name != "" ]]; then
if [ -f .dotfiles/$os_name/env.platform ]; then
make_link .dotfiles/$os_name/env.platform .env.platform
fi
if [ -f .dotfiles/$os_name/gitconfig.platform ]; then
make_link .dotfiles/$os_name/gitconfig.platform .gitconfig.platform
fi
$dotfiles_dir/$os_name/install
fi
popd "$HOME" &>/dev/null popd "$HOME" &>/dev/null
printf "${BOLD}${GREEN}Done!${NORMAL}\n" printf "${BOLD}${GREEN}Done!${NORMAL}\n"

Some files were not shown because too many files have changed in this diff Show More