Lots of small changes, moving things around and cleaning up

This commit is contained in:
Daniel Flanagan 2020-11-20 15:27:02 -06:00
parent 802f175873
commit d69f99186a
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
18 changed files with 1737 additions and 84 deletions

View file

@ -1,4 +1,4 @@
/*
!/.gitignore
!/init.vim
!/lsp.lua
!/nvim_lsp.lua

View file

@ -9,6 +9,7 @@ if empty(glob($vimdir.'/autoload/plug.vim'))
autocmd VimEnter * PlugInstall --sync | source $vimdir.'init.vim'
endif
let g:completion_enable_auto_popup = 0
let g:indent_guide_auto_colors = 1
let g:indent_guides_enable_on_vim_startup = 1
let g:jsonnet_fmt_on_save = 0
@ -18,6 +19,7 @@ call plug#begin($vimdir.'/plugged')
Plug 'junegunn/vim-plug' " plugin manager should manage itself
Plug 'sheerun/vim-polyglot' " handles language-specific configuration
Plug 'neovim/nvim-lspconfig' " deeper language integration via language servers
Plug 'nvim-lua/completion-nvim' " language server completion
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
@ -34,8 +36,13 @@ call plug#begin($vimdir.'/plugged')
Plug 'wellle/targets.vim' " adds some more handy text objects
Plug 'tpope/vim-obsession' " even better session handling
Plug 'dhruvasagar/vim-prosession' " even better session handling
Plug 'dhruvasagar/vim-prosession' " even better session handling
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
" luafile $vimdir/lsp.lua
" autocmd BufEnter * lua require('completion').on_attach()
filetype on
filetype indent on
filetype plugin on
@ -54,7 +61,7 @@ set splitright splitbelow
set noerrorbells visualbell t_vb=
set nobackup nowritebackup noswapfile
set timeout ttimeoutlen=100 timeoutlen=150
set hidden shortmess+=Ia
set hidden shortmess+=Iac
set history=1000
set undofile undodir=$vimdir/undo undolevels=1000 undoreload=10000
set spellfile=$vimdir/spell/en.utf-8.add
@ -74,8 +81,8 @@ hi LineNr ctermbg=none ctermfg=8
hi CursorLineNr ctermbg=18 ctermfg=gray
hi IndentGuidesEven ctermbg=18
hi Normal ctermbg=NONE
hi ColorColumn ctermbg=15 ctermfg=0
hi TooLongColorColumn ctermbg=1 ctermfg=0
hi ColorColumn ctermbg=18
hi TooLongColorColumn ctermbg=18 ctermfg=1
hi ActiveBuffer ctermbg=4 ctermfg=0
hi StatusLine ctermbg=18 ctermfg=7
hi StatusLineNC ctermbg=18 ctermfg=7
@ -123,6 +130,8 @@ cnoremap <c-p> <up>
xnoremap < <gv
xnoremap > >gv
" TODO: learn about the wildmenu `q:`
let mapleader = "\<Space>"
nnoremap <silent> <leader>r :source $vimdir/init.vim<CR>:echo 'Reloaded init.vim'<CR>
nnoremap <silent> <leader>w :bd<CR>
@ -160,6 +169,8 @@ function! StatusLineBufferByNum(_, bufnum)
return l:prefix . fnamemodify(bufname(a:bufnum), ':t') . l:suffix
endfunction
au BufReadPost * | if stridx(&ft, 'commit') >= 0 | exe "startinsert!" | endif
function! StatusLineBuffers()
return join(map(nvim_list_bufs(), function("StatusLineBufferByNum")), '')
endfunction
@ -168,8 +179,7 @@ function! StatusLine()
return StatusLineBuffers() . '%*%=%c,%l/%L (%p%%)'
endfunction
" set laststatus=0 showtabline tabline=%!StatusLine()
set statusline=%!StatusLine()
luafile $vimdir/lsp.lua
" TODO: learn about the wildmenu `q:`
imap <silent> <c-n> <Plug>(completion_trigger)

View file

@ -1,9 +0,0 @@
local lsp = require('lspconfig')
local homedir = os.getenv('HOME')
local ossdir = homedir..'/../code/open-source'
lsp.elixirls.setup{
-- TODO: git clone and compile if needed
-- preferably in a background thread with messages
cmd = { ossdir..'/elixir-ls/release/language_server.sh' }
}

6
apps/neovim/nvim_lsp.lua Normal file
View file

@ -0,0 +1,6 @@
-- local completion = require('completion')
local lsp = require('lspconfig')
lsp.elixirls.setup{}
lsp.sumneko_lua.setup{}
lsp.vimls.setup{}

View file

@ -106,6 +106,10 @@ function rgl
rg --color always $argv | less -r
end
# kubernetes aliases
alias k "kubectl"
alias kg "k get"
# grep aliases
alias rg "rg --text"
alias grep "rg"

View file

@ -0,0 +1,7 @@
complete -c fisher -x -l help -d "print usage help"
complete -c fisher -x -l version -d "print fisher version"
complete -c fisher -x -n "__fish_use_subcommand" -a install -d "install plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a update -d "update installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a remove -d "remove installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a list -d "list installed plugins matching <regex>"
complete -c fisher -x -n "__fish_seen_subcommand_from update remove" -a "(fisher list)"

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --e
test -f ~/.fzf/shell/key-bindings.fish && source ~/.fzf/shell/key-bindings.fish
function fish_greeting; fortune; end
function fish_greeting; date; end
# we assume the user uses "$HOME" to just store their mess of dotfiles and other
# nonsense that clutters it up and that they have a preferred starting

View file

@ -0,0 +1,2 @@
jorgebucaran/fisher
evanlucas/fish-kubectl-completions

View file

@ -11,7 +11,7 @@ bind-key -n C-l select-pane -R
bind-key -n C-k select-pane -U
bind-key -n C-j select-pane -D
bind-key -n C-h select-pane -L
bind s run-shell "tmux new-window \"sh -c ~/.config/lytedev-dotfiles/bin/tmuxswitcher\""
bind s run "tmux split-window -l 12 'sh -c ~/.config/lytedev-dotfiles/bin/tmuxswitcher'"
bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux"
@ -28,8 +28,10 @@ set -g status-position bottom
set -g status-bg colour0
set -g status-fg colour8
set -g status-interval 5
set -g status-left-length 200
set -g status-left-length 50
set -g status-left "#h:#S.#W"
set -g status-right-length 280
set -g status-right "#(kubeline && printf ' ')#{pane_current_path} #(cd '#{pane_current_path}' && git rev-parse --abbrev-ref --sq HEAD | tr -d \"'\")#{pane_current_command}"
set -g message-style "fg=colour7 bg=colour18"
set -g pane-active-border-style bg=black,fg=blue
set -g pane-border-style bg=black,fg=colour18
@ -45,7 +47,8 @@ bind-key u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlscan /tmp/tmux-buffer"
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'wl-copy'
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel 'wl-copy'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'; \
bind-key K kill-pane
bind-key C-S-k kill-window

3
bin/fzfy Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env fish
fish -c (history | head -n 1 | grep -v history) | fzf

11
bin/glancepath Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env -S awk -f
{
split(substr($0, 2), p, "/");
for (k in p) {
if (k == length(p)) {
printf "/%s", p[k]
} else {
printf "/%.3s", p[k]
}
}
}

9
bin/kubeline Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env sh
c="$(kubectl config current-context | tr -d "\n")"
if [ -n "$c" ]; then
printf "$c"
fi
a="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
if [ -n "$a" ]; then
printf ".%s" "$a"
fi

9
bin/kubfc Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env sh
kubectl config get-contexts --no-headers | \
uniq | \
sort | \
tr -s ' ' | \
sed -E 's/^\*?[[:space:]]*//g' | \
cut -d ' ' -f1 | \
fzf | \
xargs -I{} kubectl config use-context '{}'

