aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclaw0ry <me@claw0ry.net>2024-12-11 13:58:21 +0100
committerclaw0ry <me@claw0ry.net>2024-12-11 13:58:21 +0100
commitb56b0d3ca316395a903ed1c7a040bda0ae321c36 (patch)
treeda8a7e975f0f426095350403dc3b39f4fd1ad5dd
fresh start
-rw-r--r--.bash_profile1
-rw-r--r--.bashrc123
-rw-r--r--.inputrc5
-rw-r--r--.tmux.conf119
-rw-r--r--.vimrc148
-rw-r--r--README.md4
-rw-r--r--alacritty/alacritty.toml22
-rw-r--r--nvim/after/ftplugin/javascript.lua4
-rw-r--r--nvim/after/ftplugin/markdown.lua2
-rw-r--r--nvim/after/ftplugin/terraform.lua4
-rw-r--r--nvim/init.lua660
-rw-r--r--nvim/snippets/css.json10
-rw-r--r--nvim/snippets/go.json20
-rw-r--r--nvim/snippets/javascript.json46
-rw-r--r--nvim/snippets/package.json42
-rw-r--r--nvim/snippets/powershell.json20
-rw-r--r--nvim/snippets/python.json20
-rw-r--r--nvim/snippets/terraform.json20
-rw-r--r--oh-my-posh/config.yml49
-rw-r--r--powershell/Microsoft.PowerShell_profile.ps1115
-rwxr-xr-xscripts/gitlost17
-rwxr-xr-xscripts/note67
-rwxr-xr-xscripts/tmux-sessionizer25
-rw-r--r--setup22
24 files changed, 1565 insertions, 0 deletions
diff --git a/.bash_profile b/.bash_profile
new file mode 100644
index 0000000..4b18bd1
--- /dev/null
+++ b/.bash_profile
@@ -0,0 +1 @@
+source $HOME/.bashrc
diff --git a/.bashrc b/.bashrc
new file mode 100644
index 0000000..e66f8d2
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,123 @@
+#!/bin/bash
+
+# quit if not running interactively
+[[ $- != *i* ]] && return
+
+# --- LOCAL UTILITY FUNCTIONS
+_have() { type "$1" &>/dev/null; }
+_source_if() { [[ -r "$1" ]] && source "$1"; }
+
+# --- ENVIRONMENT
+export CLICOLOR=1
+export EDITOR=vi
+export GIT_EDITOR=vi
+export VISUAL=vi
+export LC_ALL=en_US.UTF-8
+export LANG=en_US.UTF-8
+export LC_CTYPE=en_US.UTF-8
+export TERM="xterm-256color"
+export FZF_DEFAULT_COMMAND='ag --hidden -g ""'
+export GOPROXY=direct
+export GOPATH="$HOME/.local/go"
+export FUNCTIONS_CORE_TOOLS_TELEMETRY_OUTPUT=1
+
+# --- PATHS
+export PATH="$HOME/.local/go/bin:$PATH"
+export PATH="$HOME/.local/bin:$PATH"
+export PATH="$HOME/.local/scripts:$PATH"
+export PATH="$HOME/bin:$PATH"
+export PATH="/usr/local/sbin:$PATH"
+export XDG_CACHE_HOME="$HOME/.cache"
+export XDG_CONFIG_HOME="$HOME/.config"
+export XDG_DATA_HOME="$HOME/.local/share"
+
+# --- BASH SHELL OPTIONS
+shopt -s histappend
+shopt -s checkwinsize
+
+# --- HISTORY
+export HISTSIZE=10000
+export HISTFILESIZE=10000
+export HISTCONTROL=ignoreboth
+
+# --- PROMPT
+__ps1() {
+ local branch_color="\e[1;35m"
+ local branch_prompt
+ local branch_prompt_clr
+ local git_branch=$(git branch --show-current 2>/dev/null)
+
+ local sign_prompt='\$'
+ local sign_prompt_clr='\e[00m\$'
+
+ [[ $git_branch == master || $git_branch == main ]] && branch_color="\e[31m"
+ [[ -n "$git_branch" ]] && branch_prompt_clr="$branch_color($git_branch)"
+ [[ -n "$git_branch" ]] && branch_prompt="($git_branch)"
+
+ [[ $EUID == 0 ]] && sign_prompt='#'
+ [[ $EUID == 0 ]] && sign_prompt_clr='\e[31m#\e[00m'
+
+ case "$TERM" in
+ xterm-color|*-256color)
+ PS1="\e[01;32m\u@\h\e[00m:\e[01;34m\W $branch_prompt_clr$sign_prompt_clr ";;
+ *)
+ PS1="\u@\h:\W $branch_prompt$sign_prompt ";;
+ esac
+}
+
+if [ -x "$(command -v oh-my-posh)" ]; then
+ eval "$(oh-my-posh init bash --config $XDG_CONFIG_HOME/oh-my-posh/config.yml)"
+else
+ PROMPT_COMMAND="__ps1"
+fi
+
+# --- ALIASES
+alias rm='rm -i'
+alias mv='mv -i'
+alias cp='cp -i'
+alias ls="ls -h --color=auto"
+alias ll="ls -laH --color=auto"
+alias gcm="git commit -m"
+alias gsa="git status -uall"
+alias gap="git add -p"
+alias gpf="git pull && git fetch --prune"
+alias gitl="git log -n 5 --graph --decorate --oneline"
+alias tree="tree -a -I 'node_modules|.git'"
+
+_have vim && alias vi=vim && EDITOR=vim && GIT_EDITOR=vim
+_have nvim && alias vi=nvim && EDITOR=nvim && GIT_EDITOR=nvim
+
+# --- KEYBINDINGS
+bind -x '"\C-f": tmux-sessionizer'
+
+# --- COMPLETIONS
+_source_if "/etc/bash_completion"
+_source_if "$HOME/.fzf.bash"
+_source_if "$HOME/.git-completion.bash"
+
+# --- PERSONALIZED CONFIGURATIONS
+_source_if "$HOME/.bash_personal"
+_source_if "$HOME/.bash_work"
+
+# --- LAZY LOAD NVM (node version manager)
+lazy_load_nvm() {
+ unset -f npm node nvm
+ export NVM_DIR="$HOME/.nvm"
+ _source_if "$NVM_DIR/nvm.sh"
+ _source_if "$NVM_DIR/bash_completion"
+}
+
+npm() {
+ lazy_load_nvm
+ npm $@
+}
+
+node() {
+ lazy_load_nvm
+ node $@
+}
+
+nvm() {
+ lazy_load_nvm
+ node $@
+}
diff --git a/.inputrc b/.inputrc
new file mode 100644
index 0000000..2d9d30a
--- /dev/null
+++ b/.inputrc
@@ -0,0 +1,5 @@
+"\e[A": history-search-backward
+"\e[B": history-search-forward
+
+set show-all-if-unmodified on
+set completion-ignore-case On
diff --git a/.tmux.conf b/.tmux.conf
new file mode 100644
index 0000000..ff90daf
--- /dev/null
+++ b/.tmux.conf
@@ -0,0 +1,119 @@
+# Configured by claw0ry <claw0ry@proton.me>
+
+# change default meta key
+unbind C-b
+unbind C-a
+set -g prefix C-b
+
+# use a different prefix for nested
+bind-key -n C-y send-prefix
+
+# allow mouse
+set -g mouse on
+bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
+bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
+
+# tmux-sessioniser
+bind-key -r f run-shell "tmux neww ~/.local/scripts/tmux-sessionizer"
+
+# escape time
+set-option -sg escape-time 10
+
+# focus-events
+set-option -g focus-events on
+
+# avoid cursor movement messing with resize
+set -g repeat-time 200
+set -g base-index 1
+setw -g pane-base-index 1
+
+# true-color (24bit)
+set -g default-terminal "tmux-256color"
+set -sg terminal-overrides ",*:RGB"
+
+set-window-option -g mode-keys vi
+bind-key -T copy-mode-vi v send-keys -X begin-selection
+bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
+bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
+
+
+# add double-tap meta key to toggle last window
+bind-key C-b last-window
+
+# create more intuitive split key combos (same as modern screen)
+unbind "'"
+bind "'" split-window -h -c "#{pane_current_path}"
+bind '\' split-window -h -c "#{pane_current_path}"
+bind 'C-\' split-window -h -c "#{pane_current_path}"
+unbind -
+bind - split-window -v -c "#{pane_current_path}"
+unbind _
+bind _ split-window -v -c "#{pane_current_path}"
+
+# vi for copy mode
+setw -g mode-keys vi
+
+# vi for command status
+set -g status-keys vi
+
+# vi keys to resize
+bind -r C-k resize-pane -U 5
+bind -r C-j resize-pane -D 5
+bind -r C-h resize-pane -L 5
+bind -r C-l resize-pane -R 5
+
+# vi keys to navigate panes
+bind -r k select-pane -U
+bind -r j select-pane -D
+bind -r h select-pane -L
+bind -r l select-pane -R
+
+# reload configuration
+bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
+
+# Reorder windows
+bind R move-window -r;
+
+# Fix Home/End keys
+bind-key -n Home send Escape "OH"
+bind-key -n End send Escape "OF"
+
+# very unique Mac bug
+if-shell "type 'reattach-to-user-namespace' >/dev/null" "set -g default-command 'reattach-to-user-namespace -l $SHELL'"
+
+# === STATUSBAR
+set-option -g status-justify left
+set-option -g status-left-length 20
+setw -g automatic-rename on
+set -g base-index 1
+
+# -- Gruber Darker
+set -g status-bg "#181818"
+set -g status-fg "#f4f4ff"
+set -g status-style "bg=#181818,none,align=left"
+
+set -g message-style "fg=#aeafb0,bg=#181818"
+set -g message-command-style "fg=#aeafb0,bg=#181818"
+
+set -g pane-border-style "fg=#57575e,bg=#181818"
+set -g pane-active-border-style "fg=#57575e,bg=#181818"
+set -g pane-border-status bottom
+set -g pane-border-format '─'
+
+set -g mode-style "fg=#dfdfe5,bg=#2f0e82"
+set -g window-style "bg=#181818"
+set -g window-active-style "bg=#181818"
+
+setw -g window-status-style "fg=#aeafb0,bg=black,none"
+setw -g window-status-activity-style "fg=magenta,bg=#181818,none"
+setw -g window-status-separator ""
+
+set-window-option -g window-status-format ' #[fg=white,dim]#I:#W#F '
+set-window-option -g window-status-current-format ' #[bg=#ffdd33,fg=black] #I#[bg=#ffdd33,fg=black]:#[fg=black]#W#[fg=dim]#F '
+
+set -g status-left-style "none"
+set -g status-right-style "none"
+set -g status-left-length "100"
+set -g status-right-length "100"
+set-option -g status-left ' #[fg=blue]•#[fg=green]•#[fg=yellow]•#[fg=red]•#[fg=#57575e]'
+set -g status-right '[%d-%m-%Y %H:%M]'
diff --git a/.vimrc b/.vimrc
new file mode 100644
index 0000000..d6c7e10
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,148 @@
+set encoding=utf-8
+scriptencoding utf-8
+lang en_US.UTF-8
+
+" use space as <leader> key
+let mapleader=" "
+
+set nu
+set relativenumber
+
+" syntax highlighting
+syntax on
+filetype plugin indent on
+
+set backspace=indent,eol,start
+
+" indentation
+set tabstop=4
+set softtabstop=4
+set shiftwidth=4
+set expandtab
+set smartindent
+set autoindent
+
+" copy paste clipboard
+set clipboard=unnamed
+
+" highlight current line
+set cursorline
+
+" searching
+set incsearch
+set ignorecase
+set smartcase
+set nohlsearch
+
+" display title of current file in terminal title bar
+set title
+
+" allow hidden buffers
+set hidden
+
+" dont wrap long lines
+set nowrap
+
+" disable swaps and backups
+set noswapfile
+set nobackup
+set nowritebackup
+
+" start scrolling when 8 lines left
+set scrolloff=8
+
+" show sign column
+set signcolumn=yes
+
+" show the colorcolumn
+set colorcolumn=120
+
+" :sp and :vsp should split below and to the right
+set splitbelow
+set splitright
+
+" avoid delays when typing
+set updatetime=50
+
+" enable mouse support
+set mouse=a
+
+" ???
+set completeopt="menu,menuone,noselect"
+
+" show whitespace characters
+set list lcs=tab:>\ ,trail:~,precedes:<,space:\ ,nbsp:×
+
+" set correct filetype for terraform files
+autocmd BufRead,BufNewFile *.tf,*.tfvars set filetype=terraform
+
+" ---------------------------------
+" --- KEYBINDINGS
+" --------------------------------
+
+" open file explorer
+nnoremap <leader>pv :Ex<CR>
+
+" copy the whole file and stay where you are
+nnoremap <leader>yy ggVGy<C-o>
+
+" move visual line(s) up and down
+vnoremap J :m '>+1<CR>gv=gv
+vnoremap K :m '<-2<CR>gv=gv
+
+" move line up/down
+nnoremap <S-Up> :m-2<CR>
+nnoremap <S-Down> :m+1<CR>
+
+" keeps search in the middle (n=next, N=previous)
+nnoremap n nzzzv
+nnoremap N Nzzzv
+
+" keeps half page up/down in the middle
+nnoremap <C-d> <C-d>zz
+nnoremap <C-u> <C-u>zz
+
+" delete highlighted word/line into void and keeps the pasted value
+" in default registry so you can paste many times
+xnoremap <leader>p "_dp
+
+" delete to void
+nnoremap <leader>d "_d
+vnoremap <leader>d "_d
+
+" fzf
+nnoremap <C-f> :GFiles<CR>
+nnoremap <leader>ff :Files<CR>
+nnoremap <leader>fg :Ag<CR>
+nnoremap <leader>ffg :Rg
+nnoremap <leader>b :Buffers
+
+" reload file if changes from outside
+autocmd FocusGained,BufEnter * :checktime
+
+" avoid human error
+cabbr W w
+cabbr Wq wq
+cabbr Q q
+cabbr E e
+
+" ----------------------
+" --- PLUGINS
+" ----------------------
+
+call plug#begin()
+Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+Plug 'junegunn/fzf.vim'
+Plug 'jremmen/vim-ripgrep'
+Plug 'tpope/vim-commentary'
+Plug 'tpope/vim-surround'
+Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
+call plug#end()
+
+
+" ----------------------
+" --- THEME
+" ----------------------
+
+set background=dark
+colorscheme habamax
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..eab091a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+# dotfiles
+
+A collection of my dotfiles.
+
diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml
new file mode 100644
index 0000000..daab7a7
--- /dev/null
+++ b/alacritty/alacritty.toml
@@ -0,0 +1,22 @@
+[scrolling]
+history = 100000
+
+[window]
+padding = { x = 5, y = 5 }
+dimensions = { columns = 120, lines = 30 }
+
+[font]
+size = 15.0
+offset.y = 0
+normal = { family = "JetBrains Mono", style = "Regular" }
+bold = { family = "JetBrains Mono", style = "Bold" }
+italic = { family = "JetBrains Mono", style = "Italic" }
+bold_italic = { family = "JetBrains Mono", style = "Bold Italic" }
+
+[selection]
+save_to_clipboard = true
+
+[keyboard]
+bindings = [
+ { key= "Back", mods= "Command", chars= "\u0015" }
+]
diff --git a/nvim/after/ftplugin/javascript.lua b/nvim/after/ftplugin/javascript.lua
new file mode 100644
index 0000000..68676e5
--- /dev/null
+++ b/nvim/after/ftplugin/javascript.lua
@@ -0,0 +1,4 @@
+vim.bo.tabstop = 4
+vim.bo.shiftwidth = 4
+vim.bo.expandtab = true
+vim.bo.softtabstop = 4
diff --git a/nvim/after/ftplugin/markdown.lua b/nvim/after/ftplugin/markdown.lua
new file mode 100644
index 0000000..7b75a27
--- /dev/null
+++ b/nvim/after/ftplugin/markdown.lua
@@ -0,0 +1,2 @@
+vim.opt.wrap = true
+vim.opt.linebreak = true
diff --git a/nvim/after/ftplugin/terraform.lua b/nvim/after/ftplugin/terraform.lua
new file mode 100644
index 0000000..9edb208
--- /dev/null
+++ b/nvim/after/ftplugin/terraform.lua
@@ -0,0 +1,4 @@
+vim.bo.tabstop = 2
+vim.bo.shiftwidth = 2
+vim.bo.expandtab = true
+vim.bo.softtabstop = 2
diff --git a/nvim/init.lua b/nvim/init.lua
new file mode 100644
index 0000000..30bd8e6
--- /dev/null
+++ b/nvim/init.lua
@@ -0,0 +1,660 @@
+-- -----------------------------
+-- --- GLOBAL CONFIGURATIONS ---
+-- -----------------------------
+
+-- use space as <leader> key
+vim.g.mapleader = " "
+
+-- vim.opt.correct lang to make copy to clipboard utf-8
+vim.cmd [[
+ lang en_US.UTF-8
+ syntax on
+ filetype plugin indent on
+]]
+
+vim.opt.encoding = 'utf-8'
+vim.o.termguicolors = true
+vim.opt.regexpengine = 1
+
+-- relative numbers
+vim.opt.nu = true
+vim.opt.relativenumber = true
+
+-- indent with 4 spaces
+vim.opt.tabstop = 4
+vim.opt.softtabstop = 4
+vim.opt.shiftwidth = 4
+vim.opt.expandtab = true
+vim.opt.smartindent = true
+vim.opt.autoindent = true
+
+-- hightlight active line
+vim.opt.cursorline = true
+
+-- searching
+vim.opt.incsearch = true
+vim.opt.ignorecase = true
+vim.opt.smartcase = true
+vim.opt.hlsearch = false
+
+-- treat dash separated words as a word text-object
+vim.opt.iskeyword:append('-')
+
+-- integrate vim clipboard with system clipboard
+vim.opt.clipboard:append('unnamedplus')
+
+-- display title of current file in terminal title bar
+vim.opt.title = true
+
+-- allow hidden buffers
+vim.opt.hidden = true
+
+-- disable beeping
+vim.opt.errorbells = false
+
+-- dont wrap long lines
+vim.opt.wrap = false
+
+-- dont use swapfiles
+vim.opt.swapfile = false
+
+-- disable backups
+vim.opt.backup = false
+vim.opt.writebackup = false
+
+-- start scrolling when 8 lines left
+vim.opt.scrolloff = 8
+
+-- always show the sign column
+vim.opt.signcolumn = 'yes'
+
+-- new splits are added to bottom or right
+vim.opt.splitbelow = true
+vim.opt.splitright = true
+
+-- avoid delays when typing
+vim.opt.updatetime = 50
+
+-- set py version
+vim.opt.pyx = 3
+
+-- display colorcolumn at 115 characters
+vim.opt.colorcolumn = '115'
+
+-- color column color
+vim.cmd('highlight ColorColumn ctermbg=darkgray')
+
+-- enabled mouse support
+vim.opt.mouse = 'a'
+
+-- ???
+vim.opt.completeopt = "menu,menuone,noselect"
+
+-- show whitespaces characters
+vim.opt.listchars = { eol = "↲", tab = "> ", trail = "~", precedes = "<", space = " ", nbsp = "×" }
+vim.opt.list = true
+
+-- disable unused modules
+vim.g.loaded_perl_provider = 0
+
+-- recognize terraform filetypes
+vim.cmd([[autocmd BufRead,BufNewFile *.tf,*.tfvars set filetype=terraform]])
+
+-- -----------------------------
+-- --- PLUGINS (PACKER) ---
+-- -----------------------------
+
+-- Only required if you have packer configured as `opt`
+vim.cmd [[packadd packer.nvim]]
+
+require('packer').startup(function(use)
+ -- packer can manage itself
+ use 'wbthomason/packer.nvim'
+
+ -- themes
+ use "blazkowolf/gruber-darker.nvim"
+
+
+ -- lsp
+ use 'neovim/nvim-lspconfig'
+ use 'hrsh7th/cmp-nvim-lsp'
+ use 'hrsh7th/cmp-buffer'
+ use 'hrsh7th/nvim-cmp'
+ use 'hrsh7th/cmp-path'
+ use 'L3MON4D3/LuaSnip'
+ use 'saadparwaiz1/cmp_luasnip'
+ use "rafamadriz/friendly-snippets"
+
+ -- language specifics
+ use 'carlsmedstad/vim-bicep'
+
+ -- telescope
+ use 'nvim-lua/plenary.nvim'
+ use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
+ use 'nvim-telescope/telescope.nvim'
+
+ -- fzf
+ use { 'junegunn/fzf', run = function() vim.fn['fzf#install']() end }
+ use 'junegunn/fzf.vim'
+
+ -- treesitter
+ use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
+ use 'williamboman/mason.nvim'
+
+ -- markdown
+ use({
+ "iamcco/markdown-preview.nvim",
+ run = "cd app && npm install",
+ setup = function() vim.g.mkdp_filetypes = { "markdown" } end,
+ ft = { "markdown" },
+ })
+
+ -- other
+ use 'airblade/vim-gitgutter'
+ use 'tpope/vim-commentary'
+ use 'tpope/vim-surround'
+ use { 'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true } }
+ use { 'folke/todo-comments.nvim', requires = 'nvim-lua/plenary.nvim' }
+ use 'akinsho/toggleterm.nvim'
+end)
+
+-- -----------------------------
+-- --- TELESCOPE ---
+-- -----------------------------
+
+require('telescope').setup({
+ defaults = {
+ layout_strategy = 'vertical',
+ layout_config = {
+ height = 0.95,
+ },
+ },
+ pickers = {
+ find_files = {
+ disable_devicons = true
+ },
+ live_grep = {
+ disable_devicons = true
+ },
+ buffers = {
+ disable_devicons = true
+ },
+ help_tags = {
+ disable_devicons = true
+ },
+ diagnostics = {
+ disable_devicons = true
+ },
+ git_commits = {
+ disable_devicons = true
+ },
+ },
+})
+
+-- -----------------------------
+-- --- VIM-COMMENTARY ---
+-- -----------------------------
+vim.cmd [[
+ autocmd FileType terraform setlocal commentstring=#\ %s
+]]
+
+-- -----------------------------
+-- --- TREESITTER ---
+-- -----------------------------
+
+require('nvim-treesitter.configs').setup({
+ ensure_installed = {
+ "lua",
+ "terraform",
+ "go",
+ "javascript",
+ "html",
+ "css",
+ "c",
+ "lua",
+ "vim",
+ "vimdoc",
+ "query",
+ },
+ sync_install = false,
+ auto_install = false,
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = false,
+ }
+})
+
+
+-- -----------------------------
+-- --- LUALINE ---
+-- -----------------------------
+
+require('lualine').setup({
+ options = {
+ theme = 'auto',
+ icons_enabled = true,
+ component_separators = { left = '', right = '' },
+ section_separators = { left = '', right = '' },
+ },
+ sections = {
+ lualine_a = { "mode" },
+ lualine_b = { "branch", "diff" },
+ lualine_c = { { "filename", path = 1, } },
+ lualine_x = { "encoding", "filetype" },
+ lualine_y = { "location", "progress" },
+ lualine_z = { {
+ "diagnostics",
+ sources = { "nvim_workspace_diagnostic", "nvim_lsp" },
+ sections = { "error", "warn" },
+ diagnostics_color = {
+ -- Same values as the general color option can be used here.
+ error = 'red', -- Changes diagnostics' error color.
+ warn = 'orange', -- Changes diagnostics' warn color.
+ },
+ symbols = { error = "E", warn = "W" },
+ colored = true,
+ update_in_insert = false,
+ always_visible = true,
+ } },
+ }
+})
+
+-- -----------------------------
+-- --- MASON ---
+-- -----------------------------
+
+require("mason").setup({
+ ui = {
+ icons = {
+ package_installed = "✓",
+ package_pending = "➜",
+ package_uninstalled = "✗"
+ }
+ }
+})
+
+-- -----------------------------
+-- --- LUASNIP ---
+-- -----------------------------
+-- load snippets from path/of/your/nvim/config/snippets
+require("luasnip.loaders.from_vscode").load({ paths = { "./snippets" } })
+
+-- -----------------------------
+-- --- AUTOCOMPLETE (CMP) ---
+-- -----------------------------
+local has_words_before = function()
+ unpack = unpack or table.unpack
+ local line, col = unpack(vim.api.nvim_win_get_cursor(0))
+ return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
+end
+
+local luasnip = require("luasnip")
+local cmp = require("cmp")
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
+ end,
+ },
+ window = {
+ completion = cmp.config.window.bordered(),
+ },
+ mapping = {
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<Tab>'] = 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" }),
+ ['<S-Tab>'] = 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" }),
+ ['<CR>'] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.confirm()
+ else
+ fallback()
+ end
+ end, { "i", "s" })
+ },
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'luasnip', option = { show_autosnippets = true } }, -- For luasnip users.
+ }, {
+ { name = 'buffer' },
+ })
+})
+
+-- -----------------------------
+-- --- LSP ---
+-- -----------------------------
+
+local capabilities = vim.tbl_deep_extend(
+ "force",
+ require("lspconfig").util.default_config.capabilities,
+ require('cmp_nvim_lsp').default_capabilities()
+)
+
+local on_attach = function(client, bufnr)
+ -- Enable completion triggered by <c-x><c-o>
+ vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
+
+ -- Mappings.
+ local bufopts = { noremap = true, silent = true, buffer = bufnr }
+ vim.keymap.set('n', 'gd', "<cmd>Telescope lsp_definitions<CR>", bufopts)
+ vim.keymap.set('n', 'gr', "<cmd>Telescope lsp_references<CR>", bufopts)
+ vim.keymap.set('n', 'gi', "<cmd>Telescope lsp_implementations<CR>", bufopts)
+ vim.keymap.set('n', '<space>D', "<cmd>Telescope lsp_type_definitions<CR>", bufopts)
+ vim.keymap.set('n', '<space>d', "<cmd>Telescope diagnostics<CR>", bufopts)
+
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
+ vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
+ vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
+ vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
+ vim.keymap.set('n', '<leader>dj', vim.diagnostic.goto_next, bufopts)
+ vim.keymap.set('n', '<leader>dk', vim.diagnostic.goto_prev, bufopts)
+
+ vim.cmd([[
+ augroup formatting
+ autocmd! * <buffer>
+ autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
+ augroup END
+ ]])
+end
+
+require("lspconfig")["pyright"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+})
+
+require("lspconfig")["lua_ls"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = {
+ 'vim',
+ }
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ },
+ telemetry = {
+ enable = false,
+ },
+ },
+ }
+})
+
+require("lspconfig")["gopls"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ settings = {
+ gopls = {
+ gofumpt = true,
+ }
+ }
+})
+
+require("lspconfig")["terraformls"].setup({
+ capabilities = capabilities,
+ on_attach = function(client, bufnr)
+ -- Enable completion triggered by <c-x><c-o>
+ vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
+
+ -- Mappings.
+ local bufopts = { noremap = true, silent = true, buffer = bufnr }
+ vim.keymap.set('n', 'gr', "<cmd>Telescope lsp_references<CR>", bufopts)
+ vim.keymap.set('n', 'gi', "<cmd>Telescope lsp_implementations<CR>", bufopts)
+ vim.keymap.set('n', 'gd', "<cmd>Telescope lsp_definitions<CR>", bufopts)
+ vim.keymap.set('n', '<space>D', "<cmd>Telescope lsp_type_definitions<CR>", bufopts)
+ vim.keymap.set("n", "<space>v", "<cmd>vsplit | Telescope lsp_definitions<CR>") -- open definitions in vertical split
+ vim.keymap.set('n', '<space>d', "<cmd>Telescope diagnostics<CR>", bufopts)
+
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
+ vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
+ vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
+ vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
+ vim.keymap.set('n', '<leader>dj', vim.diagnostic.goto_next, bufopts)
+ vim.keymap.set('n', '<leader>dk', vim.diagnostic.goto_prev, bufopts)
+ end
+})
+
+require('lspconfig')['powershell_es'].setup({
+ bundle_path = vim.env.HOME .. '/.config/PowerShellEditorServices',
+ capabilities = capabilities,
+ on_attach = on_attach,
+ init_options = {
+ enableProfileLoading = false,
+ },
+ settings = {
+ ["powershell"] = {
+ codeFolding = {
+ enable = false,
+ },
+ codeFormatting = {
+ newLineAfterCloseBrace = false,
+ pipelineIndentationStyle = "IncreaseIndentationForFirstPipeline",
+ trimWhitespaceAroundPipe = true,
+ useCorrectCasing = true,
+ whitespaceBetweenParameters = true,
+ openBraceOnSameLine = true,
+ alignPropertyValuePairs = true,
+ ignoreOneLineBlock = true,
+ }
+ }
+ }
+})
+
+local lsputil = require('lspconfig/util')
+require('lspconfig')['bicep'].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+ cmd = { "dotnet", "/usr/local/bin/bicep-langserver/Bicep.LangServer.dll" },
+ filetypes = { "bicep" },
+ root_dir = lsputil.root_pattern(".git"),
+})
+
+require("lspconfig")["tsserver"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+})
+
+require("lspconfig")["html"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+})
+
+require("lspconfig")["cssls"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+})
+
+require("lspconfig")["jsonls"].setup({
+ capabilities = capabilities,
+ on_attach = on_attach,
+})
+
+-- -----------------------------
+-- --- TOGGLETERM ---
+-- -----------------------------
+
+require('toggleterm').setup({
+ size = 20,
+ open_mapping = [[<c-\>]],
+ hide_numbers = true,
+ direction = 'horizontal',
+ close_on_exit = false,
+})
+
+-- keybindings
+-- sends the whole line where you are standing with your cursor
+local trim_spaces = true
+
+vim.keymap.set("v", "<space>s", function()
+ require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count })
+end)
+
+-- Replace with these for the other two options
+-- require("toggleterm").send_lines_to_terminal("visual_line", trim_spaces, { args = vim.v.count })
+-- require("toggleterm").send_lines_to_terminal("visual_selection", trim_spaces, { args = vim.v.count })
+
+function _G.set_terminal_keymaps()
+ local opts = { buffer = 0 }
+ vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
+ vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
+ vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
+ vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
+ vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
+ vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
+ vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
+end
+
+vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
+
+-- -----------------------------
+-- --- KEYMAPPING ---
+-- -----------------------------
+
+vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
+vim.keymap.set("n", "<C-a>", "<C-o>", { noremap = false })
+
+-- copy the whole file and stay where you are
+vim.keymap.set("n", "<leader>yy", "ggVGy<C-o>")
+
+-- move visual line(s) up and down
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+-- move lines up/down
+vim.keymap.set("n", "<S-Up>", "<cmd>m-2<CR>")
+vim.keymap.set("n", "<S-Down>", "<cmd>m+1<CR>")
+vim.keymap.set("i", "<S-Up>", "<Esc><cmd>m-2<CR>")
+vim.keymap.set("i", "<S-Down>", "<Esc><cmd>m+1<CR>")
+
+-- keeps search in the middle
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+
+-- keeps half page up and down in the middle
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+
+-- deletes highlighted word/line into void and keeps the pasted value
+-- in default register so you can paste many times
+vim.keymap.set("x", "<leader>p", "\"_dP")
+
+-- delete to void
+vim.keymap.set("n", "<leader>d", "\"_d")
+vim.keymap.set("v", "<leader>d", "\"_d")
+
+-- search and replace
+vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
+
+-- switching between windows
+vim.keymap.set("n", "<leader>h", "<cmd>wincmd h<CR>")
+vim.keymap.set("n", "<leader>j", "<cmd>wincmd j<CR>")
+vim.keymap.set("n", "<leader>k", "<cmd>wincmd k<CR>")
+vim.keymap.set("n", "<leader>l", "<cmd>wincmd l<CR>")
+
+-- resizing
+vim.keymap.set("n", "<C-H><S-H>", "<cmd>vertical resize -4<CR>")
+vim.keymap.set("n", "<C-L><S-L>", "<cmd>vertical resize +4<CR>")
+vim.keymap.set("n", "<C-K><S-K>", "<cmd>resize +4<CR>")
+vim.keymap.set("n", "<C-J><S-J>", "<cmd>resize -4<CR>")
+
+-- telescope
+local ts_builtin = require('telescope.builtin')
+vim.keymap.set("n", "<C-f>", ts_builtin.find_files)
+vim.keymap.set("n", "<leader>ff", function() ts_builtin.find_files({ no_ignore = true, hidden = true }) end)
+vim.keymap.set("n", "<leader>fg",
+ function()
+ ts_builtin.live_grep({
+ additional_args = {
+ '--hidden',
+ '--glob=!**/.git/*',
+ "--glob=!**/.idea/*",
+ "--glob=!**/.vscode/*",
+ "--glob=!**/build/*",
+ "--glob=!**/dist/*",
+ "--glob=!**/yarn.lock",
+ "--glob=!**/package-lock.json",
+ }
+ })
+ end)
+vim.keymap.set("n", "<leader>b", ts_builtin.buffers)
+vim.keymap.set("n", "<leader>fh", ts_builtin.help_tags)
+vim.keymap.set("n", "<leader>fd", ts_builtin.diagnostics)
+vim.keymap.set("n", "<leader>gc", ts_builtin.git_commits)
+vim.keymap.set("n", "<leader>qf", ts_builtin.quickfix)
+vim.keymap.set("n", "<leader>gs", ts_builtin.git_status)
+
+-- todo-comments
+vim.keymap.set("n", "<leader>ft", "<cmd>TodoTelescope keywords=TODO,FIXME<cr>")
+
+-- toggle diagnostics
+vim.keymap.set("n", "<C-e>", function()
+ local current_value = vim.diagnostic.config().virtual_text
+ if current_value then
+ vim.diagnostic.config({ virtual_text = false, signs = false })
+ else
+ vim.diagnostic.config({ virtual_text = true, signs = true })
+ end
+end)
+
+-- -----------------------------
+-- --- THEME SETTINGS ---
+-- -----------------------------
+vim.cmd.colorscheme("gruber-darker")
+
+-- -----------------------------
+-- --- TODO-COMMENTS ---
+-- -----------------------------
+
+require("todo-comments").setup({
+ signs = false,
+ gui_style = {
+ fg = "ITALIC",
+ },
+ merge_keywords = false,
+ highlight = {
+ multiline = true,
+ before = "bg",
+ keyword = "wide",
+ after = "fg",
+ comments_only = true,
+ },
+ keywords = {
+ TODO = { color = "warning" }
+ },
+})
+
+-- -----------------------------
+-- --- COMMANDS ---
+-- -----------------------------
+
+-- you might have to force true color when using regular vim inside tmux as the
+-- colorscheme can appear to be grayscale with "termguicolors" option enabled.
+vim.cmd [[
+if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
+ let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
+ let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
+endif
+]]
+
+-- reload file if changes from outside
+vim.cmd("au FocusGained,BufEnter * :checktime")
+
+-- avoid human error
+vim.cmd("command! W w")
diff --git a/nvim/snippets/css.json b/nvim/snippets/css.json
new file mode 100644
index 0000000..22106f4
--- /dev/null
+++ b/nvim/snippets/css.json
@@ -0,0 +1,10 @@
+{
+ "snip1": {
+ "prefix": "scmt",
+ "body": [
+ "/* -----------------------------------------------------------------------------",
+ " * - $1 -",
+ " * -----------------------------------------------------------------------------*/$2"
+ ]
+ }
+}
diff --git a/nvim/snippets/go.json b/nvim/snippets/go.json
new file mode 100644
index 0000000..1b71808
--- /dev/null
+++ b/nvim/snippets/go.json
@@ -0,0 +1,20 @@
+{
+ "snip1": {
+ "prefix": "cmt",
+ "body": [
+ "//-------------------------------------------------------------------------------",
+ "// $1",
+ "//",
+ "// $2",
+ "//-------------------------------------------------------------------------------"
+ ]
+ },
+ "snip2": {
+ "prefix": "scmt",
+ "body": [
+ "// -----------------------------------------------------------------------------",
+ "// - $1 -",
+ "// -----------------------------------------------------------------------------$2"
+ ]
+ }
+}
diff --git a/nvim/snippets/javascript.json b/nvim/snippets/javascript.json
new file mode 100644
index 0000000..c667981
--- /dev/null
+++ b/nvim/snippets/javascript.json
@@ -0,0 +1,46 @@
+{
+ "snip1": {
+ "prefix": "cmt",
+ "body": [
+ "//-------------------------------------------------------------------------------",
+ "// $1",
+ "//",
+ "// $2",
+ "//-------------------------------------------------------------------------------"
+ ]
+ },
+ "snip2": {
+ "prefix": "scmt",
+ "body": [
+ "// -----------------------------------------------------------------------------",
+ "// - $1 -",
+ "// -----------------------------------------------------------------------------$2"
+ ]
+ },
+ "gliderecord": {
+ "prefix": "jgr",
+ "body": [
+ "var $1 = new GlideRecord('$2');",
+ "$1.addQuery('$3', $4);",
+ "$1.query();",
+ "",
+ "while ($1.next()) {",
+ "\t$5",
+ "}"
+ ]
+ },
+ "docfunc": {
+ "prefix": "func",
+ "body": [
+ "/**",
+ " * $1",
+ " *",
+ " * @parm {$2} $3 - $4",
+ " * @return {$5} - $6",
+ " */",
+ "function $7($8) {",
+ "\t$9",
+ "}"
+ ]
+ }
+}
diff --git a/nvim/snippets/package.json b/nvim/snippets/package.json
new file mode 100644
index 0000000..d6f2cb4
--- /dev/null
+++ b/nvim/snippets/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "example-snippets",
+ "contributes": {
+ "snippets": [
+ {
+ "language": "all",
+ "path": "./all.json"
+ },
+ {
+ "language": "go",
+ "path": "./go.json"
+ },
+ {
+ "language": "javascript",
+ "path": "./javascript.json"
+ },
+ {
+ "language": "css",
+ "path": "./css.json"
+ },
+ {
+ "language": [
+ "ps1",
+ "powershell"
+ ],
+ "path": "./powershell.json"
+ },
+ {
+ "language": "python",
+ "path": "./python.json"
+ },
+ {
+ "language": [
+ "terraform",
+ "hcl",
+ "tf"
+ ],
+ "path": "./terraform.json"
+ }
+ ]
+ }
+}
diff --git a/nvim/snippets/powershell.json b/nvim/snippets/powershell.json
new file mode 100644
index 0000000..1f47642
--- /dev/null
+++ b/nvim/snippets/powershell.json
@@ -0,0 +1,20 @@
+{
+ "snip1": {
+ "prefix": "cmt",
+ "body": [
+ "#-------------------------------------------------------------------------------",
+ "# $1",
+ "#",
+ "# $2",
+ "#-------------------------------------------------------------------------------"
+ ]
+ },
+ "snip2": {
+ "prefix": "scmt",
+ "body": [
+ "# -----------------------------------------------------------------------------",
+ "# - $1 -",
+ "# -----------------------------------------------------------------------------$2"
+ ]
+ }
+}
diff --git a/nvim/snippets/python.json b/nvim/snippets/python.json
new file mode 100644
index 0000000..1f47642
--- /dev/null
+++ b/nvim/snippets/python.json
@@ -0,0 +1,20 @@
+{
+ "snip1": {
+ "prefix": "cmt",
+ "body": [
+ "#-------------------------------------------------------------------------------",
+ "# $1",
+ "#",
+ "# $2",
+ "#-------------------------------------------------------------------------------"
+ ]
+ },
+ "snip2": {
+ "prefix": "scmt",
+ "body": [
+ "# -----------------------------------------------------------------------------",
+ "# - $1 -",
+ "# -----------------------------------------------------------------------------$2"
+ ]
+ }
+}
diff --git a/nvim/snippets/terraform.json b/nvim/snippets/terraform.json
new file mode 100644
index 0000000..1f47642
--- /dev/null
+++ b/nvim/snippets/terraform.json
@@ -0,0 +1,20 @@
+{
+ "snip1": {
+ "prefix": "cmt",
+ "body": [
+ "#-------------------------------------------------------------------------------",
+ "# $1",
+ "#",
+ "# $2",
+ "#-------------------------------------------------------------------------------"
+ ]
+ },
+ "snip2": {
+ "prefix": "scmt",
+ "body": [
+ "# -----------------------------------------------------------------------------",
+ "# - $1 -",
+ "# -----------------------------------------------------------------------------$2"
+ ]
+ }
+}
diff --git a/oh-my-posh/config.yml b/oh-my-posh/config.yml
new file mode 100644
index 0000000..77b0b3c
--- /dev/null
+++ b/oh-my-posh/config.yml
@@ -0,0 +1,49 @@
+# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
+final_space: true
+version: 2
+blocks:
+ - type: prompt
+ alignment: left
+ segments:
+ - type: text
+ style: plain
+ foreground: magenta
+ template: "[{{ .Shell }}]"
+ - type: python
+ style: plain
+ foreground: yellow
+ template: "[{{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }}{{ end }}{{ end }}]"
+ - type: path
+ style: plain
+ foreground: cyan
+ properties:
+ style: letter
+ - type: git
+ style: plain
+ foreground: green
+ template: "({{ .HEAD }})"
+ properties:
+ branch_icon: ""
+ - type: prompt
+ alignment: right
+ segments:
+ - type: executiontime
+ style: plain
+ foreground: 'cyan'
+ template: "[{{ .FormattedMs }}]"
+ properties:
+ style: austin
+ threshold: 500
+ - type: time
+ style: plain
+ foreground: yellow
+ - type: prompt
+ alignment: left
+ newline: true
+ segments:
+ - type: text
+ style: plain
+ template: "$"
+ foreground: green
+ foreground_templates:
+ - '{{ if gt .Code 0 }}red{{ end }}'
diff --git a/powershell/Microsoft.PowerShell_profile.ps1 b/powershell/Microsoft.PowerShell_profile.ps1
new file mode 100644
index 0000000..2545417
--- /dev/null
+++ b/powershell/Microsoft.PowerShell_profile.ps1
@@ -0,0 +1,115 @@
+# -----------------------------------------------------------------------------
+# - MODULES -
+# -----------------------------------------------------------------------------
+
+Import-Module -Name PSFzf
+Import-Module -Name posh-git
+
+if ($IsWindows) {
+ $env:XDG_CONFIG_HOME = "$env:USERPROFILE/.config"
+ if (-not(Test-Path -Path $env:XDG_CONFIG_HOME -PathType Container)) {
+ New-Item -Path $env:XDG_CONFIG_HOME -ItemType Directory
+ }
+} else {
+ $env:XDG_CONFIG_HOME = "$env:HOME/.config"
+}
+
+# -----------------------------------------------------------------------------
+# - PROMPT -
+# -----------------------------------------------------------------------------
+
+oh-my-posh init pwsh --config "$env:XDG_CONFIG_HOME/oh-my-posh/config.yml" | Invoke-Expression
+
+# -----------------------------------------------------------------------------
+# - ENVIRONMENT VARIABLES -
+# -----------------------------------------------------------------------------
+
+$env:PATH += ":$env:HOME/go/bin"
+$env:EDITOR = "nvim"
+$env:VISUAL = "nvim"
+
+# -----------------------------------------------------------------------------
+# - CUSTOM FUNCTIONS -
+# -----------------------------------------------------------------------------
+
+function New-Note {
+ param(
+ [Parameter()]
+ [string] $Name = "{0}.md" -f (New-Guid)
+ )
+
+ $path = Join-Path $env:HOME "notes" $Name
+
+ "$env:EDITOR $path" | Invoke-Expression
+}
+
+function Open-Note {
+ param(
+ [Parameter()]
+ [string] $Name = ""
+ )
+
+ $notesPath = Join-Path $env:HOME "notes"
+ $path = Join-Path $notesPath $Name
+
+ if (Test-Path $path) {
+ "$env:EDITOR $path" | Invoke-Expression
+ } else {
+ "$env:EDITOR $notesPath" | Invoke-Expression
+ }
+}
+
+# -----------------------------------------------------------------------------
+# - PSREADLINE CONFIGURATIONS -
+# -----------------------------------------------------------------------------
+
+Set-PSReadLineOption -PredictionSource History
+Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord
+Set-PSReadLineKeyHandler -Chord "Alt+RightArrow" -Function ForwardWord
+Set-PSReadLineKeyHandler -Chord "Alt+LeftArrow" -Function BackwardWord
+Set-PSReadLineKeyHandler -Chord "Alt+LeftArrow" -Function BackwardWord
+Set-PSReadLineKeyHandler -Chord "Ctrl+Backspace" -Function DeleteWord
+
+Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
+
+# --- Hide sensitive information from history
+Set-PSReadLineOption -AddToHistoryHandler {
+ param(
+ [string]$line
+ )
+ $sensitive = "password|asplaintext|token|secret"
+ return ($line -notmatch $sensitive)
+}
+
+Set-PSReadLineOption -Colors @{ Member = "`e[95m"; Number = "`e[95m" }
+Set-PSReadLineOption -Colors @{
+ Member = "`e[95m"
+ Parameter = "`e[97m"
+ Number = "`e[97m"
+}
+
+# -----------------------------------------------------------------------------
+# - ALIASES -
+# -----------------------------------------------------------------------------
+function ListFilesAndFolders { param([string]$path = ".") Get-ChildItem -Path $path }
+Set-Alias -Name ll -Value ListFilesAndFolders
+
+function ListAllFilesAndFolders { param([string]$path = ".") Get-ChildItem -Path $path -Force }
+Set-Alias -Name la -Value ListAllFilesAndFolders
+
+function ListAllFilesAndFoldersSorted { param([string]$path = ".") Get-ChildItem -Path $path -Force | Sort-Object LastWriteTime }
+Set-Alias -Name lss -Value ListAllFilesAndFoldersSorted
+
+function GitCommitAlias { git commit -m $args[0] }
+Set-Alias -Name gcmm -Value GitCommitAlias
+
+function GitStatusAll { git status -uall }
+Set-Alias -Name gsa -Value GitStatusAll
+
+function GitCommitPatch { git commit -p }
+Set-Alias -Name gcp -Value GitCommitPatch
+
+function GitAddPatch { git add -p $args }
+Set-Alias -Name gap -Value GitAddPatch
+
+Set-Alias -Name vim -Value nvim
diff --git a/scripts/gitlost b/scripts/gitlost
new file mode 100755
index 0000000..43d5120
--- /dev/null
+++ b/scripts/gitlost
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+directories=$(find ~/code/work ~/code/personal -mindepth 1 -maxdepth 1 -type d)
+
+for dir in $directories
+do
+ cd "$dir"
+ is_git=$(git -C $dir rev-parse 2>/dev/null)
+ exit_code=$(echo $?)
+ [[ $exit_code != 0 ]] && continue
+
+ git_status=$(git -C $dir status --porcelain 2>/dev/null)
+
+ [[ -z $git_status ]] && continue
+
+ echo "$dir"
+done
diff --git a/scripts/note b/scripts/note
new file mode 100755
index 0000000..1e0188d
--- /dev/null
+++ b/scripts/note
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Owner: claw0ry <claw0ry@proton.me>
+# Description: Take notes using vim. Theres a lot of assumptions here, so it might not fit your setup.
+# Assumptions:
+# - Your notes directory is in your $HOME
+# - Your home directory is '/home/<user>/'
+# - Your notes should be in markdown
+
+_list_files() {
+ find "$1" -mindepth 1 -type f | while read file; do
+ echo "$file" | cut -d'/' -f5-
+ done
+}
+
+_remove_file() {
+ if [[ -f "$1" ]]; then
+ rm -v "$1"
+ else
+ echo "ERR: file not found"
+ return 1
+ fi
+}
+
+_open_file() {
+ # inject template if files does not already exist
+ if [[ ! -f "$1" ]]; then
+ local now=$(date -R)
+ local templ="# TITLE\n\nDate: $now\n\n"
+
+ # opens a new vim buffer with $templ and sets the filename to $1 without writing to it
+ echo -e $templ | $EDITOR - -c ':set ft=markdown' +"file ${1}"
+ else
+ $EDITOR "$1"
+ fi
+}
+
+_print_usage() {
+ echo "usage: note [COMMAND] [<filename>]"
+ echo "Commands:"
+ echo " list"
+ echo " List all notes"
+ echo " rm"
+ echo " Delete all notes"
+ echo " help"
+ echo " Prints usage"
+}
+
+note() {
+ if [[ -z "$1" ]]; then
+ _print_usage
+ return 1
+ fi
+
+ case "$1" in
+ "list")
+ _list_files "$HOME/notes";;
+ "rm")
+ _remove_file "$HOME/notes/$2";;
+ "help")
+ _print_usage;;
+ *)
+ _open_file "$HOME/notes/$1";;
+ esac
+}
+
+note "$@"
diff --git a/scripts/tmux-sessionizer b/scripts/tmux-sessionizer
new file mode 100755
index 0000000..a9a3165
--- /dev/null
+++ b/scripts/tmux-sessionizer
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+if [[ $# -eq 1 ]]; then
+ selected=$1
+else
+ selected=$(find ~/code/personal ~/code/work -mindepth 1 -maxdepth 1 -type d | fzf)
+fi
+
+if [[ -z $selected ]]; then
+ exit 0
+fi
+
+selected_name=$(basename "$selected" | tr . _)
+tmux_running=$(pgrep tmux)
+
+if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
+ tmux new-session -s $selected_name -c $selected
+ exit 0
+fi
+
+if ! tmux has-session -t=$selected_name 2> /dev/null; then
+ tmux new-session -ds $selected_name -c $selected
+fi
+
+tmux switch-client -t $selected_name
diff --git a/setup b/setup
new file mode 100644
index 0000000..5782fca
--- /dev/null
+++ b/setup
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+ln -sf "$PWD/.bash_profile" "$HOME/.bash_profile"
+ln -sf "$PWD/.bashrc" "$HOME/.bashrc"
+ln -sf "$PWD/.inputrc" "$HOME/.inputrc"
+ln -sf "$PWD/.tmux.conf" "$HOME/.tmux.conf"
+ln -sf "$PWD/.vimrc" "$HOME/.vimrc"
+
+mkdir -p "$HOME/.config"
+
+ln -sf "$PWD/.config/alacritty" "$HOME/.config/alacritty"
+ln -sf "$PWD/.config/nvim" "$HOME/.config/nvim"
+ln -sf "$PWD/.config/tmux" "$HOME/.config/tmux"
+ln -sf "$PWD/.config/oh-my-posh" "$HOME/.config/oh-my-posh"
+ln -sf "$PWD/.config/powershell" "$HOME/.config/powershell"
+
+mkdir -p "$HOME/.local"
+
+ln -sf "$PWD/snippets" "$HOME/.local/snippets"
+ln -sf "$PWD/scripts" "$HOME/.local/scripts"