Browse Source

Update vim with Vundle/new plugins

Switch to chunkwm tiling manager on mac
Use khd to capture keys for chunkwm
update zsh aliases and exports
remotes/remote_mirror_0048a893dc9c9faa373a1b34fba08204/master
Andrew Zah 1 year ago
parent
commit
14a638763f
Signed by: Andrew Zah <zah@andrewzah.com> GPG Key ID: 0AE942445EB70FAA
8 changed files with 388 additions and 17 deletions
  1. 97
    0
      .chunkwmrc
  2. 0
    5
      .gitconfig
  3. 146
    0
      .khdrc
  4. 11
    0
      .muttrc
  5. 110
    9
      .nvimrc
  6. 3
    1
      .zshrc
  7. 10
    0
      zsh/aliases.zsh
  8. 11
    2
      zsh/exports.zsh

+ 97
- 0
.chunkwmrc View File

@@ -0,0 +1,97 @@
#!/bin/bash

#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#

chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins

#
# NOTE: if enabled, chunkwm will monitor the specified plugin_dir
# and automatically reload any '.so' file that is changed.
#

chunkc core::hotload 1

#
# NOTE: the following are config variables for the chunkwm-tiling plugin.
#

chunkc set global_desktop_mode bsp
chunkc set 4_desktop_mode float
chunkc set 5_desktop_mode float

chunkc set 1_desktop_tree ~/.chunkwm_layouts/dev_1

chunkc set global_desktop_offset_top 10
chunkc set global_desktop_offset_bottom 10
chunkc set global_desktop_offset_left 10
chunkc set global_desktop_offset_right 10
chunkc set global_desktop_offset_gap 15

# chunkc set 3_desktop_offset_top 190

chunkc set desktop_padding_step_size 10.0
chunkc set desktop_gap_step_size 5.0

chunkc set bsp_spawn_left 1
chunkc set bsp_optimal_ratio 1.618
chunkc set bsp_split_mode optimal
chunkc set bsp_split_ratio 0.5

chunkc set window_focus_cycle monitor
chunkc set mouse_follows_focus 0
chunkc set window_float_next 0
chunkc set window_float_center 1
chunkc set window_region_locked 1

#
# NOTE: shell commands require escaped quotes
# to pass value containing a whitespace.
#
# chunkc set mouse_modifier \"cmd shift\"
chunkc set mouse_modifier fn

chunkc set preselect_border_color 0xffd75f5f
chunkc set preselect_border_width 5
chunkc set preselect_border_radius 0

#
# NOTE: these settings require chwm-sa.
# (https://github.com/koekeishiya/chwm-sa)
#

chunkc set window_float_topmost 0
chunkc set window_fade_inactive 0
chunkc set window_fade_alpha 0.85
chunkc set window_fade_duration 0.25
chunkc set window_use_cgs_move 0

#
# NOTE: the following are config variables for the chunkwm-border plugin.
#

chunkc set focused_border_color 0xff775759
chunkc set focused_border_width 5
chunkc set focused_border_radius 0
chunkc set focused_border_skip_floating 0

#
# NOTE: specify plugins to load when chunkwm starts.
# if chunkc plugin_dir is not set, the absolutepath is necessary.
#

chunkc core::load border.so
chunkc core::load tiling.so
chunkc core::load ffm.so

#
# NOTE: shell commands require escaped quotes
# to pass value containing a whitespace.
#

chunkc tiling::rule --owner Spotify --role AXWindow --subrole AXDialog --state tile
chunkc tiling::rule --owner Firefox --role AXWindow --subrole AXDialog --state tile
chunkc tiling::rule --owner Finder --name Copy --state float
chunkc tiling::rule --owner \"App Store\" --state float

+ 0
- 5
.gitconfig View File

@@ -10,9 +10,6 @@

# git add --all
aa = add --all

# pretty log
lg = log --color --graph --pretty=format:'%Cred%h%Creset %C(yellow) %G? %Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# delete branch
brdel = branch -D
@@ -94,8 +91,6 @@
insteadOf = gl:
[url "git@gitlab.com:"]
insteadOf = gls:
[url "git@github.com:"]
insteadOf = https://github.com/

[init]
templatedir = ~/.config/git/templates/init

+ 146
- 0
.khdrc View File

@@ -0,0 +1,146 @@
# reload config
cmd + alt + ctrl - r : khd -e "reload"

