Skip to content

Commit

Permalink
better fzf rg
Browse files Browse the repository at this point in the history
  • Loading branch information
danwetherald committed Jan 14, 2021
1 parent c6535a2 commit 28583d2
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion hammerspoon/brightness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appWatcher = nil
function appChanged(appName, eventType, appObject)
hour = tonumber(os.date("%H"))

if hour > 21 or hour < 7 then
if hour > 20 or hour < 7 then
if (eventType == hs.application.watcher.activated) then
if (appName == "kitty") then
hs.brightness.set(30)
Expand Down
2 changes: 1 addition & 1 deletion hammerspoon/monitors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function screenChanged(watcher)
hour = tonumber(os.date("%H"))

-- Turn on Home Assistant Scene
if hour >= 16 or hour < 7 then
if hour >= 17 and hour <= 22 then
hs.http.post(path, night_payload, headers)
else
hs.http.post(path, day_payload, headers)
Expand Down
2 changes: 1 addition & 1 deletion kitty/kitty.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
bold_font Operator Mono Medium
italic_font Operator Mono Lig Book Italic
bold_italic_font Operator Mono Medium Italic
font_size 15.0
font_size 16.0

# font_family Victor Mono
# bold_font Victor Mono Bold
Expand Down
2 changes: 1 addition & 1 deletion nvim/autoload/plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ while 1 " Without TCO, Vim stack is bound to explode
let [error, _] = s:git_validate(spec, 0)
if empty(error)
if pull
let cmd = ['git', 'fetch']
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
call extend(cmd, ['--depth', '99999999'])
endif
Expand Down
7 changes: 4 additions & 3 deletions nvim/autoload/plug.vim.old
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,9 @@ function! s:checkout(spec)
let sha = a:spec.commit
let output = s:git_revision(a:spec.dir)
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
let output = s:system(
\ 'git -c credential.helper= fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
endif
return output
endfunction
Expand Down Expand Up @@ -1847,7 +1848,7 @@ class Plugin(object):
self.write(Action.UPDATE, self.name, ['Updating ...'])
callback = functools.partial(self.write, Action.UPDATE, self.name)
fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else ''
cmd = 'git -c credential.helper= fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
com = Command(cmd, self.args['dir'], G_TIMEOUT, callback)
result = com.execute(G_RETRIES)
self.write(Action.DONE, self.name, result[-1:])
Expand Down Expand Up @@ -2155,7 +2156,7 @@ function! s:update_ruby()
if pull
log.call name, 'Updating ...', :update
fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : ''
bt.call "#{chdir} && git -c credential.helper= fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
else
[true, skip]
end
Expand Down
9 changes: 4 additions & 5 deletions nvim/coc-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"diagnostic.infoSign": "",
"diagnostic.hintSign": "",
"git.addGBlameToBufferVar": true,
"graphql.filetypes": ["graphql", "javascript", "javascriptreact", "typescript", "typescriptreact", "graphqls"],
"graphql.watcherPattern": "**/*.{graphql,gql,graphqls}",
"coc.preferences.formatOnSaveFiletypes": [
"yaml",
"typescript",
Expand All @@ -26,8 +24,9 @@
"javascriptreact",
"reason",
"ruby",
"graphql",
"go"
"go",
"rust",
"prisma"
],
"explorer.icon.enableNerdfont": true,
"explorer.sources": [
Expand Down Expand Up @@ -79,7 +78,7 @@
"languageserver": {
"rescript": {
"enable": true,
"module": "~/dotfiles/nvim/lang_servers/rescript-vscode/server/out/server.js",
"module": "~/.config/nvim/plugged/vim-rescript/rescript-vscode/extension/server/out/server.js",
"args": ["--node-ipc"],
"filetypes": ["rescript"],
"rootPatterns": ["bsconfig.json"]
Expand Down
50 changes: 37 additions & 13 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ call plug#begin('~/dotfiles/nvim/plugged')

let g:fzf_layout = { 'down': '~25%' }
let g:grepprg='rg --vimgrep'
" let g:rg_find_command = 'rg --files --follow -g "!{.config,etc,node_modules,.git,target,.reast,.d,.cm,.DS_Store,.bs.js}/*"'
let $FZF_DEFAULT_COMMAND = 'rg --files --follow -g "!{.config,etc,node_modules,.git,target,.reast,.d,.cm,.DS_Store,.bs.js}/*"'

function! RipgrepFzf(query, fullscreen)
Expand All @@ -417,10 +416,20 @@ call plug#begin('~/dotfiles/nvim/plugged')
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction

command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)

function! s:find_git_root()
return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
endfunction
command! ProjectFiles execute 'Files' s:find_git_root()

command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)

nmap <silent> <leader>t :FZF<cr>
nmap <silent> <leader>r :RG<cr>
nmap <silent> <leader>t :ProjectFiles<cr>
nmap <silent> <leader>r :GGrep<cr>
nmap <silent> <leader>s :GFiles?<cr>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
Expand Down Expand Up @@ -477,7 +486,7 @@ call plug#begin('~/dotfiles/nvim/plugged')
" }}}

" GraphQL {{{
Plug 'jparise/vim-graphql'
" Plug 'jparise/vim-graphql'
" }}}"

" coc {{{
Expand All @@ -503,9 +512,11 @@ call plug#begin('~/dotfiles/nvim/plugged')
\ 'coc-solargraph',
\ 'coc-prisma',
\ 'coc-html',
\ 'coc-graphql',
\ 'coc-go',
\ 'coc-snippets'
\ 'coc-rls',
\ 'coc-rust-analyzer',
\ 'coc-snippets',
\ 'coc-fzf-preview'
\ ]

autocmd CursorHold * silent call CocActionAsync('highlight')
Expand Down Expand Up @@ -603,23 +614,36 @@ call plug#begin('~/dotfiles/nvim/plugged')

" ReasonML {{{
Plug 'reasonml-editor/vim-reason-plus'
Plug 'rescript-lang/vim-rescript'
" }}}

let g:rescript_type_hint_bin = "~/dotfiles/nvim/lang_servers/reason-language-server/bin.exe"
" Rescript {{{
Plug 'rescript-lang/vim-rescript', {'tag': 'v1.2.0'}

autocmd BufWritePost *.res,*.resi silent RescriptFormat

augroup rescriptFixes
autocmd!
autocmd FileType rescript call rescript#ChangeBinPaths()
augroup END
" }}}
" augroup rescriptFixes
" autocmd!
" autocmd FileType rescript call rescript#ChangeBinPaths()
" augroup END
" }}}"

" TypeScript {{{
Plug 'leafgarland/typescript-vim'
Plug 'ianks/vim-tsx'
" }}}

" Prisma {{{
Plug 'pantharshit00/vim-prisma'
" }}}

" Rust {{{
Plug 'rust-lang/rust.vim'

let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
" }}}

" Styles {{{
Plug 'wavded/vim-stylus', { 'for': ['stylus', 'markdown'] }
Plug 'groenewege/vim-less', { 'for': 'less' }
Expand Down

0 comments on commit 28583d2

Please sign in to comment.