Skip to content

Instantly share code, notes, and snippets.

View McFrappe's full-sized avatar
🎯
Focusing

Fadde McFrappe

🎯
Focusing
View GitHub Profile
@McFrappe
McFrappe / FetchActiveKeyboardLayout.sh
Last active April 6, 2022 16:32
Script that fetches what keyboard layout is active in Mac OS (tested on Monterey)
#!/bin/bash
plutil -extract AppleSelectedInputSources xml1 -o - ~/Library/Preferences/com.apple.HIToolbox.plist | xmllint --xpath \"string(//dict[2]/string[2])\" -
@McFrappe
McFrappe / pane_logic.vim
Last active February 13, 2022 18:43
Logic for entering/leaving a pane. Provides a column for active pane.
" Logic for entering/leaving a pane
function! OnWinEnter()
if exists('w:initial_cc')
let &colorcolumn = w:initial_cc
endif
endfunction
function! OnWinLeave()
if !exists('w:initial_cc')
let w:initial_cc=&colorcolumn
endif
@McFrappe
McFrappe / set_theme.vim
Last active April 25, 2022 21:00
Set VIM theme depending on OS theme mode. Checks OSX value `AppleInterfaceStyle` and acts accordingly.
" COLORS AND THEMING ##########################################################
function! SetBackgroundMode(...)
let g:new_bg = "light"
let g:ayucolor = "light" # If your theme supports light mode
let s:mode = systemlist("defaults read -g AppleInterfaceStyle")[0]
if s:mode ==? "Dark"
let g:ayucolor = "dark" # If your theme supports dark mode
let g:new_bg = "dark"
endif