7
bin/kubfn Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env sh
kubectl get namespaces --show-labels | \
uniq | \
sort | \
cut -d ' ' -f1 | \
fzf | \
xargs -I{} kubectl config set-context --current --namespace='{}'

View file

@ -1,31 +0,0 @@
#!/usr/bin/env bash
ANY_SESSION_PREFIX="#[bg=colour18]#[fg=colour7]"
ANY_SESSION_SUFFIX="#[bg=default]#[fg=default] "
CUR_SESSION_PREFIX="#[bg=colour4]#[fg=colour0]"
CUR_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}"
# TODO: implement urgent session highlighting
# URG_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}"
# URG_SESSION_PREFIX="#[bg=colour1]#[fg=colour0]"
CUR_TMUX_SESSION="$1"
if [ -z "$1" ]; then
CUR_TMUX_SESSION="$(tmux display-message -p '#S')"
fi
export CUR_TMUX_SESSION
TMUX_SESSION_LIST="$(tmux list-sessions | awk \
-v curSesh="${CUR_TMUX_SESSION}" \
-v aspre="${ANY_SESSION_PREFIX}" \
-v assuf="${ANY_SESSION_SUFFIX}" \
-v cspre="${CUR_SESSION_PREFIX}" \
-v cssuf="${CUR_SESSION_SUFFIX}" \
'{s=substr($1,0,length($1)-1);
if(s==curSesh){
s=cspre" "s" "cssuf
}else{
s=aspre" "s" "assuf
}printf s}')"
# shellcheck disable=SC2001
echo "${TMUX_SESSION_LIST//\s*$/}" | sed -e 's/\s*$//'

