Compare commits
8 Commits
f70bc8b9cd
...
new-setup-
| Author | SHA1 | Date | |
|---|---|---|---|
| d19e60cfc3 | |||
| 0ee1e7666e | |||
| c7845e62d9 | |||
| 2a57ce8837 | |||
| a529cd6560 | |||
| 589abb9e46 | |||
| 6df4a1e506 | |||
| 10c6e8e06c |
@@ -189,7 +189,7 @@ alias ls='ls -F --color'
|
||||
alias l='ls -lh'
|
||||
alias ll='ls -lha'
|
||||
|
||||
alias aliases='vim ~/.dotfiles/aliases'
|
||||
alias aliases='vim ~/.aliases'
|
||||
alias al='aliases'
|
||||
|
||||
if [[ "${platform,,}" == *'ming'* ]]; then
|
||||
@@ -365,7 +365,7 @@ function my_transcribe_video() {
|
||||
# catches most words. Small and medium can do better word detection at
|
||||
# times, but suffer from bad punctuation. Medium is particularly bad and
|
||||
# not adding commas and periods.
|
||||
transcribe-video "$file" "$output" base tiny
|
||||
transcribe-video "$file" "$output" tiny base
|
||||
}
|
||||
|
||||
function my_transcribe_video_all_models() {
|
||||
@@ -511,15 +511,17 @@ download_youtube_playlist_list() {
|
||||
printf "${BOLD}Downloading Youtube playlist video list\n\n${NORMAL}"
|
||||
|
||||
local cmd="yt-dlp.exe --ignore-errors -O \"%(playlist_index)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 playlist video list\n${NORMAL}"
|
||||
}
|
||||
|
||||
download_youtube_uploads_list() {
|
||||
local url="$1"
|
||||
local output_name="$2"
|
||||
shift 2
|
||||
local include_descriptions="$1"
|
||||
|
||||
local url="$2"
|
||||
local output_name="$3"
|
||||
shift 3
|
||||
local opts="$@"
|
||||
|
||||
if [[ $url == "" || $output_name == "" ]]; then
|
||||
@@ -527,10 +529,17 @@ download_youtube_uploads_list() {
|
||||
return
|
||||
fi
|
||||
|
||||
printf "${BOLD}Downloading Youtube uploads list\n\n${NORMAL}"
|
||||
local cmd=""
|
||||
|
||||
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.
|
||||
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
|
||||
|
||||
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}"
|
||||
}
|
||||
@@ -918,7 +927,8 @@ download_from_m3u8() {
|
||||
#-------------------------------------------------
|
||||
# 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-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
|
||||
@@ -1126,7 +1136,7 @@ alias gaup='git add --update -p'
|
||||
alias gb='git branch -v'
|
||||
alias gbb='git bisect bad'
|
||||
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 gbl='git branch --all'
|
||||
alias gblm='git blame -wMC'
|
||||
@@ -1227,10 +1237,11 @@ alias gsp3='git stash pop stash@{3}'
|
||||
alias gsp4='git stash pop stash@{4}'
|
||||
alias gsp5='git stash pop stash@{6}'
|
||||
alias gsp6='git stash pop stash@{7}'
|
||||
alias gt='git tag -s' # Signed
|
||||
alias gt='git tag' # Unsigned
|
||||
alias gta='git tag -a'
|
||||
alias gtd='git tag -d'
|
||||
alias gtl='git tag -l'
|
||||
alias gts='git tag -s' # Signed
|
||||
alias gx='git reset --hard'
|
||||
alias gxx='git reset --hard HEAD~1'
|
||||
alias gxom='git reset --hard origin/master'
|
||||
@@ -13,16 +13,20 @@ esac
|
||||
export PLATFORM=$platform
|
||||
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.private" && . "$HOME/.env.private"
|
||||
test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post"
|
||||
|
||||
test -f "$HOME/.aliases" && . "$HOME/.aliases"
|
||||
test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common"
|
||||
test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private"
|
||||
|
||||
if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then
|
||||
test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH
|
||||
#TODO: remove this
|
||||
test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[include]
|
||||
path = ~/.gitconfig.platform
|
||||
path = ~/.gitconfig.private
|
||||
[init]
|
||||
defaultBranch = master
|
||||
@@ -7,11 +6,25 @@
|
||||
summary = true
|
||||
tool = vimdiff
|
||||
[core]
|
||||
excludesfile = ~/.gitignore
|
||||
excludesfile = ~/.gitignore.global
|
||||
hookspath = ~/.git_hooks
|
||||
preloadindex = true
|
||||
fscache = true
|
||||
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]
|
||||
default = upstream
|
||||
[pull]
|
||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -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
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "vim/bundle/Vundle.vim"]
|
||||
path = vim/bundle/Vundle.vim
|
||||
url = https://github.com/VundleVim/Vundle.vim.git
|
||||
0
vim/scripts/scmindent.rkt → .vim/scripts/scmindent.rkt
Executable file → Normal file
0
vim/scripts/scmindent.rkt → .vim/scripts/scmindent.rkt
Executable file → Normal file
@@ -271,3 +271,7 @@ memcpy
|
||||
strlen
|
||||
u8
|
||||
s64
|
||||
Sculpey
|
||||
grey
|
||||
googly
|
||||
favour
|
||||
BIN
.vim/spell/en.utf-8.add.spl
Normal file
BIN
.vim/spell/en.utf-8.add.spl
Normal file
Binary file not shown.
177
vimrc → .vimrc
177
vimrc → .vimrc
@@ -26,12 +26,12 @@ let s:uname = system("echo -n \"$(uname)\"")
|
||||
let g:vim_dir = $HOME . "/.vim"
|
||||
let mapleader=","
|
||||
|
||||
function! IsWindows()
|
||||
fu! IsWindows()
|
||||
if s:uname =~ "mingw" || s:uname =~ "msys"
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
if has('termguicolors')
|
||||
set termguicolors
|
||||
@@ -40,12 +40,12 @@ if has('termguicolors')
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
endif
|
||||
|
||||
function! PrintError(msg) abort
|
||||
fu! PrintError(msg) abort
|
||||
exec 'normal! \<Esc>'
|
||||
echohl ErrorMsg
|
||||
echomsg a:msg
|
||||
echohl None
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
|
||||
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
@@ -193,13 +193,13 @@ let g:campo_custom_ctags_args = ""
|
||||
" 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
|
||||
function! g:SetExtraCtagsPaths(paths_array)
|
||||
fu! g:SetExtraCtagsPaths(paths_array)
|
||||
let l:list = './tags,tags' " This is the default tags list set by vim.
|
||||
for path in a:paths_array
|
||||
let l:list .= ',' . path
|
||||
endfor
|
||||
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
|
||||
syntax on " Enable highlighting for syntax
|
||||
|
||||
let g:netrw_dirhistmax = 0 " Disable netrw
|
||||
|
||||
set wildmenu
|
||||
set wildmode=longest,list,full
|
||||
set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/*
|
||||
@@ -382,7 +384,8 @@ if executable('rg')
|
||||
set grepprg=rg\ --vimgrep\ --hidden " Requires ripgrep to be installed.
|
||||
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.
|
||||
|
||||
@@ -475,7 +478,7 @@ augroup campoCmds
|
||||
autocmd BufWritePost ~/.vimrc_templates.private silent! source $MYVIMRC
|
||||
|
||||
" Remove trailing whitespace when saving any file.
|
||||
function! StripTrailingWhitespaces()
|
||||
fu! StripTrailingWhitespaces()
|
||||
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
|
||||
@@ -570,7 +573,7 @@ augroup END
|
||||
" Suspend vim process and return to the shell. Can return to vim with `fg`.
|
||||
nnoremap <leader>z <c-z>
|
||||
|
||||
" edit a file
|
||||
" Edit a file
|
||||
nnoremap <leader>e :e
|
||||
|
||||
" 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>mm :split<cr>
|
||||
|
||||
" Forward delete and replace a word.
|
||||
noremap <leader>d ciw
|
||||
" Faster way to activate the 'a' register. This is useful for putting different
|
||||
" 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.
|
||||
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
|
||||
" 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.
|
||||
let l:lock_file = "ctags.lock"
|
||||
if filereadable(l:lock_file) || filereadable("newtags")
|
||||
@@ -711,54 +728,64 @@ endfun
|
||||
" 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
|
||||
" file using <leader>rv or whatever. :ReloadVimrcError
|
||||
function! WriteCurrentFileAndCreateCtags()
|
||||
fu! WriteCurrentFileAndCreateCtags()
|
||||
write!
|
||||
call CreateCtags()
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! WriteCurrentFileAndCreateCtagsThenQuit()
|
||||
fu! WriteCurrentFileAndCreateCtagsThenQuit()
|
||||
write!
|
||||
call CreateCtags()
|
||||
quit
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
" @fixme Sometimes a :wa that saves multiple files causes vim to hang and use a lot of CPU.
|
||||
function! WriteAllModifiedFilesAndCreateCtags()
|
||||
fu! WriteAllModifiedFilesAndCreateCtags()
|
||||
wall!
|
||||
call CreateCtags()
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
cnoreabbrev w :call WriteCurrentFileAndCreateCtags()
|
||||
cnoreabbrev W :call WriteCurrentFileAndCreateCtags()
|
||||
cnoreabbrev wa :call WriteAllModifiedFilesAndCreateCtags()
|
||||
cnoreabbrev Wa :call WriteAllModifiedFilesAndCreateCtags()
|
||||
cnoreabbrev WA :call WriteAllModifiedFilesAndCreateCtags()
|
||||
cnoreabbrev wq :call WriteCurrentFileAndCreateCtagsThenQuit()
|
||||
cnoreabbrev Wq :call WriteCurrentFileAndCreateCtagsThenQuit()
|
||||
cnoreabbrev WQ :call WriteCurrentFileAndCreateCtagsThenQuit()
|
||||
" Create a command abbreviation that only applies when it's at the beginning
|
||||
" of a ex command. If you were to do a normal cnoreabbrev or cabbrev then the
|
||||
" subsitution can happen anywhere in the command line. It was mostly affecting
|
||||
" my text search; I'd type '/w' and it would be replaced with the call to save
|
||||
" and create ctags.
|
||||
fu! Cabbrev(key, value)
|
||||
exe printf('cabbrev <expr> %s (getcmdtype() == ":" && getcmdpos() <= %d) ? %s : %s',
|
||||
\ 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>x :call WriteCurrentFileAndCreateCtagsThenQuit()<cr>
|
||||
nnoremap <leader>q :q<cr>
|
||||
|
||||
cnoreabbrev Q q
|
||||
cnoreabbrev Qa qa
|
||||
call Cabbrev('Q', 'q')
|
||||
call Cabbrev('Qa', 'qa')
|
||||
command! Qa qall
|
||||
" Disable Ex mode.
|
||||
noremap Q <Nop>
|
||||
|
||||
|
||||
"##################################################################################
|
||||
" MULTIPURPOSE TAB KEY
|
||||
"##################################################################################
|
||||
function! InsertTabWrapper()
|
||||
|
||||
fu! InsertTabWrapper()
|
||||
let l:col = col('.') - 1
|
||||
if !l:col || getline('.')[l:col - 1] !~ '\k'
|
||||
return "\<tab>"
|
||||
else
|
||||
return "\<c-p>"
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
|
||||
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
|
||||
" 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
|
||||
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.
|
||||
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 == ''
|
||||
call PrintError("g:campo_jai_path isn't set!")
|
||||
return
|
||||
@@ -879,7 +906,7 @@ function! CtrlP_JaiSearch(jai_rel_search_path)
|
||||
return
|
||||
endif
|
||||
call CtrlP_Search(l:path)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
" CtrlP File Searching
|
||||
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:rainbow_theme = g:campo_light_dark_mode
|
||||
|
||||
function! UpdateRainbowConf()
|
||||
fu! UpdateRainbowConf()
|
||||
let g:rainbow_conf = {
|
||||
\ 'ctermfgs': (s:rainbow_theme == "light"? s:dark_rainbow : s:light_rainbow)
|
||||
\}
|
||||
@@ -937,11 +964,11 @@ function! UpdateRainbowConf()
|
||||
"\ '*': 0, " Disable all
|
||||
"\ 'c++': {} " Only enable c++
|
||||
"\ }
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
call UpdateRainbowConf()
|
||||
|
||||
function! ReloadRainbow()
|
||||
fu! ReloadRainbow()
|
||||
if g:campo_theme_use_rainbow_parens
|
||||
if exists(':RainbowToggle')
|
||||
call UpdateRainbowConf()
|
||||
@@ -954,7 +981,7 @@ function! ReloadRainbow()
|
||||
call rainbow#clear()
|
||||
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
|
||||
|
||||
function! ToggleLightDarkTheme()
|
||||
fu! ToggleLightDarkTheme()
|
||||
if s:current_light_dark_mode == 'light'
|
||||
call ChangeLightDarkMode('dark', 0)
|
||||
else
|
||||
call ChangeLightDarkMode('light', 0)
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! ChangeLightDarkMode(mode, onlySetTheme)
|
||||
fu! ChangeLightDarkMode(mode, onlySetTheme)
|
||||
if a:mode == 'light'
|
||||
let s:rainbow_theme = 'light'
|
||||
let s:theme = g:campo_light_theme
|
||||
@@ -1005,7 +1032,7 @@ function! ChangeLightDarkMode(mode, onlySetTheme)
|
||||
if !a:onlySetTheme
|
||||
exec 'AirlineTheme' a:mode
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
" Set the intial light/dark mode.
|
||||
if g:campo_light_dark_mode =~ 'light'
|
||||
@@ -1015,14 +1042,14 @@ else
|
||||
endif
|
||||
|
||||
" Open the current color scheme for editing.
|
||||
function! EditColorScheme()
|
||||
fu! EditColorScheme()
|
||||
let l:path = g:vim_dir . '/colors/' . s:theme . '.vim'
|
||||
if filereadable(l:path)
|
||||
execute 'vsplit ' . l:path
|
||||
else
|
||||
call PrintError("Failed to open " . l:path . " for editing.")
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
command -nargs=0 EditColorScheme call EditColorScheme()
|
||||
|
||||
@@ -1106,10 +1133,10 @@ let errormarker_warninggroup = "BuildWarn"
|
||||
let errormarker_infogroup = "BuildInfo"
|
||||
|
||||
" 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
|
||||
ErrorAtCursor
|
||||
endfunction
|
||||
endfu
|
||||
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
|
||||
" entries have a type, line num, error message, etc.
|
||||
|
||||
function! ShowErrorEntries()
|
||||
fu! ShowErrorEntries()
|
||||
" Prints out valid quickfix errors.
|
||||
redraw!
|
||||
for l:d in getqflist()
|
||||
@@ -1128,7 +1155,7 @@ function! ShowErrorEntries()
|
||||
echomsg l:d
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
endfu
|
||||
command -nargs=0 ShowErrorEntries call ShowErrorEntries()
|
||||
|
||||
" Jai
|
||||
@@ -1162,25 +1189,25 @@ set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
||||
" BUILD FUNCTIONS
|
||||
"/////////////////////////////////////////////////
|
||||
|
||||
function! HideBuildResultsAndClearErrors()
|
||||
fu! HideBuildResultsAndClearErrors()
|
||||
RemoveErrorMarkers
|
||||
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! HideAsyncResults()
|
||||
fu! HideAsyncResults()
|
||||
call asyncrun#quickfix_toggle(g:quickfix_pane_height, 0)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! ToggleBuildResults()
|
||||
fu! ToggleBuildResults()
|
||||
call asyncrun#quickfix_toggle(g:quickfix_pane_height)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! StopRunTask()
|
||||
fu! StopRunTask()
|
||||
AsyncStop
|
||||
call HideAsyncResults()
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! Build(optimized=0, silent=0)
|
||||
fu! Build(optimized=0, silent=0)
|
||||
let l:async_cmd = "AsyncRun! "
|
||||
if a:silent
|
||||
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.
|
||||
call WriteAllModifiedFilesAndCreateCtags()
|
||||
exec l:async_cmd . l:cmd
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! RunProgram()
|
||||
fu! RunProgram()
|
||||
let l:ran = 0
|
||||
let l:ext = tolower(expand('%:e'))
|
||||
let l:path_to_use = ""
|
||||
@@ -1329,7 +1356,7 @@ function! RunProgram()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
" Show results window the moment the async job starts
|
||||
augroup asyncPluginCmds
|
||||
@@ -1371,7 +1398,7 @@ nnoremap <C-p> :cp<CR>
|
||||
"##################################################################################
|
||||
|
||||
" 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:term = input(l:helper)
|
||||
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:cmd = printf(l:format, shellescape(l:escaped_term))
|
||||
exec l:cmd
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! SearchExt(path, search_args, case_insensitive=0)
|
||||
fu! SearchExt(path, search_args, case_insensitive=0)
|
||||
call inputsave()
|
||||
let l:ext = input('Enter extension to search on (leave blank for files with no ext): ')
|
||||
call inputrestore()
|
||||
@@ -1409,7 +1436,7 @@ function! SearchExt(path, search_args, case_insensitive=0)
|
||||
let l:args = a:search_args." -g \"".l:ext."\""
|
||||
|
||||
call Search(a:path, l:args, a:case_insensitive)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
"/////////////////////////////////////////////////
|
||||
" 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.
|
||||
" 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')
|
||||
call inputsave()
|
||||
if a:confirm_replacement
|
||||
@@ -1538,7 +1565,7 @@ function! GlobalReplaceIt(confirm_replacement) range
|
||||
else
|
||||
call PrintError("Unable to search since you're not in a git repo!")
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
noremap <leader>r :call GlobalReplaceIt(0)<cr>
|
||||
noremap <leader>rr :call GlobalReplaceIt(1)<cr>
|
||||
|
||||
@@ -1547,7 +1574,7 @@ noremap <leader>rr :call GlobalReplaceIt(1)<cr>
|
||||
" RENAME CURRENT FILE
|
||||
"##################################################################################
|
||||
|
||||
function! RenameFile()
|
||||
fu! 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
|
||||
@@ -1558,7 +1585,7 @@ function! RenameFile()
|
||||
redraw!
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
noremap <leader>n :call RenameFile()<cr>
|
||||
|
||||
|
||||
@@ -1566,19 +1593,19 @@ noremap <leader>n :call RenameFile()<cr>
|
||||
" CENTER THE BUFFER
|
||||
"##################################################################################
|
||||
|
||||
function! CenterPane()
|
||||
fu! CenterPane()
|
||||
" Centers the current pane as the middle 2 of 4 imaginary columns should
|
||||
" be called in a window with a single pane.
|
||||
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
|
||||
lefta vnew
|
||||
wincmd w
|
||||
exec 'vertical resize' string(&columns * 0.65)
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
function! RemoveCenterPane()
|
||||
fu! RemoveCenterPane()
|
||||
wincmd w
|
||||
close
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
nnoremap <leader>cc :call CenterPane()<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
|
||||
" 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,
|
||||
" 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
|
||||
@@ -1617,7 +1644,7 @@ function! ToggleSimpleView()
|
||||
setlocal list
|
||||
exec 'GitGutterBufferEnable'
|
||||
endif
|
||||
endfunction
|
||||
endfu
|
||||
|
||||
nnoremap <leader>c :call ToggleSimpleView()<cr>
|
||||
|
||||
11
README.md
11
README.md
@@ -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.
|
||||
|
||||
16
bin/vim-pull
16
bin/vim-pull
@@ -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
|
||||
16
bin/vim-push
16
bin/vim-push
@@ -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
32
dotfiles/README.md
Normal 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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source "$HOME/.dotfiles/script_helpers/all.sh"
|
||||
source "$HOME/dotfiles/script_helpers/all.sh"
|
||||
|
||||
cwd=$PWD
|
||||
source_path=""
|
||||
@@ -71,16 +71,24 @@ fi
|
||||
|
||||
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_path="$(dirname $whisper_fullname)"
|
||||
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=$?
|
||||
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
|
||||
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
|
||||
@@ -29,7 +29,7 @@ shift 2
|
||||
models=("$@")
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
@@ -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.
|
||||
|
||||
source "$HOME/.dotfiles/script_helpers/printing.sh"
|
||||
source "$HOME/.dotfiles/script_helpers/platform.sh"
|
||||
source "$HOME/dotfiles/script_helpers/printing.sh"
|
||||
source "$HOME/dotfiles/script_helpers/platform.sh"
|
||||
|
||||
set -e
|
||||
|
||||
89
install → dotfiles/install
Executable file → Normal file
89
install → dotfiles/install
Executable file → Normal file
@@ -4,7 +4,7 @@ if [[ $(uname) == 'Darwin' ]]; then
|
||||
if ! command -v brew &>/dev/null
|
||||
then
|
||||
# We need to update bash, so we'll start with setting up homebrew.
|
||||
./osx/pre_install
|
||||
./macos/pre_install
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
@@ -52,31 +52,6 @@ setup_zsh() {
|
||||
if [[ $is_linux -eq 1 ]]; then
|
||||
sudo apt install zsh
|
||||
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
|
||||
|
||||
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
|
||||
git_comp_filename=".git-completion.bash"
|
||||
printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n"
|
||||
@@ -129,37 +70,19 @@ set -e
|
||||
# Setup platform files
|
||||
#########################
|
||||
|
||||
if [[ $is_windows -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
|
||||
if [[ $is_macos -eq 1 ]]; then
|
||||
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_bash
|
||||
use_shell zsh
|
||||
|
||||
elif [[ $is_linux -eq 1 ]]; then
|
||||
printf "\n${BOLD}Setting up Linux${NORMAL}\n\n"
|
||||
os_name="linux"
|
||||
setup_zsh
|
||||
setup_bash
|
||||
$dotfiles_dir/linux/install
|
||||
use_shell bash
|
||||
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
|
||||
|
||||
printf "${BOLD}${GREEN}Done!${NORMAL}\n"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user