Compare commits
2 Commits
45d3fa244a
...
9371817937
Author | SHA1 | Date | |
---|---|---|---|
9371817937 | |||
8eccc9659a |
26
aliases
26
aliases
|
@ -130,37 +130,37 @@ open_explorer_here() {
|
||||||
|
|
||||||
# Dev build
|
# Dev build
|
||||||
b() {
|
b() {
|
||||||
if [ -f build ]; then ./build $@ ; else test -f build.sh && ./build.sh $@ ; fi
|
test -f build && ./build $@ ; test -f build.sh && ./build.sh $@ ; test -f build.jai && ./build.jai $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# fast dev build
|
# fast dev build
|
||||||
bf() {
|
bf() {
|
||||||
if [ -f build ]; then ./build $@ -fast ; else test -f build.sh && ./build.sh $@ -fast ; fi
|
test -f build && ./build $@ -fast ; test -f build.sh && ./build.sh $@ -fast ; test -f build.jai && ./build.jai $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optimized dev build
|
# Optimized dev build
|
||||||
bb() {
|
bb() {
|
||||||
if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi
|
test -f build && ./build $@ -o 1 ; test -f build.sh && ./build.sh $@ -o 1 ; test -f build.jai && ./build.jai -release $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Production build
|
# Production build
|
||||||
bp() {
|
bp() {
|
||||||
if [ -f build ]; then ./build -p p $@ ; else test -f build.sh && ./build.sh -p p $@ ; fi
|
test -f build && ./build $@ -p p ; test -f build.sh && ./build.sh $@ -p p ; test -f build.jai && ./build.jai -release $@ - -prod
|
||||||
}
|
}
|
||||||
|
|
||||||
# Profiling build
|
# Profiling build
|
||||||
bpf() {
|
bpf() {
|
||||||
if [ -f build ]; then ./build -p pf $@ ; else test -f build.sh && ./build.sh -p pf $@ ; fi
|
test -f build && ./build $@ -p pf ; test -f build.sh && ./build.sh $@ -p pf
|
||||||
}
|
}
|
||||||
|
|
||||||
# GPU profiling build
|
# GPU profiling build
|
||||||
bgpf() {
|
bgpf() {
|
||||||
if [ -f build ]; then ./build -p gpu $@ ; else test -f build.sh && ./build.sh -p gpu $@ ; fi
|
test -f build && ./build $@ -p gpu ; test -f build.sh && ./build.sh $@ -p gpu
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run build
|
# Run build
|
||||||
r() {
|
r() {
|
||||||
if [ -f run ]; then ./run $@ ; else test -f run.sh && ./run.sh $@ ; fi
|
test -f run && ./run $@ ; test -f run.sh && ./run.sh $@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build then run
|
# Build then run
|
||||||
|
@ -602,8 +602,8 @@ dl_twitch_vid() {
|
||||||
if [[ $error -eq 0 ]]; then
|
if [[ $error -eq 0 ]]; then
|
||||||
if [[ $compress -eq 1 ]]; then
|
if [[ $compress -eq 1 ]]; then
|
||||||
local temp_name="temp_${RANDOM}"
|
local temp_name="temp_${RANDOM}"
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video 0 "$filename" "$temp_name"
|
compress-video "$filename" "$temp_name" 0
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
mv "$filename" "orig_$filename"
|
mv "$filename" "orig_$filename"
|
||||||
mv $temp_name.$extension "$filename"
|
mv $temp_name.$extension "$filename"
|
||||||
|
@ -665,8 +665,8 @@ dl_vimeo_vid() {
|
||||||
if [[ $error -eq 0 ]]; then
|
if [[ $error -eq 0 ]]; then
|
||||||
if [[ $compress -eq 1 ]]; then
|
if [[ $compress -eq 1 ]]; then
|
||||||
local temp_name="temp_${RANDOM}"
|
local temp_name="temp_${RANDOM}"
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video 1 "$filename" "$temp_name"
|
compress-video "$filename" "$temp_name" 0
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
mv "$filename" "orig_$filename"
|
mv "$filename" "orig_$filename"
|
||||||
mv $temp_name.$extension "$filename"
|
mv $temp_name.$extension "$filename"
|
||||||
|
@ -878,8 +878,8 @@ function _compress_video_hard() {
|
||||||
error "Format: cmd <source> <dest>\n"
|
error "Format: cmd <source> <dest>\n"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
# 1 arg = use GPU
|
# 0=cpu, 1=gpu
|
||||||
compress-video-with-crf 1 $crf "$name" "$out"
|
compress-video-with-crf $crf "$name" "$out" 0
|
||||||
}
|
}
|
||||||
|
|
||||||
alias compress-video-hard='_compress_video_hard'
|
alias compress-video-hard='_compress_video_hard'
|
||||||
|
|
122
vimrc
122
vimrc
|
@ -411,7 +411,7 @@ augroup campoCmds
|
||||||
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
|
||||||
" Properly indent schemes (scheme, racket, etc).
|
" Properly indent schemes (scheme, racket, etc).
|
||||||
autocmd BufRead,BufNewFile *.{lisp,scm,rkt} setlocal equalprg=scmindent.rkt
|
autocmd BufRead,BufNewFile *.{lisp,scm,rkt} setlocal equalprg=scmindent.vim.rkt
|
||||||
|
|
||||||
" Elixir indent
|
" Elixir indent
|
||||||
autocmd FileType elixir setlocal tabstop=2 | setlocal shiftwidth=2 | setlocal softtabstop=2
|
autocmd FileType elixir setlocal tabstop=2 | setlocal shiftwidth=2 | setlocal softtabstop=2
|
||||||
|
@ -615,6 +615,9 @@ imap jj <Esc>
|
||||||
" 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
|
||||||
|
nnoremap <leader>e :e
|
||||||
|
|
||||||
" Open the vimrc file for editing / reload vimrc file.
|
" Open the vimrc file for editing / reload vimrc file.
|
||||||
nnoremap <silent> <leader>ev :vsp $MYVIMRC<cr>
|
nnoremap <silent> <leader>ev :vsp $MYVIMRC<cr>
|
||||||
nnoremap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
|
nnoremap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
|
||||||
|
@ -732,7 +735,7 @@ noremap Q <Nop>
|
||||||
" Open a terminal within vim. Use `exit` to close it.
|
" Open a terminal within vim. Use `exit` to close it.
|
||||||
if exists(':terminal')
|
if exists(':terminal')
|
||||||
noremap <leader>t :terminal<cr>
|
noremap <leader>t :terminal<cr>
|
||||||
tnoremap <leader>e <C-\><C-n>
|
tnoremap <leader>te <C-\><C-n>
|
||||||
tnoremap <A-h> <C-\><C-n><C-w>h
|
tnoremap <A-h> <C-\><C-n><C-w>h
|
||||||
tnoremap <A-j> <C-\><C-n><C-w>j
|
tnoremap <A-j> <C-\><C-n><C-w>j
|
||||||
tnoremap <A-k> <C-\><C-n><C-w>k
|
tnoremap <A-k> <C-\><C-n><C-w>k
|
||||||
|
@ -1305,48 +1308,56 @@ function! StopRunTask()
|
||||||
call HideAsyncResults()
|
call HideAsyncResults()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! Build(optimized=0)
|
function! Build(optimized=0, silent=0)
|
||||||
let l:params = ""
|
|
||||||
let l:ext = tolower(expand('%:e'))
|
let l:ext = tolower(expand('%:e'))
|
||||||
if l:ext == "jai"
|
let l:parent_dir = expand('%:p:h')
|
||||||
" Jai build
|
let l:async_cmd = "AsyncRun! -save=2 "
|
||||||
|
if a:silent
|
||||||
|
let l:async_cmd .= "-post=call\\ HideAsyncResults() "
|
||||||
|
endif
|
||||||
|
let l:cmd = ""
|
||||||
|
if filereadable(l:parent_dir . "/build.jai")
|
||||||
|
" Jai build file
|
||||||
|
let l:cmd = "jai " . l:parent_dir . "/build.jai "
|
||||||
|
if a:optimized == 1
|
||||||
|
echo "Compiling release build.jai"
|
||||||
|
let l:cmd .= "-release "
|
||||||
|
else
|
||||||
|
echo "Compiling debug build.jai"
|
||||||
|
endif
|
||||||
|
elseif l:ext == "jai"
|
||||||
let l:cmd = "jai % "
|
let l:cmd = "jai % "
|
||||||
if a:optimized == 1
|
if a:optimized == 1
|
||||||
|
echo "Compiling release " . expand('%:t')
|
||||||
let l:cmd .= "-release "
|
let l:cmd .= "-release "
|
||||||
|
else
|
||||||
|
echo "Compiling debug " . expand('%:t')
|
||||||
endif
|
endif
|
||||||
" If there's a local modules/ directory then we'll import it.
|
" If there's a local modules/ directory then we'll import it.
|
||||||
if isdirectory(expand('%:p:h') . "/modules")
|
if isdirectory(l:parent_dir . "/modules")
|
||||||
let l:cmd .= "-import_dir modules "
|
let l:cmd .= "-import_dir modules "
|
||||||
endif
|
endif
|
||||||
exec "AsyncRun! -save=2 " . l:cmd
|
|
||||||
else
|
else
|
||||||
|
let l:cmd .= './build* '
|
||||||
if a:optimized == 1
|
if a:optimized == 1
|
||||||
let l:params .= '-o '
|
let l:cmd .= '-o '
|
||||||
endif
|
endif
|
||||||
exec "AsyncRun! -save=2 ./build* " . l:params
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! SilentBuild(optimized=0)
|
|
||||||
AsyncStop
|
|
||||||
let l:params = ''
|
|
||||||
let l:extension = tolower(expand('%:e'))
|
|
||||||
if l:extension == "jai"
|
|
||||||
if a:optimized == 1
|
|
||||||
let l:params .= '-release '
|
|
||||||
endif
|
|
||||||
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() jai % " . l:params
|
|
||||||
else
|
|
||||||
if a:optimized == 1
|
|
||||||
let l:params .= '-o '
|
|
||||||
endif
|
|
||||||
exec "AsyncRun! -save=2 -post=call\\ HideAsyncResults() ./build* " . l:params
|
|
||||||
endif
|
endif
|
||||||
|
exec l:async_cmd . l:cmd
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! RunExe()
|
function! RunExe()
|
||||||
if tolower(expand('%:e')) == "jai"
|
if tolower(expand('%:e')) == "jai"
|
||||||
exec "AsyncRun! " . expand('%:p:r') . ".exe"
|
if filereadable(expand('%:p:r') . '.exe')
|
||||||
|
exec "AsyncRun! " . expand('%:p:r') . ".exe"
|
||||||
|
else
|
||||||
|
let l:files = systemlist('ls ' . expand('%:p:h') . '/*.exe 2>/dev/null')
|
||||||
|
if len(l:files) > 0
|
||||||
|
exec "AsyncRun! " . l:files[0]
|
||||||
|
else
|
||||||
|
call PrintError("No exe found. Compile first?")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
exec "AsyncRun! -post=call\\ StopRunTask() ./run %"
|
exec "AsyncRun! -post=call\\ StopRunTask() ./run %"
|
||||||
endif
|
endif
|
||||||
|
@ -1359,22 +1370,22 @@ augroup asyncPluginCmds
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Toggle build results
|
" Toggle build results
|
||||||
noremap <F11> :call ToggleBuildResults()<cr>
|
|
||||||
nnoremap <leader>bc :call ToggleBuildResults()<cr>
|
nnoremap <leader>bc :call ToggleBuildResults()<cr>
|
||||||
|
noremap <F11> :call ToggleBuildResults()<cr>
|
||||||
" Hide build results and clear errors
|
" Hide build results and clear errors
|
||||||
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
|
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
|
||||||
|
|
||||||
" Execute build script
|
" Execute build script and keep results.
|
||||||
nnoremap <leader>b :call Build(0)<cr>
|
nnoremap <silent><leader>b :call Build(0)<cr>
|
||||||
nnoremap <F8> :call SilentBuild(0)<cr>
|
" Execute build and hide results.
|
||||||
|
nnoremap <silent><F8> :call Build(0, 1)<cr>
|
||||||
|
|
||||||
" Execute optimized build script
|
" Execute optimized build script
|
||||||
nnoremap <leader>bb :call Build(1)<cr>
|
nnoremap <leader>bb :call Build(1)<cr>
|
||||||
|
|
||||||
" Execute run script
|
" Execute run script
|
||||||
nnoremap <leader>br :call RunExe()<cr>
|
nnoremap <silent><leader>br :call RunExe()<cr>
|
||||||
nnoremap <F9> :call RunExe()<cr>
|
nnoremap <silent><F9> :call RunExe()<cr>
|
||||||
|
|
||||||
nnoremap <leader>bs :AsyncStop<cr>
|
nnoremap <leader>bs :AsyncStop<cr>
|
||||||
|
|
||||||
|
@ -1410,17 +1421,35 @@ function! Search(path, search_args, case_insensitive=0)
|
||||||
exec 'Rg ' . l:rg_args . ' -e "' . l:term . '"' . ' ' . a:path
|
exec 'Rg ' . l:rg_args . ' -e "' . l:term . '"' . ' ' . a:path
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Case insensitive
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Search in current directory.
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Case insensitive:
|
||||||
noremap <leader>s :call Search('.', g:campo_custom_search_args, 1)<cr>
|
noremap <leader>s :call Search('.', g:campo_custom_search_args, 1)<cr>
|
||||||
noremap <F2> :call Search('.', g:campo_custom_search_args, 1)<cr>
|
" Case sensitive:
|
||||||
" Jai search
|
|
||||||
noremap <leader>sm :call Search(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
|
||||||
|
|
||||||
" Case sensitive
|
|
||||||
noremap <leader>ss :call Search('.', g:campo_custom_search_args)<cr>
|
noremap <leader>ss :call Search('.', g:campo_custom_search_args)<cr>
|
||||||
noremap <F3> :call Search('.', g:campo_custom_search_args)<cr>
|
|
||||||
" Jai module search
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
noremap <leader>ssm :call Search(g:campo_jai_path, g:campo_custom_search_args)<cr>
|
" # Search in directory containing the active file.
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Case insensitive:
|
||||||
|
noremap <leader>sf :call Search(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||||
|
" Case sensitive:
|
||||||
|
noremap <leader>ssf :call Search(expand('%:p:h'), g:campo_custom_search_args)<cr>
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Search in Jai folders
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Case insensitive:
|
||||||
|
noremap <leader>sg :call Search(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||||
|
noremap <leader>sm :call Search(g:campo_jai_path . '/modules', g:campo_custom_search_args, 1)<cr>
|
||||||
|
noremap <leader>sh :call Search(g:campo_jai_path . '/how_to', g:campo_custom_search_args, 1)<cr>
|
||||||
|
noremap <leader>se :call Search(g:campo_jai_path . '/examples', g:campo_custom_search_args, 1)<cr>
|
||||||
|
" Case sensitive:
|
||||||
|
noremap <leader>ssg :call Search(g:campo_jai_path, g:campo_custom_search_args)<cr>
|
||||||
|
noremap <leader>ssm :call Search(g:campo_jai_path . '/modules', g:campo_custom_search_args)<cr>
|
||||||
|
noremap <leader>ssh :call Search(g:campo_jai_path . '/how_to', g:campo_custom_search_args)<cr>
|
||||||
|
noremap <leader>sse :call Search(g:campo_jai_path . '/examples', g:campo_custom_search_args)<cr>
|
||||||
|
|
||||||
" Navigation for the vim-ripgrep search results.
|
" Navigation for the vim-ripgrep search results.
|
||||||
" Hit o on a result line to open the file at that line.
|
" Hit o on a result line to open the file at that line.
|
||||||
|
@ -1432,6 +1461,11 @@ nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
|
||||||
" SEARCH & REPLACE
|
" SEARCH & REPLACE
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" @warning I've stopped using this because it sometimes locks up vim and I
|
||||||
|
" have to force exit the process then clean up the swap files.
|
||||||
|
" @improve Figure out what's causing vim to freeze and fix it. Seems to happen
|
||||||
|
" when it quickly changes and saves a handful of buffers.
|
||||||
|
|
||||||
" 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
|
function! GlobalReplaceIt(confirm_replacement) range
|
||||||
|
|
Loading…
Reference in New Issue
Block a user