feat: change neovim template plugin + update header of scripts

wayland
swy7ch 2020-05-20 18:34:34 +02:00 committed by swytch
parent 30f254f6c3
commit a91ea4f87e
29 changed files with 299 additions and 91 deletions

View File

@ -28,7 +28,7 @@ Plug 'lifepillar/vim-colortemplate'
Plug 'norcalli/nvim-colorizer.lua'
" Templates
Plug 'aperezdc/vim-template'
Plug 'tibabit/vim-templates'
" All Plugins must be added before the following line
call plug#end()
@ -156,6 +156,11 @@ augroup statusline
\ call RefreshStatusLine('inactive')
augroup END
"" Misc
""""""""""""""""""""""""""""""""""""""""""""""""""
" Templates location
let g:tmpl_search_paths=['$XDG_CONFIG_HOME/nvim/templates']
"" Macros
""""""""""""""""""""""""""""""""""""""""""""""""""
" Source files
@ -187,4 +192,5 @@ noremap <leader>pu :PlugUpdate \| PlugUpgrade<CR>
noremap <leader>cc :ColorizerToggle<CR>
" Template
noremap <leader>t :Template<CR>
noremap <leader>ti :TemplateInit<CR>
noremap <leader>te :TemplateExpand<CR>

View File

@ -1,6 +1,15 @@
#! /bin/sh
# Sends a notification if AC is plugged in (or out)
# Also refreshes statusbar
#!/bin/sh
######################################################################
# @author : swytch
# @file : AC_notify
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:51:45 CEST
#
# @description : send a notification when AC status change
# refresh statusbar
######################################################################
new_state="$(cat /sys/class/power_supply/AC/online)"
prev_state="$new_state"

View File

@ -1,8 +1,14 @@
#! /bin/sh
# This script has three goals:
# 1. cloning personnal git repos
# 2. building tools (suckless' utilities)
# 3. enabling systemctl services
#!/bin/sh
######################################################################
# @author : swytch
# @file : arch_setup
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:49:05 CEST
#
# @description : automate the setup of my arch installation
######################################################################
#Lists of apps sorted by type and criticity
base_list="dash xorg-server xorg-xinit xorg-xinput xsetroot sxhkd xss-lock zsh neovim gtk2 brave"

View File

@ -1,6 +1,14 @@
#! /bin/sh
# Is called when changing sound level
# Sends a notification with the current sound level
#!/bin/sh
######################################################################
# @author : swytch
# @file : audio_notify
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:52:58 CEST
#
# @description : send a notification with sound level
######################################################################
level=$(pamixer --get-volume)
muted=$(pamixer --get-mute)

View File

@ -1,6 +1,14 @@
#! /bin/sh
# Is called when changing backlight value
# Sens a notification with the current xbaclight value
#!/bin/sh
######################################################################
# @author : swytch
# @file : backlight_notify
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:53:36 CEST
#
# @description : send a notification with xbacklight value
######################################################################
current=$(cat /sys/class/backlight/intel_backlight/brightness)
max=$(cat /sys/class/backlight/intel_backlight/max_brightness)

View File

@ -1,5 +1,14 @@
#! /bin/sh
# Checks the battery, sends a notification depending on the level
#!/bin/sh
######################################################################
# @author : swytch
# @file : bat_notify
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:54:08 CEST
#
# @description : send a notification with charge level
######################################################################
notify() { \
for x in /sys/class/power_supply/BAT?/capacity;

View File

@ -1,7 +1,14 @@
#! /bin/sh
#!/bin/sh
######################################################################
# @author : swytch
# @file : bibinput
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:57:47 CEST
#
# @description : create a bibliography entry through dmenu
######################################################################
# Create an entry in $HOME/documents/bibliographies/selected_bibliography.bib
# Interactive script, dialog via dmenu
parse(){
if [ "$1" = "@" ]; then

View File

@ -1,8 +1,14 @@
#! /bin/sh
#!/bin/sh
# Show the reference of a .bib entry
######################################################################
# @author : swytch
# @file : bibshow
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:58:14 CEST
#
# @description : interactively display the infos in a .bib entry
######################################################################
# 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

View File

@ -1,6 +1,14 @@
#!/bin/bash
# This script will show the terminal colourscheme as blocks
# All credits to u/deepjyoti30 on GitHub
#!/bin/sh
######################################################################
# @author : swytch (based on u/deepjyoti30 on GitHub)
# @file : colorblocks
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:59:44 CEST
#
# @description : display terminal colors as big blocks
######################################################################
f=3 b=4
for j in f b; do

View File

@ -1,12 +1,18 @@
#! /bin/sh
# This script will compile or run another finishing operation on a document
# It is meant to be run via vim/neovim
# Adapted form the work of Luke Smith (lukesmith.xyz)
#!/bin/sh
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : compiler
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:00:51 CEST
#
# @description : compile or run another finishing operation on a file
# groff-mom : compile via pdfmom to a pdf document
# c : compile via gcc
# config.def.h (suckless) recompile, install
# tex : compile via pdflatex (bibtex if needed)
######################################################################
# groff-mom files : Compiles via pdfmom to a pdf document
# c files : Compiles via gcc
# config.def.h (-> suckless) recompiles and install the program
# tex files : Compiles via pdflatex (biblatex if needed)
file=$(readlink -f "$1")
dir=$(dirname "$file")

View File

@ -1,10 +1,14 @@
#! /bin/sh
#!/bin/sh
# All credits to Luke Smith (lukesmith.xyz)
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : displayselect
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:04:01 CEST
#
# @description : detect displays and select an organisation
######################################################################
# A UI for detecting and selecting all displays. Probes xrandr for connected
# displays and lets user select one to use. User may also select "manual
# selection" which opens arandr.
twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")

View File

@ -1,11 +1,14 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives. If they're in /etc/fstab
# they'll be mounted automatically. Otherwise, you'll be prompted to give
# a mountpoint from already existsing directories. If you input a novel
# directory, it will prompt you to create that directory.
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : dmenumount
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:05:31 CEST
#
# @description : dmenu prompt to mount unmounted drives
######################################################################
# Adapted form the work of Luke Smith (lukesmith.xyz)
getmount() { \
[ -z "$chosen" ] && exit 1

View File

@ -1,6 +1,14 @@
#! /bin/sh
#!/bin/sh
######################################################################
# @author : swytch
# @file : dmenuopen
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:08:05 CEST
#
# @description : find a file, open it with appropriate application
######################################################################
# Fuzzy-find a file and open it with appropriate application
filetypes=".pdf .png .jpg .txt .mom .tex .mkv" # could be augmented
filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?")

View File

@ -1,7 +1,14 @@
#!/bin/sh
# This script is the SUDO_ASKPASS variable, meaning that it will be used as a
# password prompt if needed.
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : dmenupass
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:08:50 CEST
#
# @description : [sudo] prompt (SUDO_ASKPASS variable)
######################################################################
col_yellow="#ffeca3"
col_black="#1d2021"

View File

@ -1,8 +1,14 @@
#! /bin/sh
# A dmenu binary prompt script.
# Gives a dmenu prompt labeled with $1 to perform command $2.
# For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
#!/bin/sh
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : dmenuprompt
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:10:13 CEST
#
# @description : dmenu prompt ($1) to perform a command ($2)
######################################################################
col_darkred="#9d0006"
col_red="#cc241d"

View File

@ -1,10 +1,14 @@
#!/bin/sh
# A dmenu prompt to unmount drives.
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
######################################################################
# @author : swytch (adapted form Luke Smith - lukesmith.xyz)
# @file : dmenuumount
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:11:17 CEST
#
# @description : dmenu prompt to unmount drives
######################################################################
# Adapted from the work of Luke Smith (lukesmith.xyz)
unmountusb() {
chosen=$(echo "$usbdrives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')

View File

@ -1,6 +1,14 @@
#!/bin/bash
#!/bin/sh
######################################################################
# @author : swytch
# @file : dot
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:13:05 CEST
#
# @description : git wrapper for dotfiles management
######################################################################
## Wrapper for my dotfiles
git="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
cmd="$git status" # by default, give the status

View File

@ -1,9 +1,15 @@
#!/bin/sh
# This script sets the statusbar with the xsetroot command at the end. Have it
# started by ~/.xinitrc or ~/.xprofile.
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : dwmbar
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:14:14 CEST
#
# @description : set the statusbar in `dwm`
# @dependencies: `xsetroot`
######################################################################
# Adapted form the work of Luke Smith (lukesmith.xyz)
# Handle SIGTRAP signals sent by refbar to update the status bar immediately.
trap 'update' 5

View File

@ -1,6 +1,14 @@
#!/bin/sh
# based on ufetch - https://gitlab.com/jschx/ufetch/
######################################################################
# @author : swytch
# @file : fetch
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:16:09 CEST
#
# @description : display system infos
######################################################################
## INFO

View File

@ -1,10 +1,15 @@
#!/bin/sh
## Control keyboard brightness
## level goes up at each call
## goes back to 0 after reaching maximum brightness
######################################################################
# @author : swytch
# @file : kbacklight
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:17:03 CEST
#
# @description : control keyboard brightness
# @dependencies: `upower`
######################################################################
## You need `upower` package to make it work
max=$(cat /sys/class/leds/tpacpi::kbd_backlight/max_brightness)
current=$(cat /sys/class/leds/tpacpi::kbd_backlight/brightness)

View File

@ -1,9 +1,15 @@
#! /bin/sh
# Detect if the directory is a c/c++ project
# Create a makefile with existing c/c++ files in directory
# Rules are basic (i.e. module.o : module.c)
# variables are generic
# Exit by opening makefile with neovim
#!/bin/sh
######################################################################
# @author : swytch
# @file : maker
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:18:53 CEST
#
# @description : create a makefile for current project (if c/c++)
# open it with (neo)vim
######################################################################
headers_list="$(ls | grep '.h$')"
sources_list="$(ls | grep '.cp*$')"

View File

@ -1,5 +1,15 @@
#! /bin/sh
# Creates a groff/mom document with generic metadata, opens it with neovim (or vim as a fallback)
#!/bin/sh
######################################################################
# @author : swytch
# @file : mom
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:19:56 CEST
#
# @description : create a groff doc with genereic metadata
# open it with (neo)vim
######################################################################
if [ -z ""$1"" ]; then
echo "Please provide a name for your file"

View File

@ -1,3 +1,17 @@
#!/bin/sh
######################################################################
# @author : swytch
# @file : mommerge
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:20:23 CEST
#
# @description : merge mom files from current dir
# compile it with `compiler` script
# @dependencies: `compiler` script
######################################################################
#! /bin/sh
# Gather the mom files from current dir and compile them into ONE pdf file, using my compiler script
# /!\ files must be names 0_file0, 1_file1... in order to be processed correctly

View File

@ -1,8 +1,14 @@
#! /bin/sh
#!/bin/sh
#refresh dwmbar by killing the "sleep" command in the dwmbar process
######################################################################
# @author : swytch (adapted form Luke Smith - lukesmith.xyz)
# @file : refbar
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:21:19 CEST
#
# @description : refresh dwmbar
######################################################################
# Adapted form the work of Luke Smith (lukesmith.xyz)
# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
pkill -SIGTRAP dwmbar

View File

@ -1,6 +1,15 @@
#!/bin/sh
## Change the backlight value
######################################################################
# @author : swytch
# @file : sbacklight
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:22:36 CEST
#
# @description : control screen brightness
######################################################################
## You need write privileges on /sys/.../brightness
## This can be achieved via a `udev` rule (see ~/.config/root)

View File

@ -1,9 +1,18 @@
#! /bin/sh
#!/bin/sh
######################################################################
# @author : swytch
# @file : setbg
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:23:50 CEST
#
# @description : set the wallpaper
# @dependencies: `xwallpaper`
######################################################################
# This script sets the wallpaper
# If given an argument
# if $1 is a png file, set it as a wallpaper
# if $1 is a jpg/jpeg file, convert it to png and set it as a wallpaper
# if $1 is a directory, choose a randomized image in it, set it as wallpaper
[ -f "$1" ] && cp $1 "$XDG_CONFIG_HOME/wall.png" && dunstify -u "low" "Wallpaper changed"

View File

@ -1,9 +1,14 @@
#!/usr/bin/env sh
#!/bin/sh
# All credits to Luke Smith (lukesmith.xyz)
######################################################################
# @author : swytch (adapted form Luke Smith - lukesmith.xyz)
# @file : texclear
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:24:59 CEST
#
# @description : clear the build files of LaTeX build
######################################################################
# Clears the build files of a LaTeX/XeLaTeX build.
# I have vim run this file whenever I exit a .tex file.
case "$1" in
*.tex)

View File

@ -1,6 +1,15 @@
#! /bin/sh
#!/bin/sh
######################################################################
# @author : swytch
# @file : texer
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:26:30 CEST
#
# @description : create a LaTeX doc with generic metadata
# open it with (neo)vim
######################################################################
# Create a LaTeX document with genereic metadata, then open it with neovim (or vim as a fallback)
if [ -z "$1" ]; then
echo "Please provide a name for your file"

View File

@ -1,5 +1,13 @@
#! /bin/sh
#!/bin/sh
######################################################################
# @author : swytch
# @file : webupdate
# @license : GPLv3
# @created : Wednesday May 20, 2020 18:27:35 CEST
#
# @description : update my website with $HOME/public_html
######################################################################
# Little script to update my website
rsync -avrP --rsh='ssh' $HOME/public_html swytch@davidjulien.xyz:~/ && notify-send 'davidjulien.xyz' 'website updated'