From 9c03aadf1f5d6f1e51cdcafde007acbadb507f74 Mon Sep 17 00:00:00 2001 From: mitsuo Date: Tue, 19 Oct 2021 23:21:36 -0500 Subject: Add gt (Go TitleCase) mapping in Vim - bashrc: Remove Conda shit (messed with my printer and scanner! (hplip(1)) - bash_aliases: - Add some Env. Var. like LINDO - Add mpv_nhk - Add youtube-dl_fast - Add "path shorcut" to java8 --- bash_aliases | 36 +++++++++++++++++++++++++----------- bashrc | 18 ++++++++++++++++++ fun.vim | 23 +++++++++++++++++++---- vimrc | 12 ++++++++++-- 4 files changed, 72 insertions(+), 17 deletions(-) diff --git a/bash_aliases b/bash_aliases index a6cacab..1456c94 100644 --- a/bash_aliases +++ b/bash_aliases @@ -18,34 +18,48 @@ alias lla='ll -A' alias ls='ls --color=auto --group-directories-first --classify' #alias less='less -Ri' # make less's searches case insensitive and # colorized -LESS=Ri # TODO move to an appropiate place + +# TODO move to an appropiate place: +LESS="-i --RAW-CONTROL-CHARS"; +export LESS + +LINDOAPI_HOME=/home/mitsuo/code/LINDO/lindoapi +export LINDOAPI_HOME +LINDOAPI_LICENSE_FILE="$LINDOAPI_HOME/license/lndapi130.lic" +export LINDOAPI_LICENSE_FILE alias gcc='gcc -g -std=c99 -lm' alias ed='ed -p "* "' alias diff='diff -s' + +# Precautionary +alias rm='rm -I' # Promt before removing more than 3 files +alias mv='mv -i' # Promt before overwrite +alias cp='cp -i' # same + + # Other program's options # ====================================================================== + #alias feh='feh -g 640x480 -S filename' # opens files sorted by filename alias feh='feh -g 640x480 --auto-zoom --scale-down --on-last-slide hold' alias feht='feh -Tthumb_s' alias fehfx='feh -Tfs --slideshow-delay' alias fehfrx='feh -Tfs --recursive --slideshow-delay' alias units='units --verbose' - - -# Precautionary -# ====================================================================== -alias rm='rm -I' # Promt before removing more than 3 files -alias mv='mv -i' # Promt before overwrite -alias cp='cp -i' # same - +alias tty-clock='tty-clock -cs' # Quick tools -# ====================================================================== alias pdfreduce='gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook' alias youtube-dl_info='youtube-dl --get-filename --get-format --get-duration --get-description' -alias youtube-dl_fast='youtube-dl --format "best[height<=720]" -o '\''%(title)s.%(ext)s'\' +alias youtube-dl_fast='youtube-dl --format "best[height<=720][fps<=?30]" -o '\''%(title)s.%(ext)s'\' alias mpv_webcam='mpv av://v4l2:/dev/video0' # retrived from the Archwiki +alias mpv_nhk_720p='mpv "https://nhkwlive-ojp.akamaized.net/hls/live/2003459/nhkwlive-ojp-en/index_4M.m3u8"' +alias scan_dpto_europa='hp-scan --mode=color --device=hpaio:/net/OfficeJet_Pro_6970?ip=192.168.0.7' +#alias java8='~/code/openjdk8/jdk8u265-b01/bin/java' +#alias javac8='~/code/openjdk8/jdk8u265-b01/bin/javac' +alias inf265_jupyterlab='cd "/home/mitsuo/docs/courses/2021-1/INF265"; \ + jupyter lab' # Cosmetic diff --git a/bashrc b/bashrc index d6b7d97..58a2cd3 100644 --- a/bashrc +++ b/bashrc @@ -61,6 +61,7 @@ if [ "$color_prompt" = yes ]; then # Blue timestamp and italic green pwd PS1='\[\033[34m\]|\D{%H:%M:%S}| \[\033[3;32m\][\w]\[\033[00m\]\n\$ ' else + # plain and simple PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt @@ -134,3 +135,20 @@ cowsay $(fortune 30% debian-hints 20% linux 20% science \ # Some environmental variables. export TLDR_CONFIG_DIR="$XDG_CONFIG_HOME" export GPG=TTY=$(tty) + +# Disable this shit that broke many things in my system ( RIP hplip :( ) +## >>> conda initialize >>> +## !! Contents within this block are managed by 'conda init' !! +#__conda_setup="$('/home/mitsuo/code/Anaconda/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +#if [ $? -eq 0 ]; then +# eval "$__conda_setup" +#else +# if [ -f "/home/mitsuo/code/Anaconda/anaconda3/etc/profile.d/conda.sh" ]; then +# . "/home/mitsuo/code/Anaconda/anaconda3/etc/profile.d/conda.sh" +# else +# export PATH="/home/mitsuo/code/Anaconda/anaconda3/bin:$PATH" +# fi +#fi +#unset __conda_setup +## <<< conda initialize <<< + diff --git a/fun.vim b/fun.vim index b184d4c..0dbfe11 100644 --- a/fun.vim +++ b/fun.vim @@ -32,13 +32,14 @@ command LongestLineLength call LongestLineLength() function! Md2Pdf ( ) exe ":w" - exe ":! pandoc -o " . expand("%:r") . ".pdf -t latex -N --variable classoption=twosides --variable papersize=a4 --variable margin-left=1in --variable margin-right=1in --variable margin-top=1in --variable margin-bottom=1in --variable links-as-notes --variable colorlinks --variable pagestyle=plain --variable documentclass=article " . expand("%") - echo "pdf saved as " . expand("%:p:r") . ".pdf" + "-N for numbered headers + exe ":! pandoc -o \"" . expand("%:r") . ".pdf\" -t latex --variable classoption=twosides --variable papersize=a4 --variable margin-left=1in --variable margin-right=1in --variable margin-top=1in --variable margin-bottom=1in --variable links-as-notes --variable colorlinks --variable pagestyle=plain --variable documentclass=article -f markdown-implicit_figures \"" . expand("%") . "\"" + echo "pdf saved as \"" . expand("%:p:r") . ".pdf\"" endfunction function! Md2Pdfms ( ) exe ":w" - exe ":! pandoc -o " . expand("%:r") . ".pdf" . " -t ms -N " . expand("%") + exe ":! pandoc -o " . expand("%:r") . ".pdf" . " -t ms -f markdown-implicit_figures \"" . expand("%") . "\"" echo "pdf saved as " . expand("%:p:r") . ".pdf" endfunction @@ -50,7 +51,7 @@ command Md2Pdfms call Md2Pdfms() function! Md2Html ( ) exe ":w" - exe ":! pandoc -o " . expand("%:r") . ".html" . " -s -N " . expand("%") + exe ":! pandoc -o \"" . expand("%:r") . ".html\"" . " -s \"" . expand("%") . "\"" echo "html saved as " . expand("%:p:r") . ".html" endfunction @@ -66,3 +67,17 @@ function! CompRunProj ( ) endfunction command CompRunProj call CompRunProj() + + +" Function made to give feedback to students code in 1INF01 + +" export C code to syntax highlighted pdf +function! C2Pdf ( ) + exe ":set ts=4" + exe ":w" + exe ":ha > %.ps" + exe ":!ps2pdf %.ps" + exe ":!rm %.ps" +endfunction + +command C2Pdf call C2Pdf() diff --git a/vimrc b/vimrc index 3fbd118..08a8eee 100644 --- a/vimrc +++ b/vimrc @@ -143,9 +143,13 @@ map :source ~/.vim/vimrc map :e ~/.vim/vimrc map :tabp map :tabn -map :w:!./make.sh +map :w:make +"map :!./%:r +map :!./a.out +map :cnext +map :cprev " One has to do :E first in order for this to work -map :Rex +"map :Rex " = '\' when 'mapleader' is empty " Change to the directory of the current file and generate tags recursively " there. @@ -164,6 +168,10 @@ nmap j nmap k nmap l +" Go Title Case (and clear highlighted matches) +" Ref.: vim.fandom.com +vmap gt :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g + " Yanking and pasting " ---------------------------------------------------------------------- -- cgit v1.2.3