# open terminal, blazingly fast compared to iTerm/Hyper
cmd - return : open -na /Applications/Kitty.app

# focus window
alt - h : chunkc tiling::window --focus west
alt - j : chunkc tiling::window --focus south
alt - k : chunkc tiling::window --focus north
alt - l : chunkc tiling::window --focus east

cmd - j : chunkc tiling::window --focus prev
cmd - k : chunkc tiling::window --focus next

# equalize size of windows
shift + alt - 0 : chunkc tiling::desktop --equalize

# swap window
shift + alt - h : chunkc tiling::window --swap west
shift + alt - j : chunkc tiling::window --swap south
shift + alt - k : chunkc tiling::window --swap north
shift + alt - l : chunkc tiling::window --swap east

# move window
shift + cmd - h : chunkc tiling::window --warp west
shift + cmd - j : chunkc tiling::window --warp south
shift + cmd - k : chunkc tiling::window --warp north
shift + cmd - l : chunkc tiling::window --warp east

# move floating windows / windows on a floating space
shift + alt - up : chunkc tiling::window --warp-floating fullscreen
shift + alt - left : chunkc tiling::window --warp-floating left
shift + alt - right : chunkc tiling::window --warp-floating right
shift + cmd - left : chunkc tiling::window --warp-floating top-left
shift + cmd - right : chunkc tiling::window --warp-floating top-right
shift + ctrl - left : chunkc tiling::window --warp-floating bottom-left
shift + ctrl - right : chunkc tiling::window --warp-floating bottom-right

# send window to desktop
shift + alt - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
shift + alt - z : chunkc tiling::window --send-to-desktop prev
shift + alt - c : chunkc tiling::window --send-to-desktop next
shift + alt - 1 : chunkc tiling::window --send-to-desktop 1
shift + alt - 2 : chunkc tiling::window --send-to-desktop 2
shift + alt - 3 : chunkc tiling::window --send-to-desktop 3
shift + alt - 4 : chunkc tiling::window --send-to-desktop 4
shift + alt - 5 : chunkc tiling::window --send-to-desktop 5
shift + alt - 6 : chunkc tiling::window --send-to-desktop 6

# send window to desktop and switch desktop
shift + cmd - x : `id=$(chunkc get _last_active_desktop); chunkc tiling::window -d $id; khd -p "cmd + alt - $id" &> /dev/null`
shift + cmd - z : chunkc tiling::window -d prev; khd -p "cmd + alt - z"
shift + cmd - c : chunkc tiling::window -d next; khd -p "cmd + alt - c"
shift + cmd - 1 : chunkc tiling::window -d 1; khd -p "cmd + alt - 1"
shift + cmd - 2 : chunkc tiling::window -d 2; khd -p "cmd + alt - 2"
shift + cmd - 3 : chunkc tiling::window -d 3; khd -p "cmd + alt - 3"
shift + cmd - 4 : chunkc tiling::window -d 4; khd -p "cmd + alt - 4"
shift + cmd - 5 : chunkc tiling::window -d 5; khd -p "cmd + alt - 5"
shift + cmd - 6 : chunkc tiling::window -d 6; khd -p "cmd + alt - 6"

# switch to last active desktop
cmd + alt - x : `id=$(chunkc get _last_active_desktop); khd -p "cmd + alt - $id" &> /dev/null`

# focus monitor
ctrl + alt - z : chunkc tiling::monitor -f prev
ctrl + alt - c : chunkc tiling::monitor -f next
ctrl + alt - 1 : chunkc tiling::monitor -f 1
ctrl + alt - 2 : chunkc tiling::monitor -f 2
ctrl + alt - 3 : chunkc tiling::monitor -f 3

# send window to monitor and follow focus
ctrl + cmd - z : chunkc tiling::window --send-to-monitor prev; chunkc tiling::monitor -f prev
ctrl + cmd - c : chunkc tiling::window --send-to-monitor next; chunkc tiling::monitor -f next
ctrl + cmd - 1 : chunkc tiling::window --send-to-monitor 1; chunkc tiling::monitor -f 1
ctrl + cmd - 2 : chunkc tiling::window --send-to-monitor 2; chunkc tiling::monitor -f 2
ctrl + cmd - 3 : chunkc tiling::window --send-to-monitor 3; chunkc tiling::monitor -f 3

