diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..d88cc58 --- /dev/null +++ b/alacritty/alacritty.yml @@ -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' + diff --git a/bin/.bin b/bin/.bin new file mode 120000 index 0000000..401285d --- /dev/null +++ b/bin/.bin @@ -0,0 +1 @@ +/home/tine/Projects/workspace/bin \ No newline at end of file diff --git a/git/gitconfig b/git/gitconfig index 934f436..5e99e4d 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -5,3 +5,5 @@ [commit] #gpgsign = true +[init] + defaultBranch = main diff --git a/install.sh b/install.sh index baac1e6..f6c74c1 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/starship/starship.toml b/starship/starship.toml index e852b3b..242967a 100644 --- a/starship/starship.toml +++ b/starship/starship.toml @@ -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 = "❮" + diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 78d1fa9..7db14e7 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -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' diff --git a/vim/coc-settings.json b/vim/coc-settings.json index 52752fa..1a2de5a 100644 --- a/vim/coc-settings.json +++ b/vim/coc-settings.json @@ -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" } } diff --git a/vim/vimrc b/vim/vimrc index 9672f58..be5036b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -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 d :CocList diagnostics +" Symbols list +nnoremap s :CocList -I symbols +" Code actions +nmap do (coc-codeaction) +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction +" Remap keys for applying codeAction to the current buffer. +nmap ac (coc-codeaction) +" Apply AutoFix to problem on the current line. +nmap qf (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 = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[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 n :NERDTreeFocus nnoremap :NERDTree -nnoremap :NERDTreeToggle nnoremap :NERDTreeFind nnoremap f 1z= " fix spelling +map :call NERDTreeToggleAndRefresh() +function NERDTreeToggleAndRefresh() + :NERDTreeToggle + if g:NERDTree.IsOpen() + :NERDTreeRefreshRoot + endif +endfunction "- Keybindings let mapleader = "'" @@ -95,14 +162,10 @@ let g:ctrlp_map = '' 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' - diff --git a/zsh/zshrc b/zsh/zshrc index 4c42d51..dcecb33 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -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