Skip to content

Commit

Permalink
snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
danwetherald committed Nov 6, 2020
1 parent 4420526 commit 04a877d
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 12 deletions.
4 changes: 2 additions & 2 deletions hammerspoon/brightness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function appChanged(appName, eventType, appObject)
if hour > 18 or hour < 7 then
if (eventType == hs.application.watcher.activated) then
if (appName == "kitty") then
hs.brightness.set(40)
-- hs.brightness.set(30)
else
hs.brightness.set(1)
-- hs.brightness.set(1)
end
end
end
Expand Down
27 changes: 27 additions & 0 deletions hammerspoon/status.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local path = "http://192.168.1.103:8123/api/services/scene/turn_on"

local token = ""

local headers = {
["Authorization"] = "Bearer " .. token,
["Content-Type"] = "application/json"
}

local payload = [[ {"entity_id":"scene.officenightwork"} ]]

sessionWatcher = nil

function sessionChanged(eventType)
hour = tonumber(os.date("%H"))

-- After 6pm before 7am
if hour > 18 or hour < 7 then
if (eventType == hs.caffeinate.watcher.screensDidUnlock) then
hs.http.post(path, payload, headers)
end
end

end

sessionWatcher = hs.caffeinate.watcher.new(sessionChanged)
sessionWatcher:start()
2 changes: 1 addition & 1 deletion hammerspoon/windows.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-- Resize windows
local hyper = {
'cmd',
'ctrl'
Expand All @@ -8,6 +7,7 @@ hs.loadSpoon("MiroWindowsManager")

hs.window.animationDuration = 0.0

-- Resize windows
spoon.MiroWindowsManager:bindHotkeys({
up = { hyper, "up" },
right = { hyper, "right" },
Expand Down
37 changes: 37 additions & 0 deletions nvim/UltiSnips/rescript.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
snippet rc
@react.component
let make = () => {
$1
}
endsnippet

snippet rs
let ($1, $2) = React.useState(_ => $3)
endsnippet

snippet div.tw
<div className=%tw("$1")>$2</div>
endsnippet

snippet d.tw
<div className=%tw("$1")>
endsnippet

snippet s.make
style={ReactDOM.Style.make(~$1=$2, ())}
endsnippet

snippet r.s
{"$1"->React.string}
endsnippet

snippet switch
switch $1 {
| Some($2) => {
$3
}
| None => {
$4
}
}
endsnippet
2 changes: 1 addition & 1 deletion nvim/coc-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"coc.preferences.formatOnSaveFiletypes": [
"yaml",
"typescript",
"javascript",
"javascript.jsx",
"typescript.tsx",
"typescriptreact",
Expand Down Expand Up @@ -76,6 +75,7 @@
"sourceName": "shellcheck"
}
},
"editor.snippetSuggestions": "top",
"solargraph.useBundler": false,
"solargraph.bundlerPath": "/Users/danwetherald/.rbenv/versions/2.6.5/bin/bundle",
"solargraph.autoformat": true,
Expand Down
11 changes: 3 additions & 8 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,6 @@ call plug#begin('~/dotfiles/nvim/plugged')
" enables repeating other supported plugins with the . command
Plug 'tpope/vim-repeat'

" https://github.com/norcalli/nvim-colorizer.lua/blob/master/README.md
Plug 'norcalli/nvim-colorizer.lua'

" detect indent style (tabs vs. spaces)
Plug 'tpope/vim-sleuth'

Expand Down Expand Up @@ -473,6 +470,7 @@ call plug#begin('~/dotfiles/nvim/plugged')

" UltiSnips {{{
Plug 'SirVer/ultisnips' " Snippets plugin
Plug 'honza/vim-snippets'
let g:UltiSnipsExpandTrigger="<C-l>"
let g:UltiSnipsJumpForwardTrigger="<C-j>"
let g:UltiSnipsJumpBackwardTrigger="<C-k>"
Expand All @@ -496,9 +494,7 @@ call plug#begin('~/dotfiles/nvim/plugged')
\ 'coc-pairs',
\ 'coc-sh',
\ 'coc-vimlsp',
\ 'coc-emmet',
\ 'coc-prettier',
\ 'coc-ultisnips',
\ 'coc-explorer',
\ 'coc-diagnostic',
\ 'coc-tailwindcss',
Expand All @@ -509,7 +505,8 @@ call plug#begin('~/dotfiles/nvim/plugged')
\ 'coc-prisma',
\ 'coc-html',
\ 'coc-graphql',
\ 'coc-go'
\ 'coc-go',
\ 'coc-snippets'
\ ]

autocmd CursorHold * silent call CocActionAsync('highlight')
Expand Down Expand Up @@ -636,8 +633,6 @@ call plug#begin('~/dotfiles/nvim/plugged')

call plug#end()

lua require 'colorizer'.setup()

" Colorscheme and final setup {{{
" This call must happen after the plug#end() call to ensure
" that the colorschemes have been loaded
Expand Down

0 comments on commit 04a877d

Please sign in to comment.