# increase region size
shift + alt - a : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge west
shift + alt - s : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge south
shift + alt - w : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge north
shift + alt - d : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge east

# decrease region size
shift + cmd - a : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge west
shift + cmd - s : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge south
shift + cmd - w : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge north
shift + cmd - d : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge east

# set insertion point for focused container
ctrl + alt - f : chunkc tiling::window --use-insertion-point cancel
ctrl + alt - h : chunkc tiling::window --use-insertion-point west
ctrl + alt - j : chunkc tiling::window --use-insertion-point south
ctrl + alt - k : chunkc tiling::window --use-insertion-point north
ctrl + alt - l : chunkc tiling::window --use-insertion-point east

# rotate tree
alt - r : chunkc tiling::desktop --rotate 90

# mirror tree y-axis
alt - y : chunkc tiling::desktop --mirror vertical

# mirror tree x-axis
alt - x : chunkc tiling::desktop --mirror horizontal

# toggle desktop offset
alt - a : chunkc tiling::desktop --toggle offset

# toggle window fullscreen
alt - f : chunkc tiling::window --toggle fullscreen

# toggle window native fullscreen
shift + alt - f : chunkc tiling::window --toggle native-fullscreen

# toggle window parent zoom
alt - d : chunkc tiling::window --toggle parent

# toggle window split type
alt - e : chunkc tiling::window --toggle split

# float / unfloat window
alt - t : chunkc tiling::window --toggle float

# toggle sticky, float and resize to picture-in-picture size
alt - s : chunkc tiling::window --toggle sticky;\
chunkc tiling::window --warp-floating pip-right

# float next window to be tiled
shift + alt - t : chunkc set window_float_next 1

# change layout of desktop
ctrl + alt - a : chunkc tiling::desktop --layout bsp
ctrl + alt - s : chunkc tiling::desktop --layout monocle
ctrl + alt - d : chunkc tiling::desktop --layout float

ctrl + alt - w : chunkc tiling::desktop --deserialize ~/.chunkwm_layouts/dev_1

# remap caps-lock to escape for this config only !!!
# macos sierra can also perform this remap for a given keyboard
- capslock : khd -p "- escape"

# key remap for norwegian layout \ { }
cmd - 7 : khd -p "shift + alt - 7"
cmd - 8 : khd -p "shift + alt - 8"
cmd - 9 : khd -p "shift + alt - 9"

+ 11
- 0
.muttrc View File

@@ -0,0 +1,11 @@
folder-hook 'zah_andrew_gmail' 'source ~/.mutt/account_zah_andrewzah.conf'
folder-hook 'zah_andrewzah' 'source ~/.mutt/account_zah_andrew_gmail.conf'

source ~/.mutt/account_zah_andrew_gmail.conf
#source ~/.mutt/account_zah_andrewzah.conf

macro index <f2> '<sync-mailbox><refresh><enter-command>source ~/.mutt/zah_andrewzah.conf<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><refresh><enter-command>source ~/.mutt/zah_andrew_gmail.conf<enter><change-folder>!<enter>'

# Fetch mail shortcut
bind index G imap-fetch-mail

+ 110
- 9
.nvimrc View File

@@ -1,9 +1,42 @@
set nocompatible
filetype off

" Leader key
let mapleader = ","

" Load plugins
execute pathogen#infect()
" Gruvbo
set rtp+=/usr/local/opt/fzf
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-fireplace'
Plugin 'venantius/vim-eastwood'
Plugin 'morhetz/gruvbox'
Plugin 'yuttie/comfortable-motion.vim'
Plugin 'fisadev/FixedTaskList.vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'luochen1990/rainbow'
Plugin 'tpope/vim-surround'
Plugin 'godlygeek/tabular'
Plugin 'bhurlow/vim-parinfer'
Plugin 'rosenfeld/conque-term'
Plugin 'scrooloose/nerdcommenter'
Plugin 'junegunn/fzf.vim'
Plugin 'majutsushi/tagbar'

call vundle#end()
filetype plugin on

set hidden

