Compare commits

...

6 Commits

Author SHA1 Message Date
Adam Veldhousen 63999efd2d
bugfix: link the starship.toml into the right place
3 years ago
Adam Veldhousen 75cd390d12
chore: improve docker image used for testing
3 years ago
Adam Veldhousen cb9589d365
chore: make debug functions to toggle debug logs
3 years ago
Adam Veldhousen 4fbf1feb69
chore: move prompt customization into its own plugin
3 years ago
Adam Veldhousen 374dca7fb2
bugfix: tweaks for asdf usage
3 years ago
Adam Veldhousen f1eb889823
OSX updates (#7)
3 years ago

@ -12,8 +12,8 @@ RUN pacman -Sy --noconfirm openssh sudo vim git curl which gnupg make gcc binuti
WORKDIR /home/files
COPY --chown=1000:1000 . /home/files/.files
USER 1000
RUN rm -rf .bash_rc .bash_logout .zshrc .profile .zlogin .zshrc .bashrc mkshrc
RUN echo "[[ -f '/home/files/.files/sourceme.sh' ]] && source /home/files/.files/sourceme.sh" > /home/files/.bash_profile
RUN source /home/files/.files/sourceme.sh
RUN rm -rf .bash_rc .bash_logout .zshrc .profile .zlogin .zshrc .bashrc mkshrc \
&& cat /home/files/.files/install_script.sh > /home/files/.bash_profile \
&& source /home/files/.bash_profile
CMD ["bash", "--login"]

@ -4,6 +4,8 @@
export FILES_ROOT="${HOME}/.files";
# Set plugins to load here. Run files_plugins_list to see available plugins.
export FILES_PLUGINS=("brew" "ssh" "vim" "git-extras" "asdf" "helm" "starship" "extras");
export FILES_PLUGINS=("asdf" "ssh" "vim" "git-extras" "kubectl" "helm" "starship" "extras");
[[ -s "${HOME}/.files/sourceme.sh" ]] && source ${HOME}/.files/sourceme.sh;
starship_run bash

@ -1,28 +1,35 @@
#!/bin/env bash
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
ASDF_VERSION="${ASDF_VERSION:-"0.8.1"}";
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}";
ASDF_COMPLETIONS="$ASDF_DIR/completions";
# If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f $(which brew 2>&1) ]]; then
ASDF_DIR="$(brew --prefix asdf)"
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi
if ! [[ -f "${ASDF_DIR}/asdf.sh" ]] && [[ -f $(which brew 2>&1) ]]; then
echo "[asdf] Installing asdf via brew";
brew install asdf;
if [[ ! -f "$ASDF_DIR/asdf.sh" ]]; then
echo "[asdf] Installing asdf to ${ASDF_DIR}...";
git clone https://github.com/asdf-vm/asdf.git ${HOME}/.asdf --branch v${ASDF_VERSION};
fi
[[ -f "$ASDF_DIR/asdf.sh" ]] && . "$ASDF_DIR/asdf.sh"
[[ -f "${ASDF_COMPLETIONS}/asdf.bash" ]] && . ${ASDF_COMPLETIONS}/asdf.bash;
alias asdf_list_all='asdf plugin list all';
alias asdf_add='asdf plugin add';
alias asdf_list_versions='asdf list all';
# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"
# adds a plugin @ a version, installs and uses it
asdf_use() {
local plugin=${1};
local version=${2:-'latest'};
# Load completions
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
. "$ASDF_COMPLETIONS/asdf.bash"
if [[ -z "${plugin}" ]]; then
echo "usage: asdf_use <plugin> [version]"
fi
fi
asdf plugin add ${plugin};
asdf install ${plugin} ${version};
asdf local ${plugin} ${version};
}

