feat: bunch of changes done in a week-ish

This commit is contained in:
Tine Jozelj 2021-04-06 21:56:10 +02:00
parent 33d97cebb0
commit 0f5e3d1921
9 changed files with 225 additions and 42 deletions

32
alacritty/alacritty.yml Normal file
View file

@ -0,0 +1,32 @@
window:
decorations: none
font:
normal:
family: FiraCode Nerd Font Mono
colors:
primary:
background: '0xfafafa'
foreground: '0x383a42'
normal:
black: '0x383a42'
red: '0xe45649'
green: '0x50a14f'
yellow: '0xc18401'
blue: '0x0184bc'
magenta: '0xa626a4'
cyan: '0x0997b3'
white: '0xfafafa'
bright:
black: '0x383a42'
red: '0xe45649'
green: '0x50a14f'
yellow: '0xc18401'
blue: '0x0184bc'
magenta: '0xa626a4'
cyan: '0x0997b3'
white: '0xfafafa'

1
bin/.bin Symbolic link
View file

@ -0,0 +1 @@
/home/tine/Projects/workspace/bin

View file

@ -5,3 +5,5 @@
[commit]
#gpgsign = true
[init]
defaultBranch = main

View file

@ -14,6 +14,9 @@ workspace_link() {
ln -s $REPO_DIR/$1 $HOME_DIR/$2 || true
}
echo "== zplug"
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
echo "== Copying configuration files..."
# GIT
workspace_backup .gitconfig
@ -39,6 +42,10 @@ workspace_link zsh/zshrc .zshrc
workspace_backup .bin
workspace_link bin .bin
# ALACRITTY
workspace_backup .alacritty.yml
workspace_link alacritty/alacritty.yml .alacritty.yml
# VIM
workspace_backup .vimrc
workspace_link vim/vimrc .vimrc

View file

@ -1,2 +1,57 @@
[conda]
disabled = true
[crystal]
disabled = true
[dotnet]
disabled = true
[elixir]
disabled = true
[elm]
disabled = true
[erlang]
disabled = true
[haskell]
disabled = true
[java]
disabled = true
[julia]
disabled = true
[nix_shell]
disabled = true
[php]
disabled = true
[singularity]
disabled = true
[nodejs]
disabled = true
#####################
[kubernetes]
disabled = false
symbol = ""
style = "bold blue"
format = '[$symbol$context(\($namespace\))]($style) in '
[aws]
symbol = "🅰 "
[git_branch]
symbol = " "
[character]
symbol = ""
vicmd_symbol = ""

View file

@ -11,17 +11,19 @@ bind -n Home if-shell "$is_vim" "send-keys Escape 'OH'" "send-key C-a"
bind -n End if-shell "$is_vim" "send-keys Escape 'OF'" "send-key C-e"
set -g default-terminal "tmux-256color"
# Update with value from default-terminal
set -ag terminal-overrides ",*256col*:colors=256:Tc"
set -ag terminal-overrides ",*256col*:colors=256:Tc,alacritty:Tc"
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"
# https://github.com/alacritty/alacritty/issues/3037
set -ag terminal-override ',alacritty:Ms=\E]52;c;%p2%s\007'
# enable OSC 52 clipboard
set -g set-clipboard on
set -g mouse on
set -g focus-events on
unbind-key -T copy-mode-vi v
unbind-key -T copy-mode-vi V
@ -67,3 +69,13 @@ set-option -g @prefix_highlight_fg 'colour255'
set-option -g @prefix_highlight_bg 'colour75'
set-option -g @prefix_highlight_copy_mode_attr 'fg=colour255,bg=colour176'
## TMUX Plugins
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
run '~/.tmux/plugins/tpm/tpm'

View file

