cleanup: global files cleanup

+ update LICENSE declaration in .config/nvim/after/ftplugin
+ remove vim.vim filetype settings
+ change mapping for buffer switch in neovim
This commit is contained in:
swy7ch 2020-05-20 17:03:00 +02:00 committed by swytch
parent 31981c9631
commit 30f254f6c3
25 changed files with 84 additions and 94 deletions

View File

@ -1,5 +1,5 @@
" groff filetype config " groff filetype config
" Licence LGPL v3.0 " Licence GPLv3
inoremap <buffer> à \[`a] inoremap <buffer> à \[`a]
inoremap <buffer> 'A \[`A] inoremap <buffer> 'A \[`A]

View File

@ -1,5 +1,5 @@
" python filetype config " python filetype config
" LGPL v3.0 Licence " Licence GPLv3
" proper PEP 8 indentation " proper PEP 8 indentation
set tabstop=4 set tabstop=4

View File

@ -1,5 +1,5 @@
" tex filetype config " tex filetype config
" Licence LGPL v3.0 " Licence GPL3
" spellcheck enabled " spellcheck enabled
setlocal spell spelllang=fr setlocal spell spelllang=fr

View File

@ -1,4 +1,4 @@
" vim filetype config " vim filetype config
" Licence LGPL v3.0 " Licence GPL3
setlocal spell spelllang=fr,en_us setlocal spell spelllang=fr,en_us

View File

@ -1,4 +1,4 @@
" verilog indent removal " verilog indent removal
" Licence LGPL v3.0 " Licence GPLv3
noremap <leader><Enter> :w! \| :CoqRunToCursor<CR> noremap <leader><Enter> :w! \| :CoqRunToCursor<CR>

View File

@ -1,4 +0,0 @@
" vim filetype config
" Licence LGPL v3.0
let b:coc_pairs_disabled = ['"']

View File

@ -4,7 +4,7 @@
" Maintainer: David JULIEN <swy7ch@protonmail.com> " Maintainer: David JULIEN <swy7ch@protonmail.com>
" Website: https://github.com/vim/vim/blob/master/src/syntax.c " Website: https://github.com/vim/vim/blob/master/src/syntax.c
" License: Vim License (see `:help license`) " License: Vim License (see `:help license`)
" Last Updated: Sun 10 May 2020 12:25:20 PM CEST " Last Updated: Fri 15 May 2020 03:37:00 PM CEST
" Generated by Colortemplate v2.0.0 " Generated by Colortemplate v2.0.0

View File

@ -119,11 +119,11 @@ set smarttab
" 1 tab = 4 spaces " 1 tab = 4 spaces
set tabstop=4 set tabstop=4
set shiftwidth=4 "for indent operations set shiftwidth=4
" Indent and wrap rules " Indent and wrap rules
set autoindent set autoindent
set wrap "wrap lines set wrap
" Stop auto-commenting new line " Stop auto-commenting new line
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
@ -163,7 +163,7 @@ noremap <leader>s :source ~/.config/nvim/init.vim <CR>
" Circle through buffers " Circle through buffers
noremap <leader>n :bn<CR> noremap <leader>n :bn<CR>
noremap <leader>p :bp<CR> noremap <leader>b :bp<CR>
" Clear the search highlight " Clear the search highlight
noremap <leader>q :nohl<CR> noremap <leader>q :nohl<CR>

View File

@ -14,7 +14,6 @@ function! CurrentMode()
endfunction endfunction
function! ModeColor() function! ModeColor()
let g:modecolor={ let g:modecolor={
\ 'n' : '%#NormalMode#', \ 'n' : '%#NormalMode#',
\ 'v' : '%#VisualMode#', \ 'v' : '%#VisualMode#',
@ -41,7 +40,6 @@ function! FileName()
endfunction endfunction
function! StatusLine() function! StatusLine()
let l:statusline='' let l:statusline=''
" Buffer number " Buffer number
@ -56,6 +54,7 @@ function! StatusLine()
let l:statusline.='%#File#' let l:statusline.='%#File#'
let l:statusline.=FileName() let l:statusline.=FileName()
" File status
let l:statusline .= "%{&readonly?' [RO]':''}" let l:statusline .= "%{&readonly?' [RO]':''}"
let l:statusline .= "%{&modified?' [MO]':''}" let l:statusline .= "%{&modified?' [MO]':''}"
@ -76,10 +75,7 @@ function! StatusLine()
let l:statusline.='%#WarningMsg#' let l:statusline.='%#WarningMsg#'
let l:statusline.="%{&fileencoding!='utf-8'?'['.&fileencoding.'] ':''}%*" let l:statusline.="%{&fileencoding!='utf-8'?'['.&fileencoding.'] ':''}%*"
" Depth
"setlocal statusline.=%#FileFormat#
"setlocal statusline.=\ %-7([%{&fileformat}]%)
let l:statusline.='%#Percent#' let l:statusline.='%#Percent#'
let l:statusline.='%03.p%%%* ' let l:statusline.='%03.p%%%* '
@ -88,16 +84,15 @@ function! StatusLine()
let l:statusline.='-%c-' let l:statusline.='-%c-'
return l:statusline return l:statusline
endfunction endfunction
function! StatusLineNC() function! StatusLineNC()
let l:statusline='' let l:statusline=''
" Buffer number " Buffer number
let l:statusline.='[%n]' let l:statusline.='[%n]'
" File name " File name and status
let l:statusline.=' %t' let l:statusline.=' %t'
let l:statusline .= "%{&readonly?' [MO]':''}" let l:statusline .= "%{&readonly?' [MO]':''}"
@ -109,11 +104,11 @@ function! StatusLineNC()
" Separation point between left and right aligned items. " Separation point between left and right aligned items.
let l:statusline.='%=' let l:statusline.='%='
" Depth
let l:statusline.='%#Percent#' let l:statusline.='%#Percent#'
let l:statusline.='%03.p%%' let l:statusline.='%03.p%%'
return l:statusline return l:statusline
endfunction endfunction
function! UpdateInactiveWindows() function! UpdateInactiveWindows()

View File

@ -14,7 +14,7 @@
#CacheDir = /var/cache/pacman/pkg/ #CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log #LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/ #GPGDir = /etc/pacman.d/gnupg/
HookDir = /config/pacman/hooks HookDir = /home/swytch/.config/pacman/hooks
HoldPkg = pacman glibc HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u #XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u

View File

@ -40,7 +40,7 @@ super + shift + {w,z}
$BROWSER $BROWSER
super + shift + p super + shift + p
$BROWSER --incognito $BROWSER --private-window
super + shift + b super + shift + b
script="$(printf "bibinput\nbibshow" | dmenu -i -p "which script?")" && $script script="$(printf "bibinput\nbibshow" | dmenu -i -p "which script?")" && $script

View File

@ -39,9 +39,7 @@
This is the shell script I run just after I installed Arch. It does few things: This is the shell script I run just after I installed Arch. It does few things:
### What it does: - Install the apps I use
- Download my personnal repos
* Install the apps I use - Compile my WM (`dwm`), my binary launcher (`dmenu`) and my terminal emulator (`st`), which are part of the [suckless](https://suckless.org/) project.
* Download my personnal repos
* Compile my WM (`dwm`), my binary launcher (`dmenu`) and my terminal emulator (`st`), which are part of the [suckless](https://suckless.org/) project.

View File

@ -33,15 +33,13 @@ refinput(){
} }
doctypes="article book online techreport" doctypes="article book online techreport"
base="$(basename "$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibinput] which bibliography?")")" # the -not -path allows find to ignore hidden files file="$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibinput] which bibliography?")" # the -not -path allows find to ignore hidden files
[ -z "$base" ] && exit 1 [ -z "$file" ] && exit 1
file="$HOME/documents/bibliographies/"$base
refs="$(cat "$file" | grep "@" | sed "s/,$//g" | awk -F '{' '{print $2}' | tr '\n' ' ')" refs="$(cat "$file" | grep "@" | sed "s/,$//g" | awk -F '{' '{print $2}' | tr '\n' ' ')"
# if the file does not exist, creates it # if the file does not exist, create it
if [ ! -e "$file" ]; then if [ ! -e "$file" ]; then
mkfile="$(printf "No\\nYes" | dmenu -i -p "$file does not exist. Create it?")" mkfile="$(printf "No\\nYes" | dmenu -i -p "$file does not exist. Create it?")"
[ "$mkfile" = "Yes" ] && (touch "$file") [ "$mkfile" = "Yes" ] && (touch "$file")

View File

@ -4,7 +4,6 @@
# User inputs informations, this will show the content of an entry through dmenu # User inputs informations, this will show the content of an entry through dmenu
file="$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibshow] which bibliography?")" # the -not -path allows find to ignore hidden files file="$(find $HOME/documents/bibliographies/ -type f -not -path '*/\.*' | dmenu -l 20 -p "[bibshow] which bibliography?")" # the -not -path allows find to ignore hidden files
refs_list="$(cat "$file" | sed 's/\t//g' | tr '\n' ' ' | sed 's/}\ /}\n/g')" refs_list="$(cat "$file" | sed 's/\t//g' | tr '\n' ' ' | sed 's/}\ /}\n/g')"
@ -15,5 +14,5 @@ ref="$(echo "$refs_list" | dmenu -i -p 'infos?' -l 10)"
output="$(echo "$ref" | sed 's/author/\n author/g' | sed 's/",/",\n/g')" output="$(echo "$ref" | sed 's/author/\n author/g' | sed 's/",/",\n/g')"
echo "$output" | dmenu -i -p "infos" -l 20 echo "$output" | dmenu -i -p "infos" -l 10
echo "$ref" | awk -F '{' '{print $2}' | awk -F ',' '{print $1}' | xclip -selection clipboard echo "$ref" | awk -F '{' '{print $2}' | awk -F ',' '{print $1}' | xclip -selection clipboard

View File

@ -10,9 +10,12 @@
file=$(readlink -f "$1") file=$(readlink -f "$1")
dir=$(dirname "$file") dir=$(dirname "$file")
dirname=$(basename "$dir")
base="$(echo "${file%.*}" | awk -F '/' '{printf $NF}')" base="$(echo "${file%.*}" | awk -F '/' '{printf $NF}')"
shebang=$(sed -n 1p "$file") shebang=$(sed -n 1p "$file")
sucklesstools="$(ls $XDG_CONFIG_HOME/suckless)"
cd "$dir" || exit cd "$dir" || exit
shebangtest() shebangtest()
@ -22,7 +25,7 @@ shebangtest()
esac esac
} }
textype() { \ texcompile() { \
bibliography="$(cat "$file" | grep '\bibliography')" bibliography="$(cat "$file" | grep '\bibliography')"
if [ -n "$bibliography" ]; then if [ -n "$bibliography" ]; then
pdflatex --output-directory="$dir" "$base" && pdflatex --output-directory="$dir" "$base" &&
@ -33,16 +36,27 @@ textype() { \
pdflatex --output-directory="$dir" "$base" && pdflatex --output-directory="$dir" "$base" &&
pdflatex --output-directory="$dir" "$base" pdflatex --output-directory="$dir" "$base"
fi fi
texclear "$file"
} }
s_build(){
case "$file" in case "$file" in
*config.def.h) sudo make clean install && rm -f config.h ;; *config.def.h) sudo make clean install && rm -f config.h ;;
*config.h) echo "" && echo "You should build from config.def.h !" ;; *config.h) echo "" && echo "You should build from config.def.h !" ;;
*\.c*) make && ./main ;; esac
*\.h*) make && ./main ;;
*\.mom) refer -PS -e "$file" | pdfmom > "$base.pdf" ;; exit 0
*\.tex) textype "$base" ;; }
*\.py) python "$file" ;;
for tool in $sucklesstools; do
if [ "$tool" = "$dirname" ]; then
s_build
fi
done
case "$file" in
*.c*|.h*) make && ./main ;;
*.mom) refer -PS -e "$file" | pdfmom > "$base.pdf" ;;
*.tex) texcompile "$base" ; texclear "$file" ;;
*.py) python "$file" ;;
*) shebangtest ;; *) shebangtest ;;
esac esac

View File

@ -7,7 +7,6 @@
# selection" which opens arandr. # selection" which opens arandr.
twoscreen() { # If multi-monitor is selected and there are two screens. twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled # Mirror displays using native resolution of external display and a scaled
# version for the internal display # version for the internal display

View File

@ -3,9 +3,9 @@
## Wrapper for my dotfiles ## Wrapper for my dotfiles
git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME" git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
cmd="$git status" ## by default, give the status cmd="$git status" # by default, give the status
[ "$1" = "-g" ] && shift && cmd="$git $@" ## make the wrapper transparent [ "$1" = "-g" ] && shift && cmd="$git $@" # make the wrapper transparent
[ "$1" = "-l" ] && shift && cmd="$git log" [ "$1" = "-l" ] && shift && cmd="$git log"
[ "$1" = "-c" ] && shift && cmd="$git commit $@" [ "$1" = "-c" ] && shift && cmd="$git commit $@"

View File

@ -8,13 +8,10 @@
# Handle SIGTRAP signals sent by refbar to update the status bar immediately. # Handle SIGTRAP signals sent by refbar to update the status bar immediately.
trap 'update' 5 trap 'update' 5
# Set the deliminter character. delim="|" # Set the delimiter character.
delim="|"
status() { \ status() { \
# Get the volume of ALSA's master volume output.
# Gets the volume of ALSA's master volume output.
volume="$(pamixer --get-volume)" volume="$(pamixer --get-volume)"
muted="$(pamixer --get-mute)" muted="$(pamixer --get-mute)"
@ -38,7 +35,6 @@ status() { \
# Will show all batteries with approximate icon for remaining power. # Will show all batteries with approximate icon for remaining power.
# Or show that the computer is plugged to a power source # Or show that the computer is plugged to a power source
# In any case, show the remaining battery percentage # In any case, show the remaining battery percentage
AC_ON="$(cat /sys/class/power_supply/AC/online)" AC_ON="$(cat /sys/class/power_supply/AC/online)"
for x in /sys/class/power_supply/BAT?/capacity; for x in /sys/class/power_supply/BAT?/capacity;
do do
@ -57,7 +53,6 @@ status() { \
done && echo "$delim" done && echo "$delim"
# Date and time. # Date and time.
date '+%b. %d - %I:%M%p' date '+%b. %d - %I:%M%p'
} }

View File

@ -2,7 +2,7 @@
## Control keyboard brightness ## Control keyboard brightness
## level goes up at each call ## level goes up at each call
## goes back to 0 after meeting maximum brightness ## goes back to 0 after reaching maximum brightness
## You need `upower` package to make it work ## You need `upower` package to make it work

View File

@ -9,43 +9,37 @@ headers_list="$(ls | grep '.h$')"
sources_list="$(ls | grep '.cp*$')" sources_list="$(ls | grep '.cp*$')"
modules_list="$(echo "$sources_list" | sed 's/\.cp*//g' | tr '\n' ' ')" modules_list="$(echo "$sources_list" | sed 's/\.cp*//g' | tr '\n' ' ')"
targets_list="$(echo "$sources_list" | sed 's/\.cp*/\.o/g' | tr '\n' ' ')" targets_list="$(echo "$sources_list" | sed 's/\.cp*/\.o/g' | tr '\n' ' ')"
bool=false
comp=gcc
get_compiler(){ get_compiler(){
for source_ in "$sources_list"; do for source_ in "$sources_list"; do
case "$source_" in case "$source_" in
*.cpp) comp="g++" && return;; *.cpp) echo "g++" && return;;
*.c) ;; *.c) echo "gcc";;
esac esac
done done
} }
is_c_project(){ is_c_project(){
if [ -n "$sources_list" ]; then [ -n "$sources_list" ]
bool=true
fi
} }
make_rule(){ make_rule(){
if [ "$comp" = "gcc" ]; then if [ "$comp" = "gcc" ]; then
echo "$1.o : $1.c" >> makefile echo "$1.o : $1.c $1.h" >> makefile
echo -e "\t\$(CC) -c $1.c \$(FLAGS)" >> makefile echo -e "\t\$(CC) -c $1.c \$(FLAGS)" >> makefile
else else
echo "$1.o : $1.cpp" >> makefile echo "$1.o : $1.cpp $1.h" >> makefile
echo -e "\t\$(CC) -c $1.cpp \$(FLAGS)" >> makefile echo -e "\t\$(CC) -c $1.cpp \$(FLAGS)" >> makefile
fi fi
echo "" >> makefile echo "" >> makefile
} }
is_c_project if ! is_c_project; then
if [ "$bool" = false ]; then
echo "No C/C++ project in directory. Exiting..." echo "No C/C++ project in directory. Exiting..."
exit 1 exit 1
fi fi
get_compiler comp=get_compiler
touch makefile touch makefile
@ -69,4 +63,9 @@ echo "clean :" >> makefile
echo -e "\trm \$(BIN) *.o vgcore.*" >> makefile echo -e "\trm \$(BIN) *.o vgcore.*" >> makefile
sed -i 's/\s$//' makefile sed -i 's/\s$//' makefile
if type "nvim" &> /dev/null; then
nvim makefile nvim makefile
else
vim makefile
fi

View File

@ -3,15 +3,13 @@
# /!\ files must be names 0_file0, 1_file1... in order to be processed correctly # /!\ files must be names 0_file0, 1_file1... in order to be processed correctly
# if the file already exists, delete it # if the file already exists, delete it
if [ -e rendu.mom ]; then [ -e rendu.mom ] && rm rendu.mom
rm rendu.mom
fi
pdf_list=$(ls *.mom) list=$(ls *.mom)
touch rendu.mom touch rendu.mom
for doc in "$pdf_list"; do for doc in "$list"; do
cat "$doc" >> rendu.mom cat "$doc" >> rendu.mom
echo ".COLLATE" >> rendu.mom echo ".COLLATE" >> rendu.mom
done done

View File

@ -10,6 +10,6 @@ case "$1" in
file=$(readlink -f "$1") file=$(readlink -f "$1")
dir=$(dirname "$file") dir=$(dirname "$file")
base="${file%.*}" base="${file%.*}"
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;; find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|tns|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;;
*) printf "Give .tex file as argument.\\n" ;; *) printf "Give .tex file as argument.\\n" ;;
esac esac

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Create a LaTeX document with genereic metadata, then opens it with neovim (or vim as a fallback) # Create a LaTeX document with genereic metadata, then open it with neovim (or vim as a fallback)
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Please provide a name for your file" echo "Please provide a name for your file"

View File

@ -19,8 +19,7 @@ export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
export EDITOR="nvim" export EDITOR="nvim"
export TERMINAL="st" export TERMINAL="st"
export READER="zathura" export READER="zathura"
export BROWSER="brave" export BROWSER="firefox"
export INCOGNITO="brave --incognito"
## program settings ## program settings
export LESS_TERMCAP_md="$(printf '%b' '\e[01;32m')" export LESS_TERMCAP_md="$(printf '%b' '\e[01;32m')"