dotfiles

dotfiles
git clone git://git.wimdupont.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 54746a62827824ec3a05b3df9e387ab45f7a0312
parent d140d974b243a890f98f8bd6de91563fe8796e98
Author: Wim Dupont <wim@wimdupont.com>
Date:   Fri,  3 May 2024 18:19:16 +0200

added lfrc and gcc vim mappings

Diffstat:
Alfrc | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mvimrc | 3+++
2 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/lfrc b/lfrc @@ -0,0 +1,118 @@ +set shell sh +set shellopts '-eu' + +#set drawbox +set cursorpreviewfmt "\033[7m" + +# set internal field separator (IFS) to "\n" for shell commands +# This is useful to automatically split file names in $fs and $fx properly +# since default file separator used in these variables (i.e. 'filesep' option) +# is newline. You need to consider the values of these options and create your +# commands accordingly. +set ifs "\n" + +# Basic Settings +set ignorecase true + +cmd mkfile ${{ + printf "File Name: " + read ans + $EDITOR $ans +}} + +cmd setwallpaper ${{ + feh --bg-max "$f" +}} + +# extract the current file with the right command +# (xkcd link: https://xkcd.com/1168/) +cmd extract ${{ + set -f + case $f in + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$f";; + *.tar.gz|*.tgz) tar xzvf "$f";; + *.tar.xz|*.txz) tar xJvf "$f";; + *.tar) tar -xvf "$f";; + *.zip) unzip "$f";; + *.rar) unrar x "$f";; + *.7z) 7z x "$f";; + *.gz) gzip -dk "$f";; + *.gpg) gpg --decrypt-files "$f";; + esac +}} + +# compress current file or selected files with tar and gunzip +cmd tar ${{ + tar czf $(basename $fx).tar.gz $(basename $fx) +}} + +# define a custom 'open' command +# This command is called when current file is not a directory. You may want to +# use either file extensions and/or mime types here. Below uses an editor for +# text files and a file opener for the rest. +cmd open &{{ + case $(file --mime-type -Lb $f) in + text/*) lf -remote "send $id \$$EDITOR \$fx";; + *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; + esac +}} + +cmd edit-config ${{ + $EDITOR ~/.config/lf/lfrc + lf -remote "send $id source ~/.config/lf/lfrc" +}} + +cmd move-parent &{{ + dironly="setlocal '$(dirname "$PWD")' dironly" + lf -remote "send $id :updir; $dironly true; $1; $dironly false; open" +}} + +cmd create_access ${{ + ln -s $fx $HOME/access/ +}} + +# Bindings +map m + +map . set hidden! + +map J move-parent down +map K move-parent up + +map md push %mkdir<space> +map mf mkfile + +map bg setwallpaper + +# use enter for shell commands +map <enter> shell + +map D delete +map C edit-config + +# execute current file (must be executable) +map x $$f +map X !$f + +map aa create_access +map ax extract +map at tar +map ae $encr "$(basename $f)" +map ad $decr "$f" + +map ow $wine "$f" +map os $sh "$f" +map oa $mpv --no-video "$f" + +# dedicated keys for file opener actions +map O $xdg-open "$f" +map oo $xdg-open "$f" + +# Movement +map ga cd ~/access +map gc cd ~/.config +map gD cd ~/Desktop +map go cd ~/Downloads +map gp cd ~/pictures +map gr cd ~/repositories +map gb cd /usr/local/bin diff --git a/vimrc b/vimrc @@ -69,3 +69,6 @@ nnoremap <leader>c : call Clear_whitespace()<CR> vnoremap <leader>p "_dP cmap W w !sudo tee > /dev/null % + +map <F2> :w <CR> :!gcc % -o %< && ./%< <CR> +map <F3> :w <CR> :!gcc % -g -o %< && gdb ./%< <CR>