@ -1,15 +1,18 @@
#!/bin/env bash
export LINUX_BREW_PATH="/home/linuxbrew/.linuxbrew";
export MAC_BREW_PATH="/usr/local/Homebrew";
if ! [[ -d "${LINUX_BREW_PATH}" ]]; then
if [[ ! -d "${LINUX_BREW_PATH}" && ! -d "${MAC_BREW_PATH}" ]]; then
echo "Installing brew";
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o /tmp/brew_install.sh;
chmod +x /tmp/brew_install.sh;
/tmp/brew_install.sh;
rm -rf /tmp/brew_install.sh;
fi
[[ -f "${LINUX_BREW_PATH}/bin/brew" ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)";
[[ -f "${LINUX_BREW_PATH}/bin/brew" ]] && eval "$(${LINUX_BREW_PATH}/bin/brew shellenv)";
[[ -f "${MAC_BREW_PATH}/bin/brew" ]] && eval "$(${MAC_BREW_PATH}/bin/brew shellenv)";
[[ -f "$(brew --prefix bash-completion)/etc/bash_completion" ]] || brew install bash-completion

@ -96,7 +96,7 @@ function targz() {
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
function json() {
if [ -t 0 ]; then # argument
python -mjson.tool <<< "$*" | pygmentize -l javascript;
python -mjson.tool < "$*" | pygmentize -l javascript;
else # pipe
python -mjson.tool | pygmentize -l javascript;
fi;
@ -120,7 +120,7 @@ function gitio() {
}
# list files
alias ll='ls -hGla --color'
alias ll='ls -hGla'
#git
alias gs='git status'

@ -12,4 +12,4 @@ fi
for file in "${FILES_EXTRAS_DIR}"/*; do
[[ -f "${file}" ]] && source "${file}";
done;
done;

@ -1,4 +1,12 @@
#!/bin/env bash
HELM_VERSION=${HELM_VERSION:-"latest"};
if ! [[ -f "$(which helm 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
asdf plugin add helm;
asdf install helm ${HELM_VERSION};
asdf local helm ${HELM_VERSION};
fi
if [[ -f "$(which helm 2>&1)" ]]; then
source <(helm completion zsh)
source <(helm completion bash)
fi

@ -1,11 +1,14 @@
#!/bin/env bash
if [[ -f "$(which brew 2>&1)" ]]; then
brew install kubectl;
KUBECTL_VERSION=${KUBECTL_VERSION:-"latest"};
if ! [[ -f "$(which kubectl 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
asdf plugin add kubectl;
asdf install kubectl ${KUBECTL_VERSION};
fi
if [[ -f "$(which kubectl)" ]] && [[ -d "$(brew --prefix bash-completion)/etc/bash_completion.d" ]]; then
kubectl completion bash > "$(brew --prefix bash-completion)/etc/bash_completion.d/kubectl";
if [[ -f "$(which kubectl 2>&1)" ]]; then
[[ -f "/etc/bash_completion.d/kubectl" ]] || kubectl completion bash > /etc/bash_completion.d/kubectl;
fi
# This command is used a LOT both below and in daily life
@ -101,6 +104,7 @@ kres(){
# Rollout management.
alias kgrs='kubectl get rs'
alias kdrs='kubectl describe rs'
alias krh='kubectl rollout history'
alias kru='kubectl rollout undo'
@ -165,15 +169,3 @@ alias kgcj='kubectl get cronjob'
alias kecj='kubectl edit cronjob'
alias kdcj='kubectl describe cronjob'
alias kdelcj='kubectl delete cronjob'
# Only run if the user actually has kubectl installed
if (( ${+_comps[kubectl]} )); then
kj() { kubectl "$@" -o json | jq; }
kjx() { kubectl "$@" -o json | fx; }
ky() { kubectl "$@" -o yaml | yh; }
# this stuff fails on OSX
# compdef kj=kubectl
# compdef kjx=kubectl
# compdef ky=kubectl
fi

@ -1,15 +1,19 @@
#!/bin/env bash
if ! [[ -f "$(which starship 2>&1)" ]] && [[ -f "$(which brew 2>&1)" ]]; then
brew install starship;
STARSHIP_VERSION=${STARSHIP_VERSION:-"latest"};
if ! [[ -f "$(which starship 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
asdf plugin add starship;
asdf install starship ${STARSHIP_VERSION};
asdf local starship ${STARSHIP_VERSION};
fi
if [[ -f "$(which starship 2>&1)" ]]; then
export STARSHIP_CONFIG_DIR="${FILES_USER_CONFIG}/starship";
export STARSHIP_CONFIG_DIR="${FILES_USER_CONFIG}";
export STARSHIP_CACHE="${STARSHIP_CONFIG_DIR}/cache";
files_debug_log "[starship] installing default config";
files_linkdir "${FILES_PLUGIN_ROOT}/defaults.d/" "${STARSHIP_CONFIG_DIR}/";
[[ -f "${FILES_USER_CONFIG}/starship.toml" ]] || ln -sf "${FILES_PLUGIN_ROOT}/defaults.d/starship.toml" ${FILES_USER_CONFIG};
starship_run() {
local shell=${1:-bash};

@ -1,32 +1,37 @@
" change runtime path
set runtimepath=~/.config/vim/runtime/
execute pathogen#infect()
execute pathogen#helptags()
"we don't want vi compatibility AKA Make Vim more useful
set nocompatible
call pathogen#infect()
Helptags
"color schemes
"colorscheme torte
"colorscheme ecostation
"colorscheme jellybeans
"colorscheme molokai
"colorscheme wombat256i
"colorscheme torte
"colorscheme dragon-energy
"colorscheme patagonia-vim
"colorscheme wombat256i
"colorscheme vim-colors-solarized
"colorscheme vim-obsidian
"colorscheme rdark
"colorscheme ecostation
"colorscheme vilight
"colorscheme vim-tomorrow-theme
"colorscheme monokai
colorscheme monokai
"colorscheme inkpot
"colorscheme CmptrClr
" Enable file type detection
filetype plugin indent on
"
"we don't want vi compatibility AKA Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
set omnifunc=syntaxcomplete#Complete
set completeopt-=preview
set termguicolors
set wildignore=*.png,*.jpg,node_modules,*.min.js,*.txt,*.bak,*.exe,vendor.js
set autochdir
set tags=./.git/tags,tags;$HOME
@ -35,9 +40,7 @@ set backupcopy=yes
set autoread
set selection=exclusive
set ttimeoutlen=70
set termguicolors
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamedplus
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
@ -56,9 +59,15 @@ set binary
" Don't add empty newlines at the end of files
set noeol
set history=500 " Number of things to remember in history.
" Number of things to remember in history.
set history=1500
set t_Co=256
if has('gui_running')
set go =mt
set guifont=Literation\ Mono\ for\ Powerline:h12,Literation_Mono_for_Powerline:h12,Inconsolata\ for\ Powerline:h10,Ubuntu\ Mono:h26,Consolas:h12,Courier:h12
endif
" Centralize backups, swapfiles and undo history
if exists("&backupdir")
set backupdir=~/.config/vim/backups/
@ -89,6 +98,7 @@ set tabstop=4
set expandtab
set shiftwidth=4
" Show “invisible” characters
set lcs=tab:▸\ ,trail,eol,nbsp:_
set list
@ -120,10 +130,6 @@ set showcmd
" Start scrolling x lines before the horizontal window border
set scrolloff=4
autocmd FileType javascript setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd Filetype go setlocal ts=4 sw=4 sts=4 noexpandtab
" Change mapleader
let mapleader = ","
@ -196,6 +202,7 @@ noremap <leader>W :w !sudo tee % > /dev/null<CR>
" generate tags
nnoremap <leader>c :! ctags -R -f ./.git/tags .<CR>
" enable neocomplete
let g:neocomplete#enable_at_startup = 0
@ -221,35 +228,7 @@ let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_fmt_command = "goimports"
let g:go_fmt_autosave = 1
" -b -w -p"
let g:syntastic_go_checkers = ['go', 'errcheck', 'gofmt', 'golint', 'govet']
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" Automatic commands
if has("autocmd")
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" rename symbol
au FileType go nmap <Leader>r <Plug>(go-rename)
" show type info
au FileType go nmap <Leader>ki <Plug>(go-info)
" go def
au FileType go nmap <Leader>di <Plug>(go-def-split)
au FileType go nmap <Leader>ds <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" go docs
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gi <Plug>(go-doc-vertical)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
endif
" ctrl p
let g:ctrlp_map = '<C-P>'
@ -259,7 +238,6 @@ let g:ctrlp_cmd = 'CtrlPLastMode'
let g:ctrlp_extensions = ['line']
let g:ctrlp_show_hidden = 1
"'c' - the directory of the current file.
"'a' - the directory of the current file, unless it is a subdirectory of the cwd
"'r' - the nearest ancestor of the current file that contains one of these directories or files: .git .hg .svn .bzr _darcs
@ -339,38 +317,72 @@ let g:syntastic_loc_list_height = 1
let g:syntastic_enable_balloons = 1
let g:syntastic_javascript_checkers = ['standard']
let g:syntastic_go_checkers = ['go', 'errcheck', 'gofmt', 'golint', 'govet']
"let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" YCM
let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
" Enable file type detection
filetype plugin indent on
augroup myvimrc
au!
au BufWritePost .vimrc so $MYVIMRC
augroup END
" Automatic commands
if has("autocmd")
" Treat .json files as .js
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
" Treat .md files as Markdown
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
" Use relative line numbers
if exists("&relativenumber")
set relativenumber
au BufReadPost * set relativenumber
endif
" rename symbol
au FileType go nmap <Leader>r <Plug>(go-rename)
" show type info
au FileType go nmap <Leader>ki <Plug>(go-info)
" go def
au FileType go nmap <Leader>di <Plug>(go-def-split)
au FileType go nmap <Leader>ds <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" go docs
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gi <Plug>(go-doc-vertical)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd BufRead,BufNewFile *.html setfiletype html syntax=htmldjango
autocmd BufRead,BufNewFile *.template setfiletype html template syntax=htmldjango
autocmd BufRead,BufNewFile *.go setfiletype golang syntax=go
autocmd BufRead,BufNewFile *.php setfiletype php syntax=go
autocmd BufRead,BufNewFile Dockerfile* setfiletype Dockerfile syntax=go
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
autocmd BufRead,BufNewFile *.go setfiletype golang syntax=go
autocmd Filetype go setlocal ts=4 sw=4 sts=4 noexpandtab
" Treat .json files as .js
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
autocmd FileType javascript setlocal ts=4 sts=4 sw=4 expandtab
" Spell check and line wrap just for git commit messages
autocmd Filetype gitcommit setlocal spell textwidth=80
endif
" Source vim configuration upon save
augroup vimrc
autocmd! BufWritePost $MYVIMRC source % | echom "Reloaded " . $MYVIMRC | redraw
autocmd! BufWritePost $MYGVIMRC if has('gui_running') | so % | echom "Reloaded " . $MYGVIMRC | endif | redraw
augroup END
" Auto reload files when edited outside of vim
" Triger `autoread` when files changes on disk
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044
" https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
\ if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
" Notification after file change
" https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
au GUIEnter * set vb t_vb=
endif
au GUIEnter * set vb t_vb=
if has('gui_running')
set go =mt
set guifont=Literation\ Mono\ for\ Powerline:h12,Literation_Mono_for_Powerline:h12,Inconsolata\ for\ Powerline:h10,Ubuntu\ Mono:h26,Consolas:h12,Courier:h12
endif

@ -16,7 +16,8 @@ git://github.com/ervandew/supertab.git
git://github.com/tpope/vim-repeat.git
git://github.com/tpope/vim-surround.git
git://github.com/kien/ctrlp.vim.git
git://github.com/vim-scripts/tComment
git://github.com/vim-scripts/tComment.git
git://github.com/wellle/targets.vim.git
# syntax
git://github.com/cakebaker/scss-syntax.vim.git
git://github.com/pangloss/vim-javascript.git

@ -55,9 +55,9 @@ if [[ -d "${FILES_USER_CONFIG}/vim" ]]; then
vim_setup() {
! [[ -f ${HOME}/.vimrc ]] && ln -sf ${VIM}/.vimrc ${HOME}/.vimrc;
mkdir -p ${VIM}/backups;
mkdir -p ${VIM}/swaps;
mkdir -p ${VIM}/undo;
mkdir -p ${VIM}/backups;
mkdir -p ${VIM}/swaps;
mkdir -p ${VIM}/undo;
vim_setup_config;
vim_setup_runtime;

@ -1,5 +1,13 @@
#!/bin/sh
files_debug_off() {
unset FILES_DEBUG;
}
files_debug_on() {
export FILES_DEBUG=true;
}
# debug logging
files_debug_log() {
if ! [[ -z "${FILES_DEBUG}" ]]; then
@ -21,6 +29,7 @@ files_linkdir() {
find "${SOURCE}" -type f | sed "s=${SOURCE}==" | xargs -I {} ln -fs ${SOURCE}{} ${DEST}{};
fi
fi
# ln on windows pretty much only works with hardlinks it seems
#ls -lA "${SOURCE}" | grep "^-" | awk '{print $9}' | xargs -I {} ln -vfs "${SOURCE}/{}" "${DEST}/{}"
}
@ -58,6 +67,13 @@ load_env() {
files_debug_log "[load_env] \$FILES_ROOT = ${FILES_ROOT}";
export FILES_USER_CONFIG="${HOME}/.config";
export FILES_CACHE_DIR="${FILES_ROOT}/.tmp/";
if [[ -d "${FILES_CACHE_DIR}" ]]; then
files_debug_log "[load env] Setting up cache directory @ ${FILES_CACHE_DIR}";
mkdir -p ${FILES_CACHE_DIR};
fi
if [[ -z "${FILES_PLUGINS}" ]]; then
export FILES_PLUGINS=("brew" "ssh" "vim" "git-extras" "asdf" "helm" "starship" "extras");
fi

Loading…
Cancel
Save