master
michael 2022-03-03 23:39:50 -08:00
parent b090d42e78
commit 03c7e76266
2 changed files with 119 additions and 14 deletions

View File

@ -1,11 +1,10 @@
wf=hs.window.filter
browser = "Brave Browser"
-- Open new / focus existing terminal window in current desktop space
hs.hotkey.bind({"cmd", "ctrl"}, "T", function()
wf_iterm2 = wf.new(false):setAppFilter("iTerm2", {currentSpace=true})
wf_iterm2 = wf.new(false):setAppFilter("iTerm2", {currentSpace=true, visible=true})
local wins = wf_iterm2:getWindows()
local count = 0
@ -29,7 +28,7 @@ end)
hs.hotkey.bind({"cmd", "ctrl"}, "W", function()
wf_browser = wf.new(false):setAppFilter(browser, {currentSpace=true})
wf_browser = wf.new(false):setAppFilter(browser, {currentSpace=true, visible=true})
local wins = wf_browser:getWindows()
local count = 0
@ -49,13 +48,31 @@ hs.hotkey.bind({"cmd", "ctrl"}, "W", function()
end)
-- CHROMIUM-BASED BROWSERS ONLY: Open new tab to right of current browser
hs.hotkey.bind({"cmd", "option"}, "T", function()
local focusedAppName = hs.window.focusedWindow():application():title()
if focusedAppName == browser
then
hs.osascript.applescript(string.format([[
tell application "System Events" to tell process "%s"
click menu item "New Tab to the Right" of menu "Tab" of menu bar 1
end tell
]], focusedAppName))
else
hs.notify.new({title=string.format("%s not focused.", browser)}):send()
end
end)
-- Open new / focus existing vscode window in current desktop space
hs.hotkey.bind({"cmd", "ctrl"}, "C", function()
hs.hotkey.bind({"cmd", "ctrl"}, "V", function()
local app = "Code"
wf_app = wf.new(false):setAppFilter(app, {currentSpace=true})
wf_app = wf.new(false):setAppFilter(app, {currentSpace=true, visible=true})
local wins = wf_app:getWindows()
local count = 0
@ -77,12 +94,12 @@ hs.hotkey.bind({"cmd", "ctrl"}, "C", function()
end)
-- Open new / focus existing VimR window in current desktop space
-- Open new / focus existing g/n/mac/vim(r) window in current desktop space
hs.hotkey.bind({"cmd", "ctrl"}, "V", function()
local app = "VimR"
hs.hotkey.bind({"cmd", "ctrl"}, "E", function()
local app = "MacVim"
wf_app = wf.new(false):setAppFilter(app, {currentSpace=true})
wf_app = wf.new(false):setAppFilter(app, {currentSpace=true, visible=true})
local wins = wf_app:getWindows()
local count = 0
@ -92,10 +109,9 @@ hs.hotkey.bind({"cmd", "ctrl"}, "V", function()
then
wf_app:getWindows()[1]:focus()
else
hs.osascript.applescript(string.format([[
tell application "System Events" to tell process "%s"
click menu item "New" of menu "File" of menu bar 1
click menu item "New Window" of menu "File" of menu bar 1
set frontmost to true
end tell
]], app))
@ -105,6 +121,23 @@ hs.hotkey.bind({"cmd", "ctrl"}, "V", function()
end)
-- Show Desktop (like windows or KDE)
hs.hotkey.bind({"alt"}, "d", function()
hs.eventtap.keyStroke({"fn"}, "f11")
end)
-- Switch Desktops (like windows or KDE)
hs.hotkey.bind({"ctrl", "alt"}, "left", function()
hs.eventtap.keyStroke({"ctrl"}, "left")
end)
hs.hotkey.bind({"ctrl", "alt"}, "right", function()
hs.eventtap.keyStroke({"ctrl"}, "right")
end)
-- Expose Windows (Mission Control)
hs.hotkey.bind({"alt"}, "tab", function()
@ -115,7 +148,7 @@ end)
hs.hotkey.bind({"cmd", "shift", "ctrl"}, "C", function()
hs.pasteboard.setContents("")
hs.notify.new({title="Bazinga", informativeText="System clipboard has been cleared."}):send()
hs.notify.new({title="Cleared clipboard."}):send()
end)
-- The ShiftIt Alternative
@ -144,4 +177,3 @@ hs.hotkey.bind(mash, '[', function() hs.window.focusedWindow():move(units.upleft
hs.hotkey.bind(mash, ';', function() hs.window.focusedWindow():move(units.botleft50, nil, true) end)
hs.hotkey.bind(mash, "'", function() hs.window.focusedWindow():move(units.botright50, nil, true) end)
hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():move(units.maximum, nil, true) end)

73
config/vim/vimrc Normal file
View File

@ -0,0 +1,73 @@
" Win behavior
" source $VIMRUNTIME/mswin.vim
" behave mswin
" Window height
" set lines=32 columns=110
" Preferences
set encoding=utf-8
set autochdir
set shiftwidth=4
set tabstop=4
set linebreak
set breakindent
set autoindent
set wrap
set nobinary
set relativenumber
syntax on
set belloff=all
set guifont=CaskaydiaCove\ Nerd\ Font:h12
" Aliases
cnoreabbrev ge browse confirm e
cnoreabbrev ! aliasrun
" Plugins
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'flazz/vim-colorschemes'
Plug 'tomlion/vim-solidity'
Plug 'zah/nim.vim'
Plug 'NLKNguyen/papercolortheme'
Plug 'ackyshake/VimCompletesMe'
Plug 'preservim/nerdtree'
call plug#end()
" Theming
set t_Co=256
set background=dark
colorscheme PaperColor
let g:airline_powerline_fonts = 1
let g:airline_theme = 'powerlineish'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
" Navigation & Shortcuts
" NERDTree Stuff
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" Copy/paste stuff
" inoremap <C-c> "+y
" inoremap <C-v> <C-o>:"+p<CR>
" Tab stuff
nnoremap <A-1> 1gt
nnoremap <A-2> 2gt
nnoremap <A-3> 3gt
nnoremap <A-4> 4gt
nnoremap <A-5> 5gt
nnoremap <A-6> 6gt
nnoremap <A-7> 7gt
nnoremap <A-8> 8gt
nnoremap <A-9> 9gt
nnoremap <A-0> 10gt-