@ -1,4 +1,9 @@
{
"git.addedSign.hlGroup": "GitGutterAdd",
"git.changedSign.hlGroup": "GitGutterChange",
"git.removedSign.hlGroup": "GitGutterDelete",
"git.topRemovedSign.hlGroup": "GitGutterDelete",
"git.changeRemovedSign.hlGroup": "GitGutterChangeDelete",
"languageserver": {
"terraform": {
"command": "terraform-ls",
@ -19,14 +24,14 @@
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json",
"typescriptreact",
"json",
"graphql"
],
"tsserver.formatOnType": true,
"coc.preferences.formatOnType": true,
"yaml.schemaStore.enable": true,
"yaml.schemas": {
"kubernetes": "/*.yaml"
"kubernetes": "/*.yaml"
}
}

View file

@ -11,18 +11,25 @@ autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
"--- Plugins
call plug#begin('~/.vim/plugged')
Plug 'sonph/onehalf', { 'rtp': 'vim' }
Plug 'ojroques/vim-oscyank'
" General
Plug 'ojroques/vim-oscyank'
Plug 'tpope/vim-obsession'
" Look
Plug 'vim-airline/vim-airline'
Plug 'sonph/onehalf', { 'rtp': 'vim' }
Plug 'Yggdroot/indentLine'
" Git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
" Search/Files
Plug 'junegunn/fzf.vim'
Plug 'preservim/nerdtree'
Plug 'ctrlpvim/ctrlp.vim'
" Ignore/Edit files
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-scripts/gitignore'
" Languages
Plug 'fatih/vim-go'
Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
@ -33,21 +40,45 @@ Plug 'kevinoid/vim-jsonc'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
"--- CodeServer Configurations
let g:coc_global_extensions = [
\ 'coc-tsserver',
\ 'coc-prettier',
\ 'coc-yaml',
\ 'coc-json'
\ 'coc-json',
\ 'coc-git',
\ 'coc-pyright'
\ ]
if isdirectory('./node_modules') && isdirectory('./node_modules/prettier')
let g:coc_global_extensions += ['coc-prettier']
endif
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint')
let g:coc_global_extensions += ['coc-eslint']
endif
" Diagnostic list
nnoremap <silent> <space>d :<C-u>CocList diagnostics<cr>
" Symbols list
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Code actions
nmap <leader>do <Plug>(coc-codeaction)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
"--- TMUX/Clipboard fixes
set t_Co=256
set t_ut=
@ -56,37 +87,73 @@ set t_ut=
" :h xterm-true-color
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
" Enables 24-bit RGB color in the terminal
if has('termguicolors')
if empty($COLORTERM) || $COLORTERM =~# 'truecolor\|24bit'
set termguicolors
endif
endif
" Use system clipboard to get buffers synced between TMUX and VIM
if has('clipboard') && has('vim_starting')
" set clipboard& clipboard+=unnamedplus
set clipboard& clipboard^=unnamed,unnamedplus
endif
if exists('##TextYankPost')
augroup BlinkClipboardIntegration
autocmd!
autocmd TextYankPost * silent! if v:event.operator ==# 'y' | call YankOSC52(join(v:event["regcontents"],"\n")) | endif
augroup END
endif
"--- VIM Configuration
set encoding=UTF-8
set autoread " will re-read opened file if changed externaly
set autowrite
set splitright
set splitbelow
set smarttab
set autoindent
set tabstop=2
set softtabstop=0
set vartabstop=
set shiftwidth=2
set expandtab
set noswapfile
set nobackup
set nowritebackup
set incsearch " search as you type
set ignorecase
set smartcase
set mouse=a
set spell spelllang=en_us
set updatetime=300
set cmdheight=2
set hidden
set shortmess+=c
"- Custom commands
command! -nargs=0 Prettier :CocCommand prettier.formatFile
"- CtrlP
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|node_modules\|log\|tmp$',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }
"- NERDTree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
nnoremap <leader>f 1z= " fix spelling
map <C-t> :call NERDTreeToggleAndRefresh()<CR>
function NERDTreeToggleAndRefresh()
:NERDTreeToggle
if g:NERDTree.IsOpen()
:NERDTreeRefreshRoot
endif
endfunction
"- Keybindings
let mapleader = "'"
@ -95,14 +162,10 @@ let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"- Visuals
set noshowmode
set number
set cursorline
set noswapfile
set hlsearch " highlight all results
set ignorecase
set incsearch " search as you type
set signcolumn=yes " always show git diff column
set spell spelllang=en_us
colorscheme onehalflight
let g:airline_theme = 'onehalflight'

View file

@ -1,8 +1,25 @@
# Always start tmux if it isn't yet.
if [ -z "$TMUX" ]
then
tmux
source ~/.zplug/init.zsh
# PLUGINS
export ZSH_TMUX_AUTOSTART=true
if ! zplug check; then
zplug install
fi
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/gitfast", from:oh-my-zsh
zplug "plugins/git-extras", from:oh-my-zsh
zplug "plugins/kubectl", from:oh-my-zsh
zplug "plugins/nvm", from:oh-my-zsh
zplug "plugins/terraform", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/common-aliases", from:oh-my-zsh
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
zplug load
# History improvements
export HISTFILE=~/.zsh_history
@ -11,24 +28,13 @@ export HISTSIZE=1000000000
export SAVEHIST=100000
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
# Vimode
bindkey -v
bindkey -M vicmd "?" history-incremental-search-backward
bindkey -M vicmd "/" history-incremental-search-forward
# PATH
export PATH=$PATH:$HOME/.bin
# ALIASES
alias k=kubectl
# TOOLS
kubectl () {
command kubectl $*
if [[ -z $KUBECTL_COMPLETE ]]
then
source <(command kubectl completion zsh)
KUBECTL_COMPLETE=1
fi
}
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
export PATH=$PATH:$HOME/.bin:$HOME/go/bin
# Starship
export STARSHIP_CONFIG=~/.starship.toml