Compare commits

...

27 Commits

Author SHA1 Message Date
6f207d438e Make sure go directories exists 2023-03-26 15:31:39 +02:00
9c4dd4a112 Remove pyright lsp server 2023-03-26 15:31:17 +02:00
84a0ed4d1d Require httpie package from brew 2023-03-26 15:31:00 +02:00
2c2abb0fc8 Configure lspconfig for each lsp server required 2023-03-26 15:00:39 +02:00
b881418b33 Add golang to brew pkgs & go env vars to .profile 2023-03-26 14:56:49 +02:00
9a27a5c4de Add node@18 to default brew packages 2023-03-25 15:02:41 +01:00
7de8868891 Make sure lua LSP is installed by brew 2023-03-25 15:01:12 +01:00
bc5ea010d7 Unsure default lsp servers are installed by mason 2023-03-25 14:53:10 +01:00
36a509e619 Disable sumneko_lua mason package 2023-03-25 14:30:19 +01:00
d0f7f10220 Move config before setting up fish 2023-03-25 14:25:45 +01:00
1ebbf5b43f Profile converted to fish syntax 2023-03-25 14:23:13 +01:00
23fa1fd8d6 Start alacritty with bash calling default shell 2023-03-25 14:04:00 +01:00
a53bfa8d12 Scripts/ for misc, start with tbind 2023-03-25 14:03:25 +01:00
262db2054f Configure fish func with omf 2023-03-25 14:03:05 +01:00
6c61ad5b21 Try disable explicit default SHELL declaration 2023-03-25 14:02:22 +01:00
c1bcd8bd4f Use fenv (from omf) to source profile 2023-03-25 14:01:53 +01:00
66cc4fc9e2 Only add arm homebrew dir when uname matches 2023-03-25 14:00:31 +01:00
a6fe9541dd New keymap to toggle nvim tree sidebar file explorer 2023-03-25 11:33:35 +01:00
3528151d0f Load git completions on fish init 2023-03-25 11:33:12 +01:00
45e1724280 Open fish shell in alacritty & tmux 2023-03-25 11:32:43 +01:00
d1fe6943de Add homebrew path to .profile 2023-03-25 11:32:06 +01:00
fff77cf5d2 Place files in .config folder 2023-02-06 10:36:58 +01:00
f133917b3e Prevent alt key from escaping. 2023-02-06 10:36:39 +01:00
e248c9e09c Thin profile file exporting binary bath for homebrew & macports 2023-01-24 08:42:19 +01:00
9d1d142d4b Oh-my-fish configurations 2023-01-24 08:41:55 +01:00
667aba71a0 Custom fish abbreviations for git commands 2023-01-24 08:41:39 +01:00
3bcdfe159a Fish terminal config & color vars 2023-01-24 08:41:15 +01:00
10 changed files with 354 additions and 25 deletions

22
.profile Normal file
View File

@@ -0,0 +1,22 @@
# Setting PATH for Homebrew that should take precedence
# over system-provided programs
export PATH="/usr/local/bin:$PATH"
# Add homebrew arm64 install path if applicable
if test $(uname -m) = "arm64"
export PATH="/opt/homebrew/bin:$PATH"
end
# MacPorts Installer rddition on 2022-10-31_at_23:07:29: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Setting PATH for Python 3.11
# The original version is saved in .zprofile.pysave
# PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH"
# export PATH
# Setting go environment
export GOPATH=$HOME/dev/go
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:$GOPATH/bin:$GOROOT/bin"

View File

@@ -4,4 +4,11 @@ font:
family: SFMono Nerd Font
# Colors (Terminal.app)
alt_send_esc: false
# New shells should run fish
shell:
program: /bin/bash
args:
- -c
- $SHELL

View File

