diff --git a/.aliases b/.aliases deleted file mode 100644 index 2231985..0000000 --- a/.aliases +++ /dev/null @@ -1,27 +0,0 @@ -alias ohmyzsh="mate ~/.oh-my-zsh" -alias private='set +o history' -alias uprivate='set -o history' -alias wion='networksetup -setairportpower en0 on' -alias wiof='networksetup -setairportpower en0 off' -alias blueon='blueutil -p 1' -alias blueoff='blueutil -p 0' -alias cli='python ~/Dropbox/python/cli.py' -alias plexloop='watch -n 4 python ~/Dropbox/Node-Com-Handler/old_v0.1/plexLoop.py' -alias load='/Volumes/keys/load' -alias sumcheck='python ~/python/sumcheck.py' -alias home='watch python3 ~/python/homeChecker/homeCheck.py' -alias goo='~/./python/api/gooShort.py -c' -alias pirate='~/./python/pirateFetch/fetchPiratebay.py' -alias show='~/./python/seasonedShows/seasonedFolders.py' -alias llpass='lpass show -c --password' -alias subl='open /Applications/Sublime\ Text.app/' -alias playing='http https://api.kevinmidboe.com/api/v1/plex/playing -b' -alias toggle='curl -X POST 10.0.0.67:3069/toggle > /dev/null 2>&1' -alias forecast='~/python/termWeather/term_forecast/./term_weather.py' -alias trash='rmtrash' -alias del="rmtrash" -alias emoji="http https://api.kevinmidboe.com/api/v1/emoji -b" -alias gimme="grep -rnw ''" -alias config='/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME' -alias l='tree -C -L 1' -alias l2='tree -C -L 2' diff --git a/.bash_profile b/.bash_profile deleted file mode 100644 index aa4ed8a..0000000 --- a/.bash_profile +++ /dev/null @@ -1,47 +0,0 @@ -export PS1="\W:$ " -export SHELL="/bin/bash" -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 - -HISTFILESIZE=10000 - -# import aliases from file -. ~/.aliases - -function vpn-connect { -/usr/bin/env osascript <<-EOF -tell application "System Events" - tell current location of network preferences - set VPN to service "VPN (midboe.ddns.net)" -- your VPN name here - if exists VPN then connect VPN - repeat while (current configuration of VPN is not connected) - delay 1 - end repeat - end tell -end tell -EOF -} - -function vpn-disconnect { -/usr/bin/env osascript <<-EOF -tell application "System Events" - tell current location of network preferences - set VPN to service "VPN (midboe.ddns.net)" -- your VPN name here - if exists VPN then disconnect VPN - end tell -end tell -return -EOF -} - -# Setting PATH for Python 3.4 -# The orginal version is saved in .bash_profile.pysave -# PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" -# export PATH - -# Setting PATH for Python 3.6 -# The original version is saved in .bash_profile.pysave -PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}" -export PATH - -test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" diff --git a/.bashrc b/.bashrc deleted file mode 100644 index b48de88..0000000 --- a/.bashrc +++ /dev/null @@ -1,5 +0,0 @@ -# PATH=$PATH:~/bin - -Tab: menu-complete -"\e[Z": complete -alias config=/usr/bin/git --git-dir=/Users/kevinmidboe/.cfg/ --work-tree=/Users/kevinmidboe' diff --git a/.gitignore b/.gitignore index 3a41579..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +0,0 @@ -/* -!.bashrc -!.bash_profile -!.vimrc -!.zshrc -!/.zsh-themes -!.aliases -!/.ssh -/.ssh/* -!/.ssh/*config -!.hyper.js diff --git a/.hyper.js b/.hyper.js deleted file mode 100644 index ab6fa9e..0000000 --- a/.hyper.js +++ /dev/null @@ -1,132 +0,0 @@ -// Future versions of Hyper may add additional config options, -// which will not automatically be merged into this file. -// See https://hyper.is#cfg for all currently supported options. - -module.exports = { - config: { - // default font size in pixels for all tabs - fontSize: 12, - - // font family with optional fallbacks - fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', - - // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) - cursorColor: 'rgba(248,28,229,0.8)', - - // `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █ - cursorShape: 'BLOCK', - - // set to true for blinking cursor - cursorBlink: false, - - // color of the text - foregroundColor: '#fff', - - // terminal background color - backgroundColor: '#000', - - // border color (window, tabs) - borderColor: '#333', - - // custom css to embed in the main window - css: '', - - // custom css to embed in the terminal window - termCSS: '', - - // set to `true` (without backticks) if you're using a Linux setup that doesn't show native menus - // default: `false` on Linux, `true` on Windows (ignored on macOS) - showHamburgerMenu: '', - - // set to `false` if you want to hide the minimize, maximize and close buttons - // additionally, set to `'left'` if you want them on the left, like in Ubuntu - // default: `true` on windows and Linux (ignored on macOS) - showWindowControls: '', - - // custom padding (css format, i.e.: `top right bottom left`) - padding: '12px 14px', - - // the full list. if you're going to provide the full color palette, - // including the 6 x 6 color cubes and the grayscale map, just provide - // an array here instead of a color map object - colors: { - black: '#000000', - red: '#ff0000', - green: '#33ff00', - yellow: '#ffff00', - blue: '#0066ff', - magenta: '#cc00ff', - cyan: '#00ffff', - white: '#d0d0d0', - lightBlack: '#808080', - lightRed: '#ff0000', - lightGreen: '#33ff00', - lightYellow: '#ffff00', - lightBlue: '#0066ff', - lightMagenta: '#cc00ff', - lightCyan: '#00ffff', - lightWhite: '#ffffff' - }, - - // the shell to run when spawning a new session (i.e. /usr/local/bin/fish) - // if left empty, your system's login shell will be used by default - // make sure to use a full path if the binary name doesn't work - // (e.g `C:\\Windows\\System32\\bash.exe` instead of just `bash.exe`) - // if you're using powershell, make sure to remove the `--login` below - shell: '/bin/zsh', - - // for setting shell arguments (i.e. for using interactive shellArgs: ['-i']) - // by default ['--login'] will be used - shellArgs: ['--login'], - - // for environment variables - env: {}, - - // set to false for no bell - // bell: 'SOUND', - bell: false, - - // if true, selected text will automatically be copied to the clipboard - copyOnSelect: false - - // if true, on right click selected text will be copied or pasted if no - // selection is present (true by default on Windows) - // quickEdit: true - - // URL to custom bell - // bellSoundURL: 'http://example.com/bell.mp3', - - // for advanced config flags please refer to https://hyper.is/#cfg - }, - - // a list of plugins to fetch and install from npm - // format: [@org/]project[#version] - // examples: - // `hyperpower` - // `@company/project` - // `project#1.0.1` - plugins: [ - "hyper-markdown-preview", - "hypercwd", - "hyper-statusline", - "hyper-pane", - "hyper-chesterish", - "hyperterm-tabs", - "hyper-dracula" - ], - - // in development, you can create a directory under - // `~/.hyper_plugins/local/` and include it here - // to load it and avoid it being `npm install`ed - localPlugins: [], - - - hyperStatusLine: { - dirtyColor: 'salmon', - }, - - paneNavigation: { - showIndicators: false, - indicatorPrefix: '^ddd', - }, -}; diff --git a/.ssh/config b/.ssh/config deleted file mode 100644 index 7d3d331..0000000 --- a/.ssh/config +++ /dev/null @@ -1,66 +0,0 @@ -Include ~/.ssh/*_config - -Host imm - HostName 10.0.0.114 - User USERID - KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 - -Host * - AddKeysToAgent yes - IgnoreUnknown UseKeychain - UseKeychain yes - -Host apollo - HostName 10.0.0.102 - User kevin - -Host janus - HostName 10.0.0.110 - User root - -Host xoa - HostName 10.0.0.43 - User kevin - -Host plex - HostName 10.0.0.44 - User kevin - -Host api - HostName 10.0.0.114 - User kevin - -Host elasic - HostName 10.0.0.115 - -Host i2c - HostName 10.0.0.69 - User pi - -Host macserver - HostName 10.0.0.31 - User macserver - -Host airplay - HostName 10.0.0.21 - User pi - -Host hub - HostName 10.0.0.25 - User pi -Host ntnu - Hostname login.stud.ntnu.no - User komidboe - -Host chip2 - Hostname 10.0.0.67 - User chip - -Host zerow - Hostname 10.0.0.68 - User pi - -Host curtain - Hostname 10.0.0.9 - User pi - diff --git a/.vimrc b/.vimrc deleted file mode 100644 index 2d19466..0000000 --- a/.vimrc +++ /dev/null @@ -1,50 +0,0 @@ -syntax on -set nocompatible " be iMproved, required -filetype plugin on -filetype off " required - -" set the runtime path to include Vundle and initialize -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() -" alternatively, pass a path where Vundle should install plugins -"call vundle#begin('~/some/path/here') - -" let Vundle manage Vundle, required -Plugin 'VundleVim/Vundle.vim' -Plugin 'git@github.com:ajh17/VimCompletesMe.git' -Plugin 'git@github.com:Valloric/YouCompleteMe.git' -Plugin 'git@github.com:moll/vim-node.git' -" Vue syntax highlighting - https://github.com/posva/vim-vue -Plugin 'posva/vim-vue' -" Wakatime plugin -Plugin 'wakatime/vim-wakatime' - -" autocmd FileType markdown let b:dispatch = 'octodown --live-reload %' - -" Plugin 'JamshedVesuna/vim-markdown-preview' -" let vim_markdown_preview_github=1 - -" All of your Plugins must be added before the following line -call vundle#end() " required -filetype plugin indent on " required -" To ignore plugin indent changes, instead use: -"filetype plugin on -" -" Brief help -" :PluginList - lists configured plugins -" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate -" :PluginSearch foo - searches for foo; append `!` to refresh local cache -" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal -" -" see :h vundle for more details or wiki for FAQ -" Put your non-Plugin stuff after this line - -" Set tab to 2 spaces -set tabstop=2 -set shiftwidth=2 -set softtabstop=2 -set expandtab - -" Set line number -set number - diff --git a/.zsh-themes/robbyrussel+hostname.zsh-theme b/.zsh-themes/robbyrussel+hostname.zsh-theme deleted file mode 100644 index fbe3f82..0000000 --- a/.zsh-themes/robbyrussel+hostname.zsh-theme +++ /dev/null @@ -1,7 +0,0 @@ -local ret_status="%(?:%{$fg_bold[green]%}%M ➜ :%{$fg_bold[red]%}%M ➜ )" -PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 084921d..0000000 --- a/.zshrc +++ /dev/null @@ -1,98 +0,0 @@ -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH - -# Path to your oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh -export PATH="$HOME/.cargo/bin:$PATH" -export PATH="/usr/local/opt/ruby/bin:$PATH" -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="robbyrussell" - -# Set list of themes to load -# Setting this variable when ZSH_THEME=random -# cause zsh load theme from this variable instead of -# looking in ~/.oh-my-zsh/themes/ -# An empty array have no effect -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) - -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git -) - -source $ZSH/oh-my-zsh.sh - -# User configuration - -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -. ~/.aliases diff --git a/README.md b/README.md new file mode 100644 index 0000000..7d62201 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# kevinmidboe dotfiles + +Install using curl + +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/kevinmidboe/dotfiles/main/install.sh)" +``` diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..daa1049 --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,14 @@ +font: + size: 14 + normal: + family: SFMono Nerd Font + +# Colors (Terminal.app) +alt_send_esc: false + +# New shells should run fish +shell: + program: /usr/local/bin/fish + args: + - --login + diff --git a/fish/completions/fisher.fish b/fish/completions/fisher.fish new file mode 100644 index 0000000..6d23ce4 --- /dev/null +++ b/fish/completions/fisher.fish @@ -0,0 +1,7 @@ +complete --command fisher --exclusive --long help --description "Print help" +complete --command fisher --exclusive --long version --description "Print version" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins" +complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex" +complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)" diff --git a/fish/completions/git.fish b/fish/completions/git.fish new file mode 100644 index 0000000..de78865 --- /dev/null +++ b/fish/completions/git.fish @@ -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' + diff --git a/fish/conf.d/omf.fish b/fish/conf.d/omf.fish new file mode 100644 index 0000000..3e0f6d6 --- /dev/null +++ b/fish/conf.d/omf.fish @@ -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 diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..17b2504 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,17 @@ +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 + +# thefuck --alias | source diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..594dfc0 --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1 @@ +jorgebucaran/fisher diff --git a/fish/fish_variables b/fish/fish_variables new file mode 100644 index 0000000..1bbb1dd --- /dev/null +++ b/fish/fish_variables @@ -0,0 +1,33 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR _fisher_upgraded_to_4_4:\x1d +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 +SETUVAR fish_user_paths:/opt/homebrew/opt/ruby\x402\x2e7/bin diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish new file mode 100644 index 0000000..c0a86fa --- /dev/null +++ b/fish/functions/fisher.fish @@ -0,0 +1,240 @@ +function fisher --argument-names cmd --description "A plugin manager for Fish" + set --query fisher_path || set --local fisher_path $__fish_config_dir + set --local fisher_version 4.4.3 + set --local fish_plugins $__fish_config_dir/fish_plugins + + switch "$cmd" + case -v --version + echo "fisher, version $fisher_version" + case "" -h --help + echo "Usage: fisher install Install plugins" + echo " fisher remove Remove installed plugins" + echo " fisher update Update installed plugins" + echo " fisher update Update all installed plugins" + echo " fisher list [] List installed plugins matching regex" + echo "Options:" + echo " -v or --version Print version" + echo " -h or --help Print this help message" + echo "Variables:" + echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~ + case ls list + string match --entire --regex -- "$argv[2]" $_fisher_plugins + case install update remove + isatty || read --local --null --array stdin && set --append argv $stdin + + set --local install_plugins + set --local update_plugins + set --local remove_plugins + set --local arg_plugins $argv[2..-1] + set --local old_plugins $_fisher_plugins + set --local new_plugins + + test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins) + + if ! set --query argv[2] + if test "$cmd" != update + echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1 + else if ! set --query file_plugins + echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1 + end + set arg_plugins $file_plugins + end + + for plugin in $arg_plugins + set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin) + contains -- "$plugin" $new_plugins || set --append new_plugins $plugin + end + + if set --query argv[2] + for plugin in $new_plugins + if contains -- "$plugin" $old_plugins + test "$cmd" = remove && + set --append remove_plugins $plugin || + set --append update_plugins $plugin + else if test "$cmd" = install + set --append install_plugins $plugin + else + echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1 + end + end + else + for plugin in $new_plugins + contains -- "$plugin" $old_plugins && + set --append update_plugins $plugin || + set --append install_plugins $plugin + end + + for plugin in $old_plugins + contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin + end + end + + set --local pid_list + set --local source_plugins + set --local fetch_plugins $update_plugins $install_plugins + set --local fish_path (status fish-path) + + echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal) + + for plugin in $fetch_plugins + set --local source (command mktemp -d) + set --append source_plugins $source + + command mkdir -p $source/{completions,conf.d,themes,functions} + + $fish_path --command " + if test -e $plugin + command cp -Rf $plugin/* $source + else + set temp (command mktemp -d) + set repo (string split -- \@ $plugin) || set repo[2] HEAD + + if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1]) + set name (string split -- / \$path)[-1] + set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz + else + set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2] + end + + echo Fetching (set_color --underline)\$url(set_color normal) + + if curl --silent -L \$url | tar -xzC \$temp -f - 2>/dev/null + command cp -Rf \$temp/*/* $source + else + echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 + command rm -rf $source + end + + command rm -rf \$temp + end + + set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files + " & + + set --append pid_list (jobs --last --pid) + end + + wait $pid_list 2>/dev/null + + for plugin in $fetch_plugins + if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source + if set --local index (contains --index -- "$plugin" $install_plugins) + set --erase install_plugins[$index] + else + set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)] + end + end + end + + for plugin in $update_plugins $remove_plugins + if set --local index (contains --index -- "$plugin" $_fisher_plugins) + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + if contains -- "$plugin" $remove_plugins + for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var) + emit {$name}_uninstall + end + printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + set --erase _fisher_plugins[$index] + end + + command rm -rf (string replace -- \~ ~ $$plugin_files_var) + + functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var) + + for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var) + complete --erase --command $name + end + + set --erase $plugin_files_var + end + end + + if set --query update_plugins[1] || set --query install_plugins[1] + command mkdir -p $fisher_path/{functions,themes,conf.d,completions} + end + + for plugin in $update_plugins $install_plugins + set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] + set --local files $source/{functions,themes,conf.d,completions}/* + + if set --local index (contains --index -- $plugin $install_plugins) + set --local user_files $fisher_path/{functions,themes,conf.d,completions}/* + set --local conflict_files + + for file in (string replace -- $source/ $fisher_path/ $files) + contains -- $file $user_files && set --append conflict_files $file + end + + if set --query conflict_files[1] && set --erase install_plugins[$index] + echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2 + continue + end + end + + for file in (string replace -- $source/ "" $files) + command cp -RLf $source/$file $fisher_path/$file + end + + set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files + + set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~) + + contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin + contains -- $plugin $install_plugins && set --local event install || set --local event update + + printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~ + + for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~) + source $file + if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file) + emit {$name}_$event + end + end + end + + command rm -rf $source_plugins + + if set --query _fisher_plugins[1] + set --local commit_plugins + + for plugin in $file_plugins + contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin + end + + for plugin in $_fisher_plugins + contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin + end + + printf "%s\n" $commit_plugins >$fish_plugins + else + set --erase _fisher_plugins + command rm -f $fish_plugins + end + + set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins) + + test "$total" != "0 0 0" && echo (string join ", " ( + test $total[1] = 0 || echo "Installed $total[1]") ( + test $total[2] = 0 || echo "Updated $total[2]") ( + test $total[3] = 0 || echo "Removed $total[3]") + ) plugin/s + case \* + echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1 + end +end + +if ! set --query _fisher_upgraded_to_4_4 + set --universal _fisher_upgraded_to_4_4 + if functions --query _fisher_list + set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share + command rm -rf $XDG_DATA_HOME/fisher + functions --erase _fisher_{list,plugin_parse} + fisher update >/dev/null 2>/dev/null + else + for var in (set --names | string match --entire --regex '^_fisher_.+_files$') + set $var (string replace -- ~ \~ $$var) + end + functions --erase _fisher_fish_postexec + end +end diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..1b42dad --- /dev/null +++ b/install.sh @@ -0,0 +1,25 @@ +#!/bin/sh +export REPO="https://github.com/kevinmidboe/dotfiles" +export DOT_CONFIG_FOLDER="$HOME/.config" + +# clone dotfiles repo +echo "Cloning github repo" +git clone --depth=1 $REPO $DOT_CONFIG_FOLDER + +cd $DOT_CONFIG_FOLDER + +# create symlinks +echo "Creating symlinks" +ln -s $HOME/.config/profile $HOME/.profile +ln -s $HOME/.config/wakatime.cfg $HOME/.wakatime.cfg + +# copy script files +echo "Copying scripts to /usr/local/bin" +cp scripts/* /usr/local/bin/ + +# run install scripts +for script in install/*.sh; do + echo "Running install script $script..." + sh "$script" +done + diff --git a/install/0-brew-cask.sh b/install/0-brew-cask.sh new file mode 100644 index 0000000..f0a2e49 --- /dev/null +++ b/install/0-brew-cask.sh @@ -0,0 +1,14 @@ +# Install cask packages + +apps=( + 1password + 1password-cli + docker + firefox + google-cloud-sdk + google-chrome + homerow + vlc +) + +brew install "${apps[@]}" --cask diff --git a/install/0-brew.sh b/install/0-brew.sh new file mode 100644 index 0000000..32090c9 --- /dev/null +++ b/install/0-brew.sh @@ -0,0 +1,56 @@ +# Install Homebrew + +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +brew update +brew upgrade + +# Add required taps +brew tap hashicorp/tap + +# Install packages +apps=( + ansible + binwalk + btop + cario + cmake + drone-cli + elixir + erlang + fd + ffmpeg + fish + gcc + gd + gh + gnupg + gnutls + go + helm + httpie + iperf3 + ipmitool + jq + k9s + lsusb + lua + lua-language-server + meson + ncdu + neovim + nmap + ruby + tailscale + telnet + hashicorp/tap/terraform + tmux + tree + watch + wget + zig +) + +brew install "${apps[@]}" + +# Git comes with diff-highlight, but isn't in the PATH +ln -sf "$(brew --prefix)/share/git-core/contrib/diff-highlight/diff-highlight" /usr/local/bin/diff-highlight diff --git a/install/node.sh b/install/node.sh new file mode 100644 index 0000000..ed824ba --- /dev/null +++ b/install/node.sh @@ -0,0 +1,14 @@ +# install latest node & yarn +brew install node yarn + +# install specific node versions +brew install node@20 +brew install node@18 + +# Globally install with npm + +packages=( + prettier +) + +yarn global install "${packages[@]}" diff --git a/install/python.sh b/install/python.sh new file mode 100644 index 0000000..edeb209 --- /dev/null +++ b/install/python.sh @@ -0,0 +1,11 @@ +# Install lastest python +brew install python3 + +# Install specific versions of python +brew install python@3.12 +brew install python@3.18 + +# Install global python pacakges +# pip3 install setuptools + +brew install virtualenv diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..fe8337c --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,597 @@ +-- Install packer +local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' +local is_bootstrap = false +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + is_bootstrap = true + vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } + vim.cmd [[packadd packer.nvim]] +end + +require('packer').startup(function(use) + -- Package manager + use 'wbthomason/packer.nvim' + + use { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + requires = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + 'j-hui/fidget.nvim', + + -- Additional lua configuration, makes nvim stuff amazing + 'folke/neodev.nvim', + }, + } + + use { -- Autocompletion + 'hrsh7th/nvim-cmp', + requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + } + + use { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + run = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + } + + use { -- Additional text objects via treesitter + 'nvim-treesitter/nvim-treesitter-textobjects', + after = 'nvim-treesitter', + } + + -- Git related plugins + use 'tpope/vim-fugitive' + use 'tpope/vim-rhubarb' + use 'lewis6991/gitsigns.nvim' + +-- use 'navarasu/onedark.nvim' -- Theme inspired by Atom + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use { 'lukas-reineke/indent-blankline.nvim', main = "ibl", opts = {} } -- Add indentation guides even on blank lines + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + + -- Fuzzy Finder (files, lsp, etc) + use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + + -- Tree file explorer pacakge: https://github.com/nvim-tree/nvim-tree.lua + use { + 'nvim-tree/nvim-tree.lua', + requires = { + 'nvim-tree/nvim-web-devicons', -- optional, for file icons + }, + tag = 'nightly' -- optional, updated every week. (see issue #1193) + } + + -- nvim tree package: https://github.com/romgrk/barbar.nvim + use {'romgrk/barbar.nvim'} + + -- Custom color schema + use { 'bluz71/vim-moonfly-colors', branch = 'cterm-compat' } + + -- Svelte setup + use 'evanleck/vim-svelte' + use 'pangloss/vim-javascript' + use 'HerringtonDarkholme/yats.vim' + + -- Svelte coc + use { 'neoclide/coc.nvim', branch = 'release' } + + -- Prettier + use('jose-elias-alvarez/null-ls.nvim') + use('MunifTanjim/prettier.nvim') + + -- Wakatime + use 'wakatime/vim-wakatime' + + -- golang + use 'ray-x/go.nvim' + use 'ray-x/guihua.lua' + + -- Elixir + use({ "elixir-tools/elixir-tools.nvim", requires = { "nvim-lua/plenary.nvim" }}) + + local elixir = require("elixir") + local elixirls = require("elixir.elixirls") + + elixir.setup { + elixirls = { + -- specify a repository and branch + repo = "mhanberg/elixir-ls", -- defaults to elixir-lsp/elixir-ls + branch = "mh/all-workspace-symbols", -- defaults to nil, just checkouts out the default branch, mutually exclusive with the `tag` option + tag = "v0.13.0", -- defaults to nil, mutually exclusive with the `branch` option + + -- alternatively, point to an existing elixir-ls installation (optional) + -- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}` + -- cmd = "/usr/local/bin/elixir-ls.sh", + + -- default settings, use the `settings` function to override settings + settings = elixirls.settings { + dialyzerEnabled = true, + fetchDeps = false, + enableTestLenses = false, + suggestSpecs = false, + }, + +-- on_attach = function(client, bufnr) +-- local map_opts = { buffer = true, noremap = true} +-- +-- -- run the codelens under the cursor +-- vim.keymap.set("n", "r", vim.lsp.codelens.run, map_opts) +-- -- remove the pipe operator +-- vim.keymap.set("n", "fp", ":ElixirFromPipe", map_opts) +-- -- add the pipe operator +-- vim.keymap.set("n", "tp", ":ElixirToPipe", map_opts) +-- vim.keymap.set("v", "em", ":ElixirExpandMacro", map_opts) +-- +-- -- bindings for standard LSP functions. +-- vim.keymap.set("n", "df", "lua vim.lsp.buf.format()", map_opts) +-- vim.keymap.set("n", "gd", "lua vim.diagnostic.open_float()", map_opts) +-- vim.keymap.set("n", "dt", "lua vim.lsp.buf.definition()", map_opts) +-- vim.keymap.set("n", "K", "lua vim.lsp.buf.hover()", map_opts) +-- vim.keymap.set("n", "gD","lua vim.lsp.buf.implementation()", map_opts) +-- vim.keymap.set("n", "1gD","lua vim.lsp.buf.type_definition()", map_opts) +-- -- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim +-- -- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim +-- -- there are also core vim.lsp functions that put the same data in the loclist +-- vim.keymap.set("n", "gr", ":References", map_opts) +-- vim.keymap.set("n", "g0", ":DocumentSymbols", map_opts) +-- vim.keymap.set("n", "gW", ":WorkspaceSymbols", map_opts) +-- vim.keymap.set("n", "d", ":Diagnostics", map_opts) +-- end + } + } + + -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua + local has_plugins, plugins = pcall(require, 'custom.plugins') + if has_plugins then + plugins(use) + end + + if is_bootstrap then + require('packer').sync() + end +end) + +-- When we are bootstrapping a configuration, it doesn't +-- make sense to execute the rest of the init.lua. +-- +-- You'll need to restart nvim, and then it will work. +if is_bootstrap then + print '==================================' + print ' Plugins are being installed' + print ' Wait until Packer completes,' + print ' then restart nvim' + print '==================================' + return +end + +-- Automatically source and re-compile packer whenever you save this init.lua +local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) +vim.api.nvim_create_autocmd('BufWritePost', { + command = 'source | silent! LspStop | silent! LspStart | PackerCompile', + group = packer_group, + pattern = vim.fn.expand '$MYVIMRC', +}) + +-- [[ Setting options ]] +-- See `:help vim.o` + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case insensitive searching UNLESS /C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Decrease update time +vim.o.updatetime = 250 +vim.wo.signcolumn = 'yes' + +-- Set colorscheme +vim.o.termguicolors = true +-- vim.cmd [[colorscheme onedark]] +vim.cmd [[colorscheme moonfly]] + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- set tab key to two spaces +vim.o.expandtab = true +vim.o.tabstop = 2 +vim.o.softtabstop = 2 +vim.o.shiftwidth = 2 + +vim.o.relativenumber = true + +-- [[ Basic Keymaps ]] +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) + +-- Set lualine as statusline +-- See `:help lualine.txt` +require('lualine').setup { + options = { + icons_enabled = false, + theme = 'moonfly', + component_separators = '|', + section_separators = '', + }, +} + +-- Configure prettier +local prettier = require("prettier") + +prettier.setup({ + bin = 'prettier', -- or `'prettierd'` (v0.22+) + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, +}) + +local null_ls = require("null-ls") + +local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false }) +local event = "BufWritePre" -- or "BufWritePost" +local async = event == "BufWritePost" + +null_ls.setup({ + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() }) + end, { buffer = bufnr, desc = "[lsp] format" }) + + -- format on save + vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group }) + vim.api.nvim_create_autocmd(event, { + buffer = bufnr, + group = group, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr, async = async }) + end, + desc = "[lsp] format on save", + }) + end + + if client.supports_method("textDocument/rangeFormatting") then + vim.keymap.set("x", "f", function() + vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() }) + end, { buffer = bufnr, desc = "[lsp] format" }) + end + end, +}) + +-- Enable Comment.nvim +require('Comment').setup() + +-- Enable `lukas-reineke/indent-blankline.nvim` +-- See `:help indent_blankline.txt` +--require('indent_blankline').setup { +-- char = '┊', +-- show_trailing_blankline_indent = false, +--} + +-- Gitsigns +-- See `:help gitsigns.txt` +require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, +} + +-- [[ Configure Telescope ]] +-- See `:help telescope` and `:help telescope.setup()` +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + file_ignore_patterns = {"node_modules"} + }, +} + +-- Enable telescope fzf native, if installed +pcall(require('telescope').load_extension, 'fzf') + +-- See `:help telescope.builtin` +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer]' }) + +vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim' }, + + highlight = { enable = true }, + indent = { enable = true, disable = { 'python' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} + +-- Empty nvim-tree setup using defaults +require("nvim-tree").setup() + +-- Keymaps leader (space) + f to toggle nvim-tree +vim.keymap.set('n', 'f', ':NvimTreeToggle', { + noremap = true +}) + +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next) +vim.keymap.set('n', 'e', vim.diagnostic.open_float) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + +-- LSP settings. +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + -- barbar.nvim + local map = vim.api.nvim_set_keymap + local opts = { noremap = true, silent = true } + map('n', '', 'BufferPrevious', opts) + map('n', '', 'BufferNext', opts) + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, { desc = 'Format current buffer with LSP' }) +end + + + +-- Setup neovim lua configuration +require('neodev').setup() +-- +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + + +-- Enable the following language servers +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- 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 = {}, + cssls = {}, + elixirls = {}, + eslint = {}, + jsonls = {}, + golangci_lint_ls = {}, + gopls = {}, + lua_ls = {}, + pylsp = {}, + rust_analyzer = {}, + svelte = {}, + tsserver = {}, + vimls = {}, + volar = {}, +} +-- Setup mason so it can manage external tooling +require("mason").setup() + +-- Configure lspconfig for each server +local mason_lspconfig = require 'mason-lspconfig' +mason_lspconfig.setup { + ensure_installed = vim.tbl_keys(servers), +} + +mason_lspconfig.setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + } + end, +} + +-- Turn on lsp status information +require('fidget').setup() + +-- nvim-cmp setup +local cmp = require 'cmp' +local luasnip = require 'luasnip' + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000..c7bf8da --- /dev/null +++ b/nvim/lua/plugins.lua @@ -0,0 +1,13 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + use 'wakatime/vim-wakatime' + + use 'nvim-tree/nvim-web-devicons' + use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'} +end) diff --git a/profile b/profile new file mode 100644 index 0000000..06182d5 --- /dev/null +++ b/profile @@ -0,0 +1,27 @@ +# Make sure SHELL is set to fish +export SHELL="$(which fish)" + +# 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 go environment +export GOPATH=$HOME/dev/go +export GOROOT="$(brew --prefix golang)/libexec" +export PATH="$PATH:$GOPATH/bin:$GOROOT/bin" + +# Setting up node/npm +export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" +export NPM_PACKAGES="$HOME/.npm-packages" +export PATH="$NPM_PACKAGES/bin:$PATH" + +# Setting up ruby & gem +export PATH="/Users/kevinmidboe/.gem/ruby/2.7.0/bin:$PATH" diff --git a/scripts/tbind.sh b/scripts/tbind.sh new file mode 100644 index 0000000..3bf455f --- /dev/null +++ b/scripts/tbind.sh @@ -0,0 +1,9 @@ +#!/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!" diff --git a/tmux/tmux.config b/tmux/tmux.config new file mode 100644 index 0000000..045f6ab --- /dev/null +++ b/tmux/tmux.config @@ -0,0 +1,26 @@ +# remap previx from 'C-b' to 'F10' and should +# map caps-lock to F10 +unbind-key C-b +set-option -g prefix F10 +bind-key F10 send-prefix + +# Remove delay +set -s escape-time 1 + +# scroll window buffer history, not commands history +set -g mouse on + +set -g default-terminal "xterm-256color" +set-option -g default-shell /opt/homebrew/bin/fish + +# Navigate panes using vim bindings +setw -g mode-keys vi +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Set new panes to open in current directory +bind c new-window -c "#{pane_current_path}" +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" diff --git a/wakatime.cfg b/wakatime.cfg new file mode 100644 index 0000000..3ab744c --- /dev/null +++ b/wakatime.cfg @@ -0,0 +1,9 @@ +[settings] +debug = false +hidefilenames = false +ignore = + COMMIT_EDITMSG$ + PULLREQ_EDITMSG$ + MERGE_MSG$ + TAG_EDITMSG$ +api_key=