Skip to content

Commit

Permalink
fix enf of line
Browse files Browse the repository at this point in the history
  • Loading branch information
danwetherald committed Feb 10, 2022
1 parent 0f8f577 commit 065db24
Show file tree
Hide file tree
Showing 11 changed files with 9,943 additions and 52 deletions.
6 changes: 3 additions & 3 deletions hammerspoon/bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ for key, app in pairs(applicationHotkeys) do
end)
end

hs.hotkey.bind({}, "f8", function()
hs.spotify.playpause()
end)
-- hs.hotkey.bind({}, "f8", function()
-- hs.spotify.playpause()
-- end)

hs.hotkey.bind(hyper, "escape", function()
hs.reload()
Expand Down
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 > 22 or hour < 7 then
if (eventType == hs.application.watcher.activated) then
if (appName == "kitty") then
hs.brightness.set(20)
-- hs.brightness.set(20)
else
hs.brightness.set(1)
-- hs.brightness.set(1)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions hammerspoon/monitors.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local path = "http://192.168.1.103:8123/api/services/scene/turn_on"
local path = "https://internetmoney.duckdns.org:8124/api/services/scene/turn_on"

-- local token = ""

Expand All @@ -21,10 +21,10 @@ function screenChanged(watcher)
hour = tonumber(os.date("%H"))

-- Turn on Home Assistant Scene
if hour >= 17 and hour <= 22 then
hs.http.post(path, night_payload, headers)
else
if hour >= 12 and hour <= 19 then
hs.http.post(path, day_payload, headers)
elseif hour <= 2 then
hs.http.post(path, night_payload, headers)
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions hammerspoon/wifi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ lastSSID = hs.wifi.currentNetwork()
function ssidChangedCallback()
newSSID = hs.wifi.currentNetwork()

local note = hs.notify.new({
title="Connected to WiFi",
informativeText="Now connected to " .. newSSID
}):send()
-- local note = hs.notify.new({
-- title="Connected to WiFi",
-- informativeText="Now connected to " .. newSSID
-- }):send()

hs.timer.doAfter(3, function ()
note:withdraw()
note = nil
end)
-- hs.timer.doAfter(3, function ()
-- note:withdraw()
-- note = nil
-- end)

if newSSID == homeSSID and lastSSID ~= homeSSID then
-- We just joined our home WiFi network
hs.audiodevice.defaultOutputDevice():setVolume(25)
elseif newSSID ~= homeSSID and lastSSID == homeSSID then
-- We just departed our home WiFi network
hs.audiodevice.defaultOutputDevice():setVolume(0)
hs.audiodevice.defaultOutputDevice():setVolume(5)
end

lastSSID = newSSID
Expand Down
21 changes: 14 additions & 7 deletions nvim/autoload/plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})

function! s:is_powershell(shell)
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
endfunction

function! s:isabsolute(dir) abort
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
Expand Down Expand Up @@ -238,6 +242,8 @@ function! plug#begin(...)
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
elseif has('nvim')
let home = stdpath('data') . '/plugged'
elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else
Expand All @@ -263,7 +269,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
\ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
\ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
Expand Down Expand Up @@ -401,7 +407,7 @@ function! plug#end()

for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
Expand Down Expand Up @@ -503,7 +509,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
Expand Down Expand Up @@ -984,7 +990,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
Expand Down Expand Up @@ -1204,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw

let s:clone_opt = []
" Set remote name, overriding a possible user git config's clone.defaultRemoteName
let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
Expand Down Expand Up @@ -2225,7 +2232,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
Expand Down Expand Up @@ -2277,7 +2284,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
else
Expand Down
28 changes: 21 additions & 7 deletions nvim/autoload/plug.vim.old
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})

function! s:is_powershell(shell)
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
endfunction

function! s:isabsolute(dir) abort
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
Expand Down Expand Up @@ -263,7 +267,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
\ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
\ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
Expand Down Expand Up @@ -503,7 +507,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
Expand Down Expand Up @@ -935,7 +939,7 @@ function! s:prepare(...)
call s:new_window()
endif

nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
if a:0 == 0
call s:finish_bindings()
endif
Expand All @@ -957,6 +961,15 @@ function! s:prepare(...)
endif
endfunction

function! s:close_pane()
if b:plug_preview == 1
pc
let b:plug_preview = -1
else
bd
endif
endfunction

function! s:assign_name()
" Assign buffer name
let prefix = '[Plugins]'
Expand All @@ -975,7 +988,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
Expand Down Expand Up @@ -1195,7 +1208,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw

let s:clone_opt = []
" Set remote name, overriding a possible user git config's clone.defaultRemoteName
let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
Expand Down Expand Up @@ -2216,7 +2230,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
Expand Down Expand Up @@ -2268,7 +2282,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
else
Expand Down
9 changes: 7 additions & 2 deletions nvim/coc-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"languageserver": {
"rescript": {
"enable": true,
"module": "~/.config/nvim/plugged/vim-rescript/rescript-vscode/extension/server/out/server.js",
"module": "~/.config/nvim/plugged/vim-rescript/server/out/server.js",
"args": ["--node-ipc"],
"filetypes": ["rescript"],
"rootPatterns": ["bsconfig.json"]
Expand All @@ -58,5 +58,10 @@
"solargraph.autoformat": true,
"solargraph.formatting": true,
"solargraph.completion": true,
"solargraph.hover": true
"solargraph.hover": true,

"coc.source.around.enabled": false,
"suggest.languageSourcePriority": 99,
"tabnine.priority": 98,
"coc.source.buffer.priority": 50
}
16 changes: 7 additions & 9 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ call plug#begin('~/dotfiles/nvim/plugged')
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
nnoremap <silent> $ g_
" helpers for dealing with other people's code
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
Expand Down Expand Up @@ -468,7 +468,6 @@ call plug#begin('~/dotfiles/nvim/plugged')
\ 'coc-css',
\ 'coc-json',
\ 'coc-tsserver',
\ 'coc-tslint-plugin',
\ 'coc-git',
\ 'coc-eslint',
\ 'coc-pairs',
Expand All @@ -478,20 +477,16 @@ call plug#begin('~/dotfiles/nvim/plugged')
\ 'coc-explorer',
\ 'coc-diagnostic',
\ 'coc-tailwindcss',
\ 'coc-reason',
\ 'coc-tabnine',
\ 'coc-solargraph',
\ 'coc-prisma',
\ 'coc-html',
\ 'coc-snippets',
\ 'coc-fzf-preview'
\ 'coc-fzf-preview',
\ 'coc-prisma'
\ ]

autocmd CursorHold * silent call CocActionAsync('highlight')

" coc-go
autocmd BufWritePre *.go :call CocAction('organizeImport')

" coc-prettier
command! -nargs=0 Prettier :CocCommand prettier.formatFile
nmap <leader>f :CocCommand prettier.formatFile<cr>
Expand Down Expand Up @@ -582,7 +577,7 @@ call plug#begin('~/dotfiles/nvim/plugged')
" }}}

" Rescript {{{
Plug 'rescript-lang/vim-rescript', {'tag': 'v1.3.0'}
Plug 'rescript-lang/vim-rescript'

autocmd BufWritePost *.res,*.resi silent RescriptFormat

Expand All @@ -595,6 +590,9 @@ call plug#begin('~/dotfiles/nvim/plugged')
" TypeScript {{{
Plug 'leafgarland/typescript-vim'
Plug 'ianks/vim-tsx'

autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart
autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear
" }}}

" Prisma {{{
Expand Down
Loading

0 comments on commit 065db24

Please sign in to comment.