@@ -18,6 +18,7 @@ get_input_df_true () {
* ) echo "Please answer yes or no.";;
esac
done
echo ""
}
get_input_df_false () {
@@ -30,6 +31,7 @@ get_input_df_false () {
* ) echo "Please answer yes or no.";;
esac
done
echo ""
}
install_font () {
@@ -37,18 +39,19 @@ install_font () {
open $PWD/fonts/*
}
macos_capslock_shortcut() {
cp scripts/tbind.sh /usr/local/bin/tbind
chmod +x /usr/local/bin/tbind
echo "Created tmux capslock keymap command as tbind"
}
macos_capslock_keymap () {
CAPS_KEY=0x700000039
F10_KEY=0x700000043
DATA=$(printf '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":%s,"HIDKeyboardModifierMappingDst":%s}]}' $CAPS_KEY $F10_KEY)
hidutil property --set $DATA
echo "Successfully overwrote CAPS KEY to F10!"
macos_capslock_shortcut
tbind
}
get_config_files() {
CONFIG_FILES=$(find * -type f -path "**/*" ! -path ".*" ! -path "fonts/*")
CONFIG_FILES=$(find * -type f -path "**/*" ! -path ".*" ! -path "fonts/*" ! -path "scripts/*")
}
move_config_files () {
@@ -60,7 +63,7 @@ move_config_files () {
DIR=$( echo $file | cut -d/ -f 1 )
FILE=$( echo $file | cut -d/ -f 2 )
mkdir -p "$HOME/$DIR"
mkdir -p "$HOME/.config/$DIR"
cp $file "$HOME/.config/$file"
COUNT=$((COUNT + 1))
done <<< $CONFIG_FILES
@@ -68,6 +71,41 @@ move_config_files () {
printf "Moved %s config files!\n" $COUNT
}
move_profile_file () {
cp .profile $HOME
echo "Moved .profile file!"
}
install_packages_brew () {
declare -a packages=("cmake" "tree" "wget" "httpie" "jq" "ripgrep" "watch" "tmux" "fish" "lua-language-server" "node@18" "golang" "gh")
echo "Installing ${#packages[@]} packages from brew"
brew install --quiet "${packages[@]}"
}
configure_fish () {
brew install --quiet fish
# oh-my-fish does not exist
if [ ! -d "$HOME/.local/share/omf" ]; then
curl -s "https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install" > install
fish install --noninteractive
rm install
else
printf "oh-my-fish already configured!\n\n"
fi
}
configure_go () {
fish -c source $HOME/.profile
if ( grep -q GOPATH "$HOME/.profile" ) && [ ! -d $GOPATH ]; then
mkdir -p $GOPATH $GOPATH/{bin,pkg}
fi
}
# Promps for installing custom SF Mono font
# patched with devicons + more
get_input_df_false "Install custom font? (y/N) " install_font
@@ -77,9 +115,18 @@ if [ $MACOS ]; then
get_input_df_false "Add custom caps-lock to F10 keymap? (y/N) " macos_capslock_keymap
fi
get_input_df_true "Add .profile file? (Y/n) " move_profile_file
# Installed common packages from brew
get_input_df_true "Install brew packages? (Y/n) " install_packages_brew
# Get config files to copy info $HOME/.config
get_config_files
# Prompt copy config files to $HOME
get_input_df_true "Move config files to $HOME/.config? (Y/n) " move_config_files
echo "Configurating fish shell"
configure_fish
configure_go

185
fish/completions/git.fish Normal file
View File

@@ -0,0 +1,185 @@
abbr -a -- ga 'git add'
abbr -a -- gaa 'git add --all'
abbr -a -- gapa 'git add --patch'
abbr -a -- gau 'git add --update'
abbr -a -- gav 'git add --verbose'
abbr -a -- gap 'git apply'
abbr -a -- gapt 'git apply --3way'
abbr -a -- gb 'git branch'
abbr -a -- gba 'git branch --all'
abbr -a -- gbd 'git branch --delete'
abbr -a -- gbD 'git branch --delete --force'
abbr -a -- gbl 'git blame -b -w'
abbr -a -- gbnm 'git branch --no-merged'
abbr -a -- gbr 'git branch --remote'
abbr -a -- gbs 'git bisect'
abbr -a -- gbsb 'git bisect bad'
abbr -a -- gbsg 'git bisect good'
abbr -a -- gbsr 'git bisect reset'
abbr -a -- gbss 'git bisect start'
abbr -a -- gc 'git commit --verbose'
abbr -a -- gc ='git commit --verbose --amend'
abbr -a -- gcn ='git commit --verbose --no-edit --amend'
abbr -a -- gca 'git commit --verbose --all'
abbr -a -- gca ='git commit --verbose --all --amend'
abbr -a -- gcan ='git commit --verbose --all --no-edit --amend'
abbr -a -- gcans ='git commit --verbose --all --signoff --no-edit --amend'
abbr -a -- gcam 'git commit --all --message'
abbr -a -- gcsm 'git commit --signoff --message'
abbr -a -- gcas 'git commit --all --signoff'
abbr -a -- gcasm 'git commit --all --signoff --message'
abbr -a -- gcb 'git checkout -b'
abbr -a -- gcf 'git config --list'
abbr -a -- gcl 'git clone --recurse-submodules'
abbr -a -- gclean 'git clean --interactive -d'
abbr -a -- gpristine 'git reset --hard && git clean --force -dx'
abbr -a -- gcm 'git checkout $(git_main_branch)'
abbr -a -- gcd 'git checkout $(git_develop_branch)'
abbr -a -- gcmsg 'git commit --message'
abbr -a -- gco 'git checkout'
abbr -a -- gcor 'git checkout --recurse-submodules'
abbr -a -- gcount 'git shortlog --summary --numbered'
abbr -a -- gcp 'git cherry-pick'
abbr -a -- gcpa 'git cherry-pick --abort'
abbr -a -- gcpc 'git cherry-pick --continue'
abbr -a -- gcs 'git commit --gpg-sign'
abbr -a -- gcss 'git commit --gpg-sign --signoff'
abbr -a -- gcssm 'git commit --gpg-sign --signoff --message'
alias gd='git diff'
alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff'
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdup='git diff @{upstream}'
alias gdw='git diff --word-diff'
abbr -a -- ggpull 'git pull origin "$(git_current_branch)"'
abbr -a -- ggpush 'git push origin "$(git_current_branch)"'
abbr -a -- ggsup 'git branch --set-upstream-to=origin/$(git_current_branch)'
abbr -a -- gpsup 'git push --set-upstream origin $(git_current_branch)'
abbr -a -- ghh 'git help'
abbr -a -- gignore 'git update-index --assume-unchanged'
abbr -a -- gignored 'git ls-files -v | grep "^[[:lower:]]"'
abbr -a -- gk '\gitk --all --branches &!'
abbr -a -- gke '\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
abbr -a -- gl 'git pull'
abbr -a -- glg 'git log --stat'
abbr -a -- glgp 'git log --stat --patch'
abbr -a -- glgg 'git log --graph'
abbr -a -- glgga 'git log --graph --decorate --all'
abbr -a -- glgm 'git log --graph --max-count=10'
abbr -a -- glo 'git log --oneline --decorate'
abbr -a -- glol "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"
abbr -a -- glols "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat"
abbr -a -- glod "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
abbr -a -- glods "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
abbr -a -- glola "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all"
abbr -a -- glog 'git log --oneline --decorate --graph'
abbr -a -- gloga 'git log --oneline --decorate --graph --all'
abbr -a -- glp "_git_log_prettily"
abbr -a -- gm 'git merge'
abbr -a -- gmom 'git merge origin/$(git_main_branch)'
abbr -a -- gmtl 'git mergetool --no-prompt'
abbr -a -- gmtlvim 'git mergetool --no-prompt --tool=vimdiff'
abbr -a -- gmum 'git merge upstream/$(git_main_branch)'
abbr -a -- gma 'git merge --abort'
abbr -a -- gp 'git push'
abbr -a -- gpd 'git push --dry-run'
abbr -a -- gpf 'git push --force-with-lease'
abbr -a -- gpf ='git push --force'
abbr -a -- gpoat 'git push origin --all && git push origin --tags'
abbr -a -- gpr 'git pull --rebase'
abbr -a -- gpu 'git push upstream'
abbr -a -- gpv 'git push --verbose'
abbr -a -- gr 'git remote'
abbr -a -- gra 'git remote add'
abbr -a -- grb 'git rebase'
abbr -a -- grba 'git rebase --abort'
abbr -a -- grbc 'git rebase --continue'
abbr -a -- grbd 'git rebase $(git_develop_branch)'
abbr -a -- grbi 'git rebase --interactive'
abbr -a -- grbm 'git rebase $(git_main_branch)'
abbr -a -- grbom 'git rebase origin/$(git_main_branch)'
abbr -a -- grbo 'git rebase --onto'
abbr -a -- grbs 'git rebase --skip'
abbr -a -- grev 'git revert'
abbr -a -- grh 'git reset'
abbr -a -- grhh 'git reset --hard'
abbr -a -- groh 'git reset origin/$(git_current_branch) --hard'
abbr -a -- grm 'git rm'
abbr -a -- grmc 'git rm --cached'
abbr -a -- grmv 'git remote rename'
abbr -a -- grrm 'git remote remove'
abbr -a -- grs 'git restore'
abbr -a -- grset 'git remote set-url'
abbr -a -- grss 'git restore --source'
abbr -a -- grst 'git restore --staged'
abbr -a -- grt 'cd "$(git rev-parse --show-toplevel || echo .)"'
abbr -a -- gru 'git reset --'
abbr -a -- grup 'git remote update'
abbr -a -- grv 'git remote --verbose'
abbr -a -- gsb 'git status --short --branch'
abbr -a -- gsd 'git svn dcommit'
abbr -a -- gsh 'git show'
abbr -a -- gsi 'git submodule init'
abbr -a -- gsps 'git show --pretty=short --show-signature'
abbr -a -- gsr 'git svn rebase'
abbr -a -- gss 'git status --short'
abbr -a -- gst 'git status'
abbr -a -- gstaa 'git stash apply'
abbr -a -- gstc 'git stash clear'
abbr -a -- gstd 'git stash drop'
abbr -a -- gstl 'git stash list'
abbr -a -- gstp 'git stash pop'
abbr -a -- gsts 'git stash show --text'
abbr -a -- gstu 'gsta --include-untracked'
abbr -a -- gstall 'git stash --all'
abbr -a -- gsu 'git submodule update'
abbr -a -- gsw 'git switch'
abbr -a -- gswc 'git switch --create'
abbr -a -- gswm 'git switch $(git_main_branch)'
abbr -a -- gswd 'git switch $(git_develop_branch)'
abbr -a -- gts 'git tag --sign'
abbr -a -- gtv 'git tag | sort -V'
abbr -a -- gtl 'gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
abbr -a -- gunignore 'git update-index --no-assume-unchanged'
abbr -a -- gunwip 'git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1'
abbr -a -- gup 'git pull --rebase'
abbr -a -- gupv 'git pull --rebase --verbose'
abbr -a -- gupa 'git pull --rebase --autostash'
abbr -a -- gupav 'git pull --rebase --autostash --verbose'
abbr -a -- gupom 'git pull --rebase origin $(git_main_branch)'
abbr -a -- gupomi 'git pull --rebase=interactive origin $(git_main_branch)'
abbr -a -- glum 'git pull upstream $(git_main_branch)'
abbr -a -- gluc 'git pull upstream $(git_current_branch)'
abbr -a -- gwch 'git whatchanged -p --abbrev-commit --pretty=medium'
abbr -a -- gwip 'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
abbr -a -- gwt 'git worktree'
abbr -a -- gwta 'git worktree add'
abbr -a -- gwtls 'git worktree list'
abbr -a -- gwtmv 'git worktree move'
abbr -a -- gwtrm 'git worktree remove'
abbr -a -- gam 'git am'
abbr -a -- gamc 'git am --continue'
abbr -a -- gams 'git am --skip'
abbr -a -- gama 'git am --abort'
abbr -a -- gamscp 'git am --show-current-patch'

7
fish/conf.d/omf.fish Normal file
View File

@@ -0,0 +1,7 @@
# Path to Oh My Fish install.
set -q XDG_DATA_HOME
and set -gx OMF_PATH "$XDG_DATA_HOME/omf"
or set -gx OMF_PATH "$HOME/.local/share/omf"
# Load Oh My Fish configuration.
source $OMF_PATH/init.fish

15
fish/config.fish Normal file
View File

@@ -0,0 +1,15 @@
if status is-interactive
# Commands to run in interactive sessions can go here
end
source $HOME/.profile
# Common programs
abbr -a -- vi nvim
# File exploring
abbr -a -- l 'tree -L 1 -a'
abbr -a -- ll 'tree -L 2 -a'
# Git (loaded from completions/git.fish)
source $HOME/.config/fish/completions/git.fish

31
fish/fish_variables Normal file
View File

@@ -0,0 +1,31 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:brcyan
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:brcyan
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr

View File

@@ -377,6 +377,11 @@ require('nvim-treesitter.configs').setup {
-- Empty nvim-tree setup using defaults
require("nvim-tree").setup()
-- Keymaps leader (space) + f to toggle nvim-tree
vim.keymap.set('n', '<leader>f', ':NvimTreeToggle<CR>', {
noremap = true
})
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
@@ -440,18 +445,19 @@ end
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
sumneko_lua = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
clangd = {},
cssls = {},
eslint = {},
jsonls = {},
golangci_lint_ls = {},
gopls = {},
lua_ls = {},
pylsp = {},
rust_analyzer = {},
svelte = {},
tsserver = {},
vimls = {},
volar = {},
}
-- Setup neovim lua configuration
@@ -462,11 +468,10 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Setup mason so it can manage external tooling
require('mason').setup()
require("mason").setup()
-- Ensure the servers above are installed
-- Configure lspconfig for each server
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}

10
scripts/tbind.sh Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
CAPS_KEY=0x700000039
F10_KEY=0x700000043
DATA=$(printf '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":%s,"HIDKeyboardModifierMappingDst":%s}]}' $CAPS_KEY $F10_KEY)
hidutil property --set $DATA
echo "Successfully overwrote CAPS KEY to F10!"

View File

@@ -1,4 +1,3 @@
# remap previx from 'C-b' to 'F10' and should
# map caps-lock to F10
unbind-key C-b
@@ -12,3 +11,4 @@ set -s escape-time 1
set -g mouse on
set -g default-terminal "xterm-256color"
# set-option -g default-shell /opt/homebrew/bin/fish