From d6b049972b0e525a262198b670879b097e767dba Mon Sep 17 00:00:00 2001 From: ziro Date: Tue, 20 Oct 2020 12:09:08 +0700 Subject: [PATCH] + Added TwiddleCase --- .config/vim/vim_nix | 4 ++-- .config/vim/vim_uni | 14 ++++++++++++++ .config/zsh/aliases | 3 +++ .scripts/resolution.sh | 7 ++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.config/vim/vim_nix b/.config/vim/vim_nix index 0db01ef..fb622ae 100644 --- a/.config/vim/vim_nix +++ b/.config/vim/vim_nix @@ -34,8 +34,8 @@ autocmd FileType sh map :w:vs:ter sh "%" autocmd FileType sh imap :w:vs:ter sh "%" " c (untested) -autocmd FileType c map :w:vs:ter gcc "%" -o %< && ./"%" && read -autocmd FileType c imap :w:vs:ter gcc "%" -o %< && ./"%" && read +autocmd FileType c map :w:vs:ter gcc "%" -o %< && ./%< && read +autocmd FileType c imap :w:vs:ter gcc "%" -o %< && ./%< && read " ----- Automatically Render PDF autocmd FileType plaintex command! -nargs=0 Lw w !pdflatex % > /dev/null diff --git a/.config/vim/vim_uni b/.config/vim/vim_uni index f98ca56..4f0ea4e 100644 --- a/.config/vim/vim_uni +++ b/.config/vim/vim_uni @@ -38,6 +38,19 @@ map gcc vmap gc imap gc +" TwiddleCase +function! TwiddleCase(str) + if a:str ==# toupper(a:str) + let result = tolower(a:str) + elseif a:str ==# tolower(a:str) + let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g') + else + let result = toupper(a:str) + endif + return result +endfunction +vnoremap ~ y:call setreg('', TwiddleCase(@"), getregtype(''))gv""Pgv + " ----- 'vim -b' = edit binary using xxd-format! augroup Binary au! @@ -52,6 +65,7 @@ augroup END " ----- python for vim autocmd BufEnter *.py set ai sw=4 ts=4 sta et fo=croql +autocmd BufEnter *.c set ai sw=4 ts=4 sta et fo=croql " ----- Auto refresh vimrc augroup myvimrc diff --git a/.config/zsh/aliases b/.config/zsh/aliases index c6d253a..34fe50a 100644 --- a/.config/zsh/aliases +++ b/.config/zsh/aliases @@ -7,6 +7,9 @@ alias doas='doas -- ' #sudo + vim, yea imagine having that powe- nvm alias sudovim='sudoedit' +#switch to pgsql user +alias pg='sudo -iu postgres' + #vim alias nano=nvim alias vim=nvim diff --git a/.scripts/resolution.sh b/.scripts/resolution.sh index 4f6e052..2d83cf0 100755 --- a/.scripts/resolution.sh +++ b/.scripts/resolution.sh @@ -5,8 +5,9 @@ choices="1366x768 chosen=$(echo -e "$choices" | rofi -dmenu -i -theme ~/.config/rofi/theme/sidebar) +[ -z "$chosen" ] && exit 0 + case "$chosen" in - 1366x768) xrandr --output VGA-1 --mode $chosen && notify-send "Resolution has been changed to" "$chosen";; - 1360x765) xrandr --output VGA-1 --mode 1360x765_60.00 && notify-send "Resolution has been changed to" "1360x765";; - 1280x720) xrandr --output VGA-1 --mode $chosen && notify-send "Resolution has been changed to" "$chosen";; + 1360x765) xrandr --output VGA1 --mode 1360x765_60.00 && notify-send "Resolution has been changed to" "1360x765";; + *) xrandr --output VGA1 --mode $chosen && notify-send "Resolution has been changed to" "$chosen";; esac