Skip to content

Commit

Permalink
git open
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Jan 2, 2022
1 parent d571eaa commit 2c950af
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 76 deletions.
3 changes: 3 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
brew "black", restart_service: true
brew "brotli"
brew "cython"
brew "lighttpd"
brew "bat"
brew "fd"
brew "fish"
brew "git"
brew "htop"
Expand Down
5 changes: 4 additions & 1 deletion alias
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ alias vim="$EDITOR"
alias v="$EDITOR"
alias ver="version"
alias ..="cd .."
alias vw="vim-which"
# alias vw="vim-which"
alias ci="gh run list"
alias lg="lazygit"

alias d="bass source ~/bin/godir"
alias f="bass source ~/bin/gofile"
28 changes: 28 additions & 0 deletions bin/git-open
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Use git-sh-setup, similar to git-rebase
# https://www.kernel.org/pub/software/scm/git/docs/git-sh-setup.html
# https://github.com/git/git/blob/master/git-rebase.sh
# shellcheck disable=SC2034
OPTIONS_STUCKLONG=t
# shellcheck disable=SC2034
OPTIONS_KEEPDASHDASH=
# shellcheck disable=SC2034
OPTIONS_SPEC="\
git open [options]
git open [remote] [branch]
--
Opens the GitHub page for a repo/branch in your browser.
https://github.com/paulirish/git-open/
Available options are
c,commit! open current commit
i,issue! open issues page
s,suffix= append this suffix
p,print! just print the url
"

# https://github.com/koalaman/shellcheck/wiki/SC1090
# shellcheck source=/dev/null
SUBDIRECTORY_OK='Yes' . "$(git --exec-path)/git-sh-setup"

echo "ola"
4 changes: 4 additions & 0 deletions bin/godir
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Use fzf to move between directories:
cd $(fd -t d -H | fzf --cycle --reverse --color=border:#FFFFFF --preview="tree -L 1 {}" --bind="space:toggle-preview" --preview-window=wrap:hidden) && clear
16 changes: 16 additions & 0 deletions bin/gofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

FILE="$(fd -t f -H | fzf --reverse --preview="head -$LINES {}" --bind="space:toggle-preview" --preview-window=wrap:hidden)"

if [ -n "$FILE" ]; then
MIME=$(file $FILE --mime-type | head -n1 | sed 's%: % %' | awk '{print $2}')
echo $MIME
if [[ "$MIME" == "text/"* ]]; then
vim "$FILE"
else
open "$FILE" &
disown
exit
fi
fi

6 changes: 6 additions & 0 deletions bin/sync.all
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

sync.fisher
sync.nvchad
sync.nvlsp
sync.os
8 changes: 8 additions & 0 deletions bin/sync.fisher
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if type -q fisher; then
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fi

fisher install edc/bass
fisher update
File renamed without changes.
4 changes: 2 additions & 2 deletions config/kitty/kitty.conf
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ font_size 14.0
#: the second number is the margin between the tab bar and the
#: contents of the current tab.

# tab_bar_style fade
tab_bar_style slant

#: The tab bar style, can be one of:

Expand Down Expand Up @@ -1066,7 +1066,7 @@ font_size 14.0
#: Hide the kitty window from running tasks (⌘+Tab) on macOS. Changing
#: this setting by reloading the config is not supported.

# macos_quit_when_last_window_closed no
macos_quit_when_last_window_closed yes

#: Have kitty quit when all the top-level windows are closed. By
#: default, kitty will stay running, even with no open windows, as is
Expand Down
102 changes: 53 additions & 49 deletions config/nvim/lua/custom/init.lua
Original file line number Diff line number Diff line change
@@ -1,69 +1,73 @@
local hooks = require("core.hooks")

hooks.add("setup_mappings", function(map)
-- Keep it centered
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")
-- Keep it centered
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")

-- vim.cmd([[unmap autocmd BufNewFile,BufRead *.h setlocal filetype=c]])
map("n", "<leader>d", "<cmd>Dirvish %:p:h<cr>")
-- vim.cmd([[unmap autocmd BufNewFile,BufRead *.h setlocal filetype=c]])
map("n", "<leader>d", "<cmd>Dirvish %:p:h<cr>")

-- turn off search highlighting
map("n", "<leader><leader>", ":noh <CR>")
-- turn off search highlighting
map("n", "<leader><leader>", ":noh <CR>")

map("n", "q", "<nop>")
map("n", "q", "<nop>")

-- Keep selected text under cursor
vim.cmd([[ nnoremap * :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> ]])
-- Keep selected text under cursor
vim.cmd([[ nnoremap * :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> ]])

map("n", "<leader>ff", ":Telescope find_files <CR>")
map("n", "<leader>p", ":Telescope find_files <CR>")
map("n", "<leader>ff", ":Telescope find_files <CR>")
map("n", "<leader>p", ":Telescope find_files <CR>")

map("n", "<leader>gg", ":LazyGit<CR>")
map("n", "<leader>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>")
map("n", "<leader>gg", ":LazyGit<CR>")
map("n", "<leader>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>")

-- vim.cmd("unmap <c-n>")
-- vim.cmd("unmap <c-p>")
-- vim.cmd("unmap <c-n>")
-- vim.cmd("unmap <c-p>")

-- vim.cmd("unmap <tab>")
-- vim.cmd("unmap <s-tab>")
-- vim.cmd("unmap <tab>")
-- vim.cmd("unmap <s-tab>")
end)

hooks.add("install_plugins", function(use)
-- use {
-- "max397574/better-escape.nvim",
-- event = "InsertEnter",
-- }
-- use {
-- "max397574/better-escape.nvim",
-- event = "InsertEnter",
-- }

use({
"williamboman/nvim-lsp-installer",
config = function()
local lsp_installer = require("nvim-lsp-installer")
use({
"williamboman/nvim-lsp-installer",
config = function()
local lsp_installer = require("nvim-lsp-installer")

lsp_installer.on_server_ready(function(server)
local opts = {}
lsp_installer.on_server_ready(function(server)
local opts = {}

server:setup(opts)
vim.cmd([[ do User LspAttachBuffers ]])
end)
end,
})
use({ "justinmk/vim-dirvish", event = "VimEnter" })
use({ "wincent/scalpel", event = "BufRead" })
use({ "kdheepak/lazygit.nvim", event = "BufRead" })
use({ "blankname/vim-fish", event = "BufRead" })
use({
"jose-elias-alvarez/null-ls.nvim",
event = "BufRead",
config = function()
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua,
require("null-ls").builtins.formatting.shfmt,
},
})
end,
})
server:setup(opts)
vim.cmd([[ do User LspAttachBuffers ]])
end)
end,
})
use({ "justinmk/vim-dirvish", event = "VimEnter" })
use({ "wincent/scalpel", event = "BufRead" })
use({ "kdheepak/lazygit.nvim", event = "BufRead" })
use({ "blankname/vim-fish", event = "BufRead" })
use({
"jose-elias-alvarez/null-ls.nvim",
event = "BufRead",
config = function()
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua.with({
extra_args = { "--indent-width", "4" },
}),
require("null-ls").builtins.formatting.shfmt.with({
extra_args = { "-i", "4", "-ci" },
}),
},
})
end,
})
end)

vim.cmd([[autocmd BufNewFile,BufRead *.h setlocal filetype=c]])
12 changes: 0 additions & 12 deletions config/nvim/lua/init.lua

This file was deleted.

21 changes: 9 additions & 12 deletions install.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- ~/.config
- ~/.config/fish
- ~/.config/fish/functions
- ~/.config/git
- ~/.config/nvim
- ~/.config/nvim/lua/custom
- ~/opt
Expand All @@ -20,30 +21,26 @@
~/.alias: alias
~/.bash_profile: bash_profile
~/.bashrc: bashrc
~/.config/nvim/lua/custom/init.lua: config/nvim/lua/custom/init.lua
~/.config/nvim/lua/custom/chadrc.lua: config/nvim/lua/custom/chadrc.lua
~/.config/kitty/kitty.conf: config/kitty/kitty.conf
~/.config/kitty/current-theme.conf: config/kitty/current-theme.conf
~/.config/fish/config.fish: config/fish/config.fish
~/.config/fish/functions/fish_prompt.fish: config/fish/functions/fish_prompt.fish
~/.config/kitty/current-theme.conf: config/kitty/current-theme.conf
~/.config/kitty/kitty.conf: config/kitty/kitty.conf
~/.config/nvim/lua/custom/chadrc.lua: config/nvim/lua/custom/chadrc.lua
~/.config/nvim/lua/custom/init.lua: config/nvim/lua/custom/init.lua
~/.config/git/ignore: config/git/ignore
~/.exec_fish: exec_fish
~/.functions: functions
~/.gitconfig: gitconfig
~/.gitignore_global: gitignore_global
~/.ripgreprc: ripgreprc
~/.shell.config: shell.config
~/.vimrc: vimrc
~/.zshrc: zshrc
~/bin/sync.macos: bin/sync.macos
~/bin/sync.nvchad: bin/sync.nvchad
~/bin/sync.nvlsp: bin/sync.nvlsp
~/bin/sync.os: bin/sync.os
~/bin/:
glob: true
path: bin/*

- shell:
- [git submodule update --init --recursive, Installing submodules]
- ~/bin/sync.nvchad
- ~/bin/sync.nvlsp
- ~/bin/sync.os

- brewfile:
file: Brewfile
Expand Down

0 comments on commit 2c950af

Please sign in to comment.