This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" floating fzf window with borders | |
function! CreateCenteredFloatingWindow() | |
let width = min([&columns - 4, max([80, &columns - 20])]) | |
let height = min([&lines - 4, max([20, &lines - 10])]) | |
let top = ((&lines - height) / 2) - 1 | |
let left = (&columns - width) / 2 | |
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} | |
let top = "╭" . repeat("─", width - 2) . "╮" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tmux config file. | |
# | |
# Maintainer: Bhaskar K C <[email protected]> | |
unbind C-b | |
# edit configuration | |
bind e new-window -n "~/.tmux.conf" \ | |
"sh -c '\${EDITOR:-vim} \ | |
~.tmux.conf && \ | |
tmux source ~/.tmux.conf && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# Author: Bhaskar K <[email protected]> | |
# Switch to US international with Caps as Mod/Escape | |
setxkbmap -option caps:super -variant altgr-intl | |
killall xcape 2>/dev/null | |
xcape -e 'Super_L=Escape' | |
xmodmap -e 'keycode 135 = Super_R' & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# extend non-HiDPI external display on DP* above HiDPI internal display eDP* | |
# see also https://wiki.archlinux.org/index.php/HiDPI | |
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949 | |
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319 | |
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1` | |
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1` | |
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set shell=/usr/bin/bash | |
if &compatible | |
set nocompatible | |
endif | |
" Declare the general config group for autocommand | |
if has("autocmd") | |
augroup vimrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Current commit HASH | |
# %H give commit hash | |
current_commit() { | |
git HEAD --pretty=format:"%H" | |
# git log -n 1 --pretty=format:"%H" | |
} | |
# Previous commit HASH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Repeat String | |
# | |
# Usage repeat_string "-" | |
# repeat_string "-" 20 | |
# ARG1: String | |
# ARG2: Count [optional] | |
repeat_string() { | |
sep=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m | |
: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
xrandr=$(xrandr) | |
con_monitors=$(echo $xrandr | grep -c " connected ") | |
if [[ $con_monitors -gt 1 ]]; then | |
# All the layouts are saved in "screenlayout" folder. | |
# eg. xrandr --output HDMI-1 --mode 2560x1440 --pos 0x0 --rotate normal --output DP-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 283x1440 --rotate normal --output DP-2 --off | |
for layout in ~/.screenlayout/*.sh; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check item in an array | |
# | |
# @arg1 needle | |
# @arg2 array | |
# | |
# return boolean | |
inarray() { | |
for item in "${@:2}"; do [[ "$item" == "$1" ]] && return 0; done | |
return 1 | |
} |