nnoremap ' `
nnoremap ` '

set title

set history=1000
" Gruvbox
set background=dark
" let g:gruvbox_italic = 1
colorscheme gruvbox
@@ -11,6 +44,7 @@ colorscheme gruvbox
filetype plugin indent on
runtime macros/matchit.vim

" Get out of insert mode with jj
inoremap jj <Esc>

syntax enable
@@ -26,14 +60,34 @@ nmap <leader>x :wq<cr>

set scrolloff=3


let g:fzf_tags_command = 'ctags --extra=+f -R'
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }

nmap <Leader>t :Tags<CR>
nmap <Leader>b :Buffers<CR>
nmap <c-p> :Files<cr>
" Ctrl-P
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
"let g:ctrlp_map = '<c-p>'
"let g:ctrlp_cmd = 'CtrlP'
"let g:ctrlp_working_path_mode = 'ra'

" oo/OO insert newline without entering INSERT
" nmap oo o<Esc>k
" nmap OO O<Esc>j
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>

set ruler

" Line Numbers
set number
@@ -67,6 +121,15 @@ set hls is
" nnoremap <silent> <C-l><C-l> :nohl<CR><C-l>
nnoremap <silent> <Leader>l :nohl<CR>

" Quick timeouts on key combinations.
set timeoutlen=300

set shortmess=atI

set incsearch
set ignorecase " Ignore case when searching...
set smartcase " Except when starting with a capital

" NerdTree
map <F2> :NERDTreeToggle<CR>

@@ -86,6 +149,29 @@ nnoremap <C-H> <C-W><C-H>
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>

" Double leader key for toggling visual-line mode
nmap <silent> <Leader><Leader> V
vmap <Leader><Leader> <Esc>

" When pressing <leader>cd switch to the directory of the open buffer
map <Leader>cd :lcd %:p:h<CR>:pwd<CR>

" Use backspace key for matchit.vim
nmap <BS> %
xmap <BS> %

" Disable arrow movement, resize splits instead.

let g:elite_mode = 1
if get(g:, 'elite_mode')
nnoremap <Up> :resize +2<CR>
nnoremap <Down> :resize -2<CR>
nnoremap <Left> :vertical resize +2<CR>
nnoremap <Right> :vertical resize -2<CR>
endif

let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"
" Autoset slang -> slim syntax highlighting
au BufRead,BufNewFile *.slang set filetype=slim

@@ -96,6 +182,21 @@ au BufRead,BufNewFile *.ecr set filetype=erb
nnoremap <leader>ss :call MakeSession()<cr>
nnoremap <leader>sl :call LoadSession()<cr>

" tagbar
nnoremap <silent> <c-b> :TagbarToggle<CR>

" Clojure
" au Filetype clojure nmap <c-c><c-k> :Require<cr>

" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo') && isdirectory(expand('~').'/.vim/backups')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif

set ssop-=options " do not store options (vimrc) in a session
"" Make and load method to save session per dir
function! MakeSession()

+ 3
- 1
.zshrc View File

@@ -6,9 +6,11 @@ source ~/.zsh/aliases.zsh
source ~/.zsh/functions.zsh
source ~/.zsh/history.zsh
source ~/.zsh/secret-exports.zsh
~/.zsh/macosx.sh

ZSH_THEME="theunraveler"

plugins=(git lein brew ruby wd)
plugins=(git lein brew ruby wd last-working-dir)

source $ZSH/oh-my-zsh.sh
source $ZSH/plugins/zsh-up/up.plugin.zsh

+ 10
- 0
zsh/aliases.zsh View File

@@ -3,3 +3,13 @@ alias ll="ls -al"
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"

alias git=hub

# Clojure
alias lr="lein repl"

# Docker
alias dcu="docker-compose up"
alias dcd="docker-compose down"
alias dcb="docker-compose build"

alias ctags="`brew --prefix`/bin/ctags -f ./.git/tags"

+ 11
- 2
zsh/exports.zsh View File

@@ -1,5 +1,4 @@
# PATH
export PATH=/usr/local/bin:$PATH~/bin:/usr/local/sbin:~/bin
#!/usr/bin/env bash

# ZSH
export ZSH=/Users/andrew/.oh-my-zsh
@@ -32,3 +31,13 @@ export EDITOR='nvim'
# Lang and Locale
export LANG='en_US.UTF-8';
export LC_ALL='en_US.UTF-8';

export LDFLAGS=-L/usr/local/opt/libxml2/lib
export CPPFLAGS=-I/usr/local/opt/libxml2/include
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

#########
# Apps
#########

export MAIN_SITE_DB_URL="postgres://kemalyst:kemalyst@localhost:5432/main_site_dev"

Loading…
Cancel
Save