usr

Modulate your userpace into POSIX-compliant shell scripts!
git clone git://clone.theohenson.com/usr.git
Log | Files | Refs | README

commit 75743c5ba7d13ae83075b8844c5e6f2a4a07a4b1
parent f4be90bde233321f207f55c71f21aa1a4ca892ec
Author: Theo Henson <[email protected]>
Date:   Mon, 30 Nov 2020 19:36:52 -0500

Update gtk, python, vim

Diffstat:
Mhome/.config/discocss/custom.css | 2--
Mhome/.config/gtk-2.0/gtkrc-2.0 | 2+-
Mhome/.config/gtk-3.0/settings.ini | 2+-
Mhome/.config/python/rc.py | 52++++++++++++++++++++++++++++++++++++++++++++++++++--
Mhome/.vim/vimrc | 28++++++++++++++++++++--------
5 files changed, 72 insertions(+), 14 deletions(-)

diff --git a/home/.config/discocss/custom.css b/home/.config/discocss/custom.css @@ -59,8 +59,6 @@ * { font-family: "Fira Mono" !important; - font-weight: normal !important; - font-size: 1rem !important; } diff --git a/home/.config/gtk-2.0/gtkrc-2.0 b/home/.config/gtk-2.0/gtkrc-2.0 @@ -1,3 +1,3 @@ gtk-icon-theme-name = "Gruvbox-Material-Dark" gtk-theme-name = "Gruvbox-Material-Dark" -gtk-font-name = "Helvetica 11" +gtk-font-name = "DejaVu Sans 11" diff --git a/home/.config/gtk-3.0/settings.ini b/home/.config/gtk-3.0/settings.ini @@ -1,4 +1,4 @@ [Settings] gtk-icon-theme-name = Gruvbox-Material-Dark gtk-theme-name = Gruvbox-Material-Dark -gtk-font-name = Helvetica 11 +gtk-font-name = DejaVu Sans 11 diff --git a/home/.config/python/rc.py b/home/.config/python/rc.py @@ -2,18 +2,66 @@ import os import atexit import readline +import math as m +try: + import periodictable as p +except ImportError: + pass + # get .python_history out of home directory: base = "" try: base = os.environ['XDG_CACHE_HOME'] except KeyError: base = os.path.join(os.path.expanduser("~"), ".cache") - histfile = os.path.join(base, "python_history") - try: readline.read_history_file(histfile) readline.set_history_length(1000) except FileNotFoundError: pass atexit.register(readline.write_history_file, histfile) + +# factor pairs +def fac(x): + facs = [] + for i in range(1, x + 1): + if x % i == 0: + if i * i == x: + facs.append(i) + facs.append(i) + a = facs[:int(len(facs)/2)] + b = facs[int(len(facs)/2):] + return [(a[i], b[len(b)-i-1]) for i in range(0, len(b))] + +# greatest common denominator +def gcd(a, b): + while b: + a, b = b, a % b + return a + +# least common denominator +def lcd(a, b): + return int((a*b)/gcd(a,b)) + +# simplify fraction +def sf(numer, denom): + if denom == 0: + return None + common_divisor = gcd(numer, denom) + (reduced_num, reduced_den) = (numer / common_divisor, denom / common_divisor) + if reduced_den == 1: + return int(reduced_num) + elif common_divisor == 1: + return (int(numer), int(denom)) + else: + return (int(reduced_num), int(reduced_den)) + +# nth root +def r(number, root): + if root == 0: return 1 + return number ** (1 / root) + +# distance formula +def dis(a, b): + return m.sqrt( ((b[0] - a[0]) ** 2) + ((b[1] - a[1]) ** 2) ) diff --git a/home/.vim/vimrc b/home/.vim/vimrc @@ -12,10 +12,10 @@ cnoremap Q<cr> q<cr> nnoremap Q <nop> " Remaps for easier split navigation -noremap <C-h> <C-w>h -noremap <C-j> <C-w>j -noremap <C-k> <C-w>k -noremap <C-l> <C-w>l +noremap <c-h> <c-w>h +noremap <c-j> <c-w>j +noremap <c-k> <c-w>k +noremap <c-l> <c-w>l " Easier search navigation nnoremap n nzz @@ -65,24 +65,36 @@ set wildmenu set path+=** " Create custom statusline +function! GitBranch() + return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") +endfunction + +function! StatuslineGit() + let l:branchname = GitBranch() + return strlen(l:branchname) > 0?' '.l:branchname.' ':'' +endfunction + set showmode set laststatus=2 set statusline= +set statusline+=%#PmenuSel# +set statusline+=%{StatuslineGit()} set statusline+=%#LineNr# set statusline+=\ %F set statusline+=%m\ set statusline+=%r\ set statusline+=%h\ -set statusline+=\ %= -set statusline+=%#CursorColumn# -set statusline+=\ %y +set statusline+=%= +set statusline+=%#Pmenu# +set statusline+=%y set statusline+=\ %{&fileencoding?&fileencoding:&encoding} set statusline+=\[%{&fileformat}\] set statusline+=\ %p%% -set statusline+=\ %l:%c\ +set statusline+=\ %l:%c " Create MakeTags command for ctags command! MakeTags !ctags -R . +noremap <c-r> :MakeTags<cr> " Detect filetype filetype plugin indent on