View file

@ -1,32 +0,0 @@
#!/usr/bin/env bash
ANY_WINDOW_PREFIX="#[fg=default]"
ANY_WINDOW_SUFFIX="#[bg=default]#[fg=default] "
CUR_WINDOW_PREFIX="#[fg=colour4]"
CUR_WINDOW_SUFFIX="${ANY_WINDOW_SUFFIX}"
URG_WINDOW_PREFIX="#[fg=colour1]"
URG_WINDOW_SUFFIX="${ANY_WINDOW_SUFFIX}"
CUR_TMUX_WINDOW="$1"
if [ -z "$1" ]; then
CUR_TMUX_WINDOW="$(tmux display-message -p '#S')"
fi
export CUR_TMUX_WINDOW
TMUX_WINDOW_LIST="$(tmux list-windows | awk \
-v curSesh="${CUR_TMUX_WINDOW}" \
-v aspre="${ANY_WINDOW_PREFIX}" \
-v assuf="${ANY_WINDOW_SUFFIX}" \
-v cspre="${CUR_WINDOW_PREFIX}" \
-v cssuf="${CUR_WINDOW_SUFFIX}" \
-v uspre="${URG_WINDOW_PREFIX}" \
-v ussuf="${URG_WINDOW_SUFFIX}" \
'{s=substr($1,0,length($1)-1);
if(s==curSesh){
s=cspre" "s" "cssuf
}else{
s=aspre" "s" "assuf
}printf s}')"
# shellcheck disable=SC2001
echo "${TMUX_WINDOW_LIST//\s*$/}" | sed -e 's/\s*$//'

View file

@ -10,7 +10,7 @@ echo '%admin ALL=(ALL) ALL' >> /etc/sudoers.d/admin-group-sudoers
groupadd admin 2>/dev/null
mkdir --parents "$ud/.home" "$ud/dl"
useradd --home-dir "$ud/.home" \
--groups "admin,users" \
--groups "admin,users,uucp,lock" \
--shell "/bin/bash" \
"$u"
chown --recursive "$u:$u" "$ud"