Skip to content

Commit

Permalink
big chore
Browse files Browse the repository at this point in the history
  • Loading branch information
lttr committed Nov 7, 2022
1 parent a813ad4 commit d78a981
Show file tree
Hide file tree
Showing 16 changed files with 209 additions and 99 deletions.
36 changes: 32 additions & 4 deletions aliases
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,32 @@ alias xmlstar="xmlstarlet"
# Git
# =================================================================


git_default_branch() {
local branch
# First look for my custom file named 'deafult_branch' in the git repo,
# where the name of the default branch should be specified
for dir in "." ".." "../.." "../../.."; do
key_file=$dir/.git/default_branch
if [ -f "$key_file" ]; then
branch=`cat "$key_file"`
break
fi
done
if [ -z "$branch" ]; then
branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's#^refs/remotes/origin/##')
elif [ -z "$branch" ]; then
branch=$(git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d ":" -f 2)
elif [ -z "$branch" ]; then
branch="master"
fi
echo $branch
}

gcom() {
git switch $(git_default_branch)
}

alias ga="git add"
alias gaa="git add --all"
alias gco="git switch"
Expand Down Expand Up @@ -177,9 +203,11 @@ alias gre="git restore"
alias gre.="git restore ."
alias gres='git restore --staged'
alias greb="git rebase"
alias grem="git rebase `git_default_branch`"
git-rem() { git rebase `git_default_branch` }
alias grem="git-rem"
alias grec="git rebase --continue"
alias gfem="git fetch origin `git_default_branch`:`git_default_branch`; git log --oneline `git_default_branch`@{1}..`git_default_branch`"
git-fem() { git fetch origin `git_default_branch`:`git_default_branch`; git log --oneline `git_default_branch` @{1}..`git_default_branch` }
alias gfem="git-fem"
alias gst="git status"
alias gs="git status -s"
alias grs="git recursive-status"
Expand All @@ -188,8 +216,8 @@ alias gul='git pull'
alias gundo='git reset --mixed HEAD~'
alias standup="git-standup"
alias myweek="git standup -d 8 -D 'short'"
alias gogo="git checkout `git_default_branch` && git pull && git gone"

git-gogo() { git checkout `git_default_branch` && git pull && git gone }
alias gogo="git-gogo"
alias i="issue"
alias il="gh issue list"
alias ila="gh issue list --state all"
Expand Down
74 changes: 41 additions & 33 deletions bootstrap/configuration/customInstalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,45 @@ export const aptUpdate = {
aptUpdate: {},
};

const brewPackages = [
"delta",
"docker",
"docker-compose",
"fzf",
"gh",
"neovim",
"potrace",
"rg",
"sd",
"zoxide",
];

const voltaPackages = [
"browser-sync",
"ddg",
"degit",
"dploy",
"eslint",
"eslint_d",
"firebase",
"git-standup",
"hygen",
"json",
"luafmt",
"netlify",
"node",
"npm-why",
"nx",
"open-cli",
"pnpm",
"pollinate",
"prettier",
"prettierd",
"stylelint",
"tsserver",
"typescript-language-server",
];

export const customInstalls: Config[] = [
// preparation
aptUpdate,
Expand All @@ -61,37 +100,6 @@ export const customInstalls: Config[] = [
antidote,
// custom applications
googleChrome,
{ webInstall: { name: "node", dependsOn: webi } },
{ webInstall: { name: "rg", dependsOn: webi } },
{ brew: { name: "delta", dependsOn: brew } },
{ brew: { name: "docker", dependsOn: brew } },
{ brew: { name: "docker-compose", dependsOn: brew } },
{ brew: { name: "fzf", dependsOn: brew } },
{ brew: { name: "gh", dependsOn: brew } },
{ brew: { name: "neovim", dependsOn: brew } },
{ brew: { name: "potrace", dependsOn: brew } },
{ brew: { name: "sd", dependsOn: brew } },
{ brew: { name: "zoxide", dependsOn: brew } },
{ volta: { name: "prettierd", dependsOn: volta } },
{ volta: { name: "browser-sync", dependsOn: volta } },
{ volta: { name: "ddg", dependsOn: volta } },
{ volta: { name: "degit", dependsOn: volta } },
{ volta: { name: "dploy", dependsOn: volta } },
{ volta: { name: "eslint", dependsOn: volta } },
{ volta: { name: "eslint_d", dependsOn: volta } },
{ volta: { name: "firebase", dependsOn: volta } },
{ volta: { name: "git-standup", dependsOn: volta } },
{ volta: { name: "hygen", dependsOn: volta } },
{ volta: { name: "json", dependsOn: volta } },
{ volta: { name: "luafmt", dependsOn: volta } },
{ volta: { name: "netlify", dependsOn: volta } },
{ volta: { name: "npm-why", dependsOn: volta } },
{ volta: { name: "nx", dependsOn: volta } },
{ volta: { name: "open-cli", dependsOn: volta } },
{ volta: { name: "pnpm", dependsOn: volta } },
{ volta: { name: "pollinate", dependsOn: volta } },
{ volta: { name: "prettier", dependsOn: volta } },
{ volta: { name: "stylelint", dependsOn: volta } },
{ volta: { name: "tsserver", dependsOn: volta } },
{ volta: { name: "typescript-language-server", dependsOn: volta } },
...brewPackages.map((name) => ({ brew: { name, dependsOn: brew } })),
...voltaPackages.map((name) => ({ volta: { name, dependsOn: volta } })),
];
25 changes: 0 additions & 25 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -357,31 +357,6 @@ mrs() {
glab mr list
}

git_default_branch() {
local branch
# First look for my custom file named 'deafult_branch' in the git repo,
# where the name of the default branch should be specified
for dir in "." ".." "../.." "../../.."; do
key_file=$dir/.git/default_branch
if [ -f "$key_file" ]; then
branch=`cat "$key_file"`
break
fi
done
if [ -z "$branch" ]; then
branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's#^refs/remotes/origin/##')
elif [ -z "$branch" ]; then
branch=$(git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d ":" -f 2)
elif [ -z "$branch" ]; then
branch="master"
fi
echo $branch
}

gcom() {
git switch $(git_default_branch)
}


# =================================================================
# Code
Expand Down
3 changes: 3 additions & 0 deletions nvim/after/plugin/bqf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- https://github.com/kevinhwang91/nvim-bqf#integrate-with-other-plugins

require "bqf".setup {}
3 changes: 2 additions & 1 deletion nvim/after/plugin/luasnip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
-- https://github.com/saadparwaiz1/cmp_luasnip
-- https://github.com/rafamadriz/friendly-snippets

require("luasnip.loaders.from_vscode").lazy_load({paths = {"~/dotfiles/nvim/snippets/"}})
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "~/dotfiles/nvim/snippets/" } })
require("luasnip").filetype_extend("javascript", { "javascriptreact" })
1 change: 1 addition & 0 deletions nvim/after/plugin/neotest.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- https://github.com/nvim-neotest/neotest
require("neotest").setup(
{
adapters = {
Expand Down
8 changes: 7 additions & 1 deletion nvim/after/plugin/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

require "nvim-tree".setup {
sync_root_with_cwd = true,
select_prompts = true
select_prompts = true,
git = {
ignore = false
},
notify = {
threshold = vim.log.levels.WARN
}
}
3 changes: 3 additions & 0 deletions nvim/after/plugin/rooter.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
" https://github.com/airblade/vim-rooter

let g:rooter_manual_only = 1
39 changes: 39 additions & 0 deletions nvim/after/plugin/spectre.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,44 @@ require "spectre".setup {
cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
desc = "send all item to quickfix"
}
},
find_engine = {
-- rg is map with finder_cmd
["rg"] = {
cmd = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
-- added
"--smart-case",
"--hidden",
"--no-ignore",
"--glob",
"!.git",
"--glob",
"!node_modules",
"--glob",
"!build/",
"--glob",
"!dist/",
"--glob",
"!.lock"
},
options = {
["ignore-case"] = {
value = "--ignore-case",
icon = "[I]",
desc = "ignore case"
},
["hidden"] = {
value = "--hidden",
desc = "hidden file",
icon = "[H]"
}
}
}
}
}
33 changes: 31 additions & 2 deletions nvim/after/plugin/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require "telescope".setup {
flip_columns = 140
}
},
file_ignore_patterns = {"^node_modules/", "%.lock"}, -- lua regexes
file_ignore_patterns = { "^node_modules/", "%.lock" }, -- lua regexes
path_display = function(_, path)
return path:gsub(vim.env.HOME .. "/", "")
end,
Expand All @@ -46,10 +46,39 @@ require "telescope".setup {
["<C-e>"] = live_grep_args_actions.quote_prompt(),
["<C-k>"] = actions.move_selection_previous
}
},
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--hidden",
"--no-ignore",
"--glob",
"!.git",
"--glob",
"!node_modules",
"--glob",
"!build/",
"--glob",
"!dist/",
"--glob",
"!.lock"
}
},
recent_files = {
ignore_patterns = {"/%.local/", "/tmp/"}
ignore_patterns = { "/%.local/", "/tmp/" }
},
file_browser = {
initial_mode = "normal",
mappings = {
i = {
["<Esc>"] = false
}
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions nvim/after/plugin/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,3 @@ require "nvim-treesitter.configs".setup {
}
}
}

require "nvim-treesitter.highlight".set_custom_captures {}
24 changes: 12 additions & 12 deletions nvim/lua/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cmp.setup {
fallback()
end
end,
{"i", "s"}
{ "i", "s" }
),
["<S-Tab>"] = cmp.mapping(
function(fallback)
Expand All @@ -81,18 +81,18 @@ cmp.setup {
fallback()
end
end,
{"i", "s"}
{ "i", "s" }
)
},
sources = {
{name = "cmp_jira"},
{ name = "cmp_jira" },
-- {name = "cmp_vue_components"},
{name = "git"},
{name = "nvim_lsp_signature_help"},
{name = "nvim_lua"},
{name = "nvim_lsp", max_item_count = 10},
{name = "path"},
{name = "luasnip"}
{ name = "git" },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua" },
{ name = "nvim_lsp", max_item_count = 10 },
{ name = "path" },
{ name = "luasnip" }
-- {name = "buffer", keyword_length = 5} -- too much noise
},
formatting = {
Expand All @@ -111,7 +111,7 @@ cmp.setup {

require("goto-preview").setup {}
require("cmp_jira").setup {
file_types = {"gitcommit"},
file_types = { "gitcommit" },
jira = {
-- email: optional, alternatively specify via $JIRA_USER_EMAIL
-- url: optional, alternatively specify via $JIRA_WORKSPACE_URL
Expand All @@ -121,8 +121,8 @@ require("cmp_jira").setup {
}
-- TODO finish plugin
require("cmp_vue_components").setup {
file_types = {"vue"}
file_types = { "vue" }
}
require("cmp_git").setup {
filetypes = {"gitcommit"}
filetypes = { "gitcommit" }
}
Loading

0 comments on commit d78a981

Please sign in to comment.