Skip to content

Instantly share code, notes, and snippets.

@HebertCL
Created December 16, 2022 17:36
Show Gist options
  • Save HebertCL/624b56de141e7ecd3d35a0be573069bf to your computer and use it in GitHub Desktop.
Save HebertCL/624b56de141e7ecd3d35a0be573069bf to your computer and use it in GitHub Desktop.
Machine setup
" Enable syntax.
syntax enable
" Set numbers on the left side, relative
" number and number width.
set number
set numberwidth=1
set relativenumber
" Allow mouse interaction inside vim
set mouse=a
" Misc configs for commands, status
" encoding and tabs.
set showcmd
set ruler
set encoding=utf-8
set showmatch
set sw=2
set laststatus=2
set clipboard=unnamed
" GUI related configurations
set guifont=Meslo\ LG\ S\ for\ Powerline:h20
set showmatch
" Plugin Manager setup and plugins for
" IDE style, git, language etc.
so ~/.vim/plugins.vim
" Custom mappings for keyboard shortcuts
so ~/.vim/maps.vim
" COC script for mappings and set up
so ~/.vim/coc.vim
" Custom plugin configs
colorscheme gruvbox
let g:gruvbox_contrast_dark = "soft"
let g:airline_theme='solarized_flood'
let g:airline_powerline_fonts = 1
let NERDTreeShowHidden=1
let g:WebDevIconsOS = 'Darwin'
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:DevIconsEnableFoldersOpenClose = 1
let g:DevIconsEnableFolderExtensionPatternMatching = 1
let g:terraform_fmt_on_save=1
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
aws
git
docker
gcloud
golang
helm
kubectl
kubectx
macos
pip
virtualenv
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Custom aliases
alias vim="nvim"
alias vi="nvim"
export VISUAL=nvim
export EDITOR="$VISUAL"
fpath+=${ZDOTDIR:-~}/.zsh_functions
# Application directory
cask_args appdir: '/Applications'
# brew general packages
brew 'bash-completion'
brew 'kubectl'
brew 'kubectx'
brew 'tree'
brew 'wget'
# neovim
tap 'neovim/neovim'
brew 'neovim'
# language specific
brew 'node'
brew 'golang'
brew '[email protected]'
# tooling
brew 'awscli'
brew 'terraform'
brew 'npm'
brew 'virtualenv'
# casks
cask '1password'
cask 'discord'
cask 'docker'
cask 'height'
cask 'iterm2'
cask 'keybase'
cask 'notion'
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Map Leader
let mapleader=" "
" Navigation
nmap <Leader>s <Plug>(easymotion-s2)
nmap <Leader>nt :NERDTreeFind<CR>
" Search
map <Leader>p :Files<CR>
map <Leader>ag :Ag<CR>
call plug#begin('~/.vim/plugged')
" Themes
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Fonts
Plug 'powerline/fonts'
Plug 'ryanoasis/nerd-fonts'
Plug 'ryanoasis/vim-devicons'
" Navigation
Plug 'scrooloose/nerdtree'
Plug 'easymotion/vim-easymotion'
Plug 'christoomey/vim-tmux-navigator'
" TODO: This plguin returns E5248: Invalid character in group name
" error, waiting for more updates to it or new fork.
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" Typing
Plug 'jiangmiao/auto-pairs'
" Language
Plug 'sheerun/vim-polyglot'
Plug 'hashivim/vim-terraform'
" TODO: For some reason, coc expects you to run `yarn install && yarn build`
" after plugin installation but right before start using the plugin.
Plug 'neoclide/coc.nvim', {'branch': 'master'}
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" IDE
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'mhinz/vim-signify'
Plug 'yggdroot/indentline'
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment