Skip to content

Instantly share code, notes, and snippets.

@frace
frace / GetVimHighlight
Last active December 16, 2015 07:29
Some functions to store and restore values of a given highlight group in vim.
function! functions#store_highlight_attrs(group)
" Wants: Str
" Returns: Dict
" Does: Stores all attribute of the given highlight group
" and returns them as a dictionary.
if has('gui_running')
let l:ui_type = 'gui'
else
let l:ui_type = 'cterm'
@frace
frace / vim-statusline-spacer.vim
Last active December 15, 2015 15:29
Create a spacer/margin on the left of the vim statusline according to the numberwidth
function! CreateSpacer()
if &number || &relativenumber
return repeat(" ", &numberwidth + 1)
endif
return ""
endfunction
set statusline=
set statusline+=%{CreateSpacer()}
@frace
frace / pidof
Created November 27, 2012 20:13 — forked from vgrichina/pidof
pidof for OS X
#!/usr/bin/env bash
if (( $# == 1 )); then
declare proc="$(ps axc | grep "$1")"
read -ra pid <<< "$proc"
if (( $pid )); then
echo $pid
exit 0
else