Last active
February 25, 2024 08:52
-
-
Save anvit/4f0d648be03d7902498267699ebf9e6d to your computer and use it in GitHub Desktop.
Dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Default Shell | |
set-option -g default-shell /bin/zsh | |
# Set C-a as prefix | |
unbind C-b | |
set -g prefix C-a | |
# split panes using | and - | |
bind | split-window -h | |
bind \\ split-window -v | |
unbind '"' | |
unbind % | |
# enable Ctrl Keys | |
set-window-option -g xterm-keys on | |
# pane movement | |
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%' -v -p 25" | |
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" | |
# switch panes using Alt-arrow without prefix | |
bind -n M-Left select-pane -L | |
bind -n M-Right select-pane -R | |
bind -n M-Up select-pane -U | |
bind -n M-Down select-pane -D | |
# mouse scrolling | |
setw -g mouse on | |
###################### | |
### DESIGN CHANGES ### | |
###################### | |
# panes | |
set -g pane-border-style 'fg=black' | |
set -g pane-active-border-style 'fg=brightred' | |
## Status bar design | |
# status line | |
set -g status-justify left | |
set -g status-style 'fg=colour12' | |
set -g status-interval 2 | |
#window mode | |
setw -g mode-style 'bg=colour6 fg=colour196' | |
setw -g clock-mode-colour colour135 | |
# window status | |
setw -g window-status-format " #F#I:#W#F " | |
setw -g window-status-current-format " #F#I:#W#F " | |
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W " | |
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " | |
setw -g window-status-current-style 'bg=colour0 fg=colour11' | |
#setw -g window-status-current-attr dim | |
setw -g window-status-style 'bg=green fg=black' | |
#setw -g window-status-attr reverse | |
# Info on left (I don't have a session display for now) | |
set -g status-left '' | |
# loud or quiet? | |
set -g visual-activity on | |
set-option -g visual-bell off | |
set-option -g visual-silence off | |
setw -g monitor-activity on | |
set-option -g bell-action none | |
# The panes { | |
set -g pane-active-border-style 'fg=colour51' | |
# } | |
# The statusbar { | |
set -g status-position bottom | |
set -g status-style 'bg=colour234 fg=colour137' | |
#set -g status-attr dim | |
set -g status-left '' | |
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' | |
set -g status-right-length 50 | |
set -g status-left-length 20 | |
setw -g window-status-current-style 'fg=colour81 bold,bg=brightred' | |
#setw -g window-status-current-attr bold | |
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' | |
setw -g window-status-style 'fg=colour138' | |
#setw -g window-status-attr none | |
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' | |
#setw -g window-status-bell-attr bold | |
setw -g window-status-bell-style 'fg=colour255 bold,bg=colour1 bold' | |
# } | |
# The messages { | |
#set -g message-attr bold | |
set -g message-style 'fg=colour232 bold,bg=colour166 bold' | |
set -g message-command-style 'fg=blue bg=black' | |
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf-8 | |
syntax on | |
set incsearch | |
filetype off " required | |
runtime macros/matchit.vim | |
" " Disable annopying beeps | |
set noerrorbells visualbell t_vb= | |
autocmd GUIEnter * set visualbell t_vb= | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'https://github.com/scrooloose/nerdtree.git' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'nfvs/vim-perforce' | |
Plugin 'https://github.com/ctrlpvim/ctrlp.vim' | |
Plugin 'https://github.com/scrooloose/nerdcommenter.git' | |
" " Old Plugin 'https://github.com/terryma/vim-multiple-cursors.git' | |
Plugin 'https://github.com/mg979/vim-visual-multi' | |
Plugin 'https://github.com/rking/ag.vim.git' | |
Plugin 'https://github.com/ervandew/supertab.git' | |
Plugin 'https://github.com/maxbrunsfeld/vim-yankstack.git' | |
Plugin 'https://github.com/easymotion/vim-easymotion.git' | |
Plugin 'KabbAmine/vCoolor.vim' | |
Plugin 'https://github.com/mhartington/oceanic-next' | |
Plugin 'https://github.com/skielbasa/vim-material-monokai' | |
" " Faster matcher for CtrlP | |
Plugin 'https://github.com/FelikZ/ctrlp-py-matcher.git' | |
Plugin 'https://github.com/ryanoasis/vim-devicons' | |
" " Typescript syntax highlighting | |
Plugin 'leafgarland/typescript-vim' | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" " :PluginList - lists configured plugins | |
" " :PluginInstall - installs plugins; append `!` to update or just | |
" :PluginUpdate | |
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" " :PluginClean - confirms removal of unused plugins; append `!` to | |
" auto-approve removal | |
" " | |
" " see :h vundle for more details or wiki for FAQ | |
" " Put your non-Plugin stuff after this line | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" " Change leader key | |
"let mapleader = "=" | |
map <leader>t :NERDTreeToggle<CR> | |
map <leader>o :e | |
map <leader><S-o> :tabe | |
map <leader>r :%s/f/r/g | |
map <S-C-f> :NERDTreeFind<CR> | |
" " Map C-/ to comment/uncomment | |
nmap <C-_> <Plug>NERDCommenterToggle | |
nmap <leader>p <Plug>yankstack_substitute_older_paste | |
nmap <leader>P <Plug>yankstack_substitute_newer_paste | |
let g:NERDTreeDirArrowExpandable = '▸' | |
let g:NERDTreeDirArrowCollapsible = '▾' | |
:set fillchars+=vert:\ " Vertical split set to nil" | |
" " Indentation settings | |
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab | |
set backspace=indent,eol,start | |
set t_Co=256 | |
colorscheme gruvbox | |
set background=dark | |
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h10 | |
" " Transparent background | |
hi Normal guibg=NONE ctermbg=NONE | |
"set guioptions-=T "remove toolbar | |
"set guioptions-=r "remove right-hand scroll bar | |
"set guioptions-=L "remove left-hand scroll bar | |
"set guioptions-=m "remove annoying top menu | |
"set guioptions-=e "conole look for tabs | |
" " airline theme | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_theme='gruvbox' | |
"let g:airline_theme='materialmonokai' | |
"let g:Powerline_symbols='unicode' | |
let g:airline_powerline_fonts = 1 | |
au GUIEnter * simalt ~x "run maximized" | |
" " Mapping for multi cursors/CtrlP | |
let g:multi_cursor_prev_key='<C-S-p>' | |
set selection=inclusive | |
let g:ctrlp_map = '<C-m>' | |
" " Ctrl + Del to delete next word, Ctrl + Bksp to delete previous | |
":imap <C-Del> <C-[>wdwi | |
":imap <C-BS> <C-W> | |
" " Leader s for Ag search | |
map <leader>S :Ag! | |
map <leader>s :Ag! <c-r>=expand("<cword>")<cr> | |
" " Show line numbers | |
set number | |
" " Speeding up Ctrl-P | |
let g:ctrlp_user_command = 'ag -i --nocolor --nogroup --depth=40 --hidden --ignore .git --ignore .svn --ignore .hg --ignore .DS_Store --ignore node_modules -g "" %s' | |
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } | |
let g:ctrlp_max_files = 0 | |
let g:ctrlp_working_path_mode = '' | |
let g:ctrlp_cache_dir ='~/.vimswap' | |
let g:ag_working_path_mode='' | |
" " Make vim not clutter all the directories with its temp files | |
set swapfile | |
set dir=~/.vimswap | |
set backup | |
set backupdir=~/.vimtemp | |
set backupskip=~/.vimtemp/* | |
set directory=~/.vimtemp | |
set writebackup | |
" "folding settings | |
set foldmethod=indent "fold based on indent | |
set foldnestmax=10 "deepest fold is 10 levels | |
set nofoldenable "dont fold by default | |
set hlsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
# Set list of themes to pick from when loading at random | |
# Setting this variable when ZSH_THEME=random will cause zsh to load | |
# a theme from this variable instead of looking in $ZSH/themes/ | |
# If set to an empty array, this variable will have no effect. | |
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) | |
# Uncomment the following line to use case-sensitive completion. | |
# CASE_SENSITIVE="true" | |
# Uncomment the following line to use hyphen-insensitive completion. | |
# Case-sensitive completion must be off. _ and - will be interchangeable. | |
# HYPHEN_INSENSITIVE="true" | |
# Uncomment one of the following lines to change the auto-update behavior | |
# zstyle ':omz:update' mode disabled # disable automatic updates | |
# zstyle ':omz:update' mode auto # update automatically without asking | |
# zstyle ':omz:update' mode reminder # just remind me to update when it's time | |
# Uncomment the following line to change how often to auto-update (in days). | |
# zstyle ':omz:update' frequency 13 | |
# Uncomment the following line if pasting URLs and other text is messed up. | |
# DISABLE_MAGIC_FUNCTIONS="true" | |
# Uncomment the following line to disable colors in ls. | |
# DISABLE_LS_COLORS="true" | |
# Uncomment the following line to disable auto-setting terminal title. | |
# DISABLE_AUTO_TITLE="true" | |
# Uncomment the following line to enable command auto-correction. | |
# ENABLE_CORRECTION="true" | |
# Uncomment the following line to display red dots whilst waiting for completion. | |
# You can also set it to another string to have that shown instead of the default red dots. | |
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" | |
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) | |
# COMPLETION_WAITING_DOTS="true" | |
# Uncomment the following line if you want to disable marking untracked files | |
# under VCS as dirty. This makes repository status check for large repositories | |
# much, much faster. | |
# DISABLE_UNTRACKED_FILES_DIRTY="true" | |
# Uncomment the following line if you want to change the command execution time | |
# stamp shown in the history command output. | |
# You can set one of the optional three formats: | |
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" | |
# or set a custom format using the strftime function format specifications, | |
# see 'man strftime' for details. | |
# HIST_STAMPS="mm/dd/yyyy" | |
# Would you like to use another custom folder than $ZSH/custom? | |
# ZSH_CUSTOM=/path/to/new-custom-folder | |
# 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=(git) | |
source $ZSH/oh-my-zsh.sh | |
# User configuration | |
# export MANPATH="/usr/local/man:$MANPATH" | |
# You may need to manually set your language environment | |
# export LANG=en_US.UTF-8 | |
# Preferred editor for local and remote sessions | |
# if [[ -n $SSH_CONNECTION ]]; then | |
# export EDITOR='vim' | |
# else | |
# export EDITOR='mvim' | |
# fi | |
# Compilation flags | |
# export ARCHFLAGS="-arch x86_64" | |
# 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 | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
export COMPOSE_FILE="$HOME/Work/atom/docker/docker-compose.dev.yml:$HOME/Work/atom/docker/docker-compose.pmm.yml" | |
path+=('/home/anvit/.local/bin') | |
# FZF config | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Aliases | |
alias dc="docker compose $@" | |
# pnpm | |
export PNPM_HOME="/home/anvit/.local/share/pnpm" | |
export PATH="$PNPM_HOME:$PATH" | |
# pnpm end | |
# bun completions | |
[ -s "/home/anvit/.bun/_bun" ] && source "/home/anvit/.bun/_bun" | |
# bun | |
export BUN_INSTALL="$HOME/.bun" | |
export PATH="$BUN_INSTALL/bin:$PATH" | |
# rbenv | |
eval "$(~/.rbenv/bin/rbenv init - zsh)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup fzf | |
# --------- | |
if [[ ! "$PATH" == */home/anvit/.fzf/bin* ]]; then | |
PATH="${PATH:+${PATH}:}/home/anvit/.fzf/bin" | |
fi | |
# Auto-completion | |
# --------------- | |
[[ $- == *i* ]] && source "/home/anvit/.fzf/shell/completion.zsh" 2> /dev/null | |
# Key bindings | |
# ------------ | |
source "/home/anvit/.fzf/shell/key-bindings.zsh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf-8 | |
syntax on | |
set incsearch | |
filetype off " required | |
runtime macros/matchit.vim | |
" " Disable annopying beeps | |
set noerrorbells visualbell t_vb= | |
autocmd GUIEnter * set visualbell t_vb= | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'https://github.com/scrooloose/nerdtree.git' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'nfvs/vim-perforce' | |
Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
"Plugin 'https://github.com/ctrlpvim/ctrlp.vim' | |
Plugin 'preservim/nerdcommenter' | |
"Plugin 'https://github.com/terryma/vim-multiple-cursors.git' | |
Plugin 'https://github.com/mg979/vim-visual-multi' | |
Plugin 'mileszs/ack.vim' | |
"Plugin 'https://github.com/rking/ag.vim.git' | |
"Plugin 'jremmen/vim-ripgrep' | |
"Plugin 'https://github.com/ervandew/supertab.git' | |
Plugin 'https://github.com/maxbrunsfeld/vim-yankstack.git' | |
Plugin 'https://github.com/easymotion/vim-easymotion.git' | |
Plugin 'KabbAmine/vCoolor.vim' | |
Plugin 'https://github.com/mhartington/oceanic-next' | |
Plugin 'https://github.com/skielbasa/vim-material-monokai' | |
" " Faster matcher for CtrlP | |
"Plugin 'https://github.com/FelikZ/ctrlp-py-matcher.git' | |
" " Auto close plugins | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'alvan/vim-closetag' | |
Plugin 'https://github.com/ryanoasis/vim-devicons' | |
" " Typescript syntax highlighting | |
Plugin 'leafgarland/typescript-vim' | |
" " CoC Code completion | |
Plugin 'neoclide/coc.nvim', {'branch': 'release'} | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'evanleck/vim-svelte' | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" " :PluginList - lists configured plugins | |
" " :PluginInstall - installs plugins; append `!` to update or just | |
" :PluginUpdate | |
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" " :PluginClean - confirms removal of unused plugins; append `!` to | |
" auto-approve removal | |
" " | |
" " see :h vundle for more details or wiki for FAQ | |
" " Put your non-Plugin stuff after this line | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" " Uncomment to change leader | |
let mapleader = "=" | |
map <leader>t :NERDTreeToggle<CR> | |
map <leader>o :e<space> | |
map <leader><S-o> :tabe<space> | |
map <leader>r :%s/f/r/g | |
map <leader><C-f> :NERDTreeFind<CR> | |
nmap <leader>p <Plug>yankstack_substitute_older_paste | |
nmap <leader>P <Plug>yankstack_substitute_newer_paste | |
" " Copy to system clipboard | |
map <leader><leader>c "*y | |
" Map C-/ to comment/uncomment | |
nmap <C-_> <Plug>NERDCommenterToggle | |
let g:NERDTreeDirArrowExpandable = '▸' | |
let g:NERDTreeDirArrowCollapsible = '▾' | |
:set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:· | |
:set list | |
:set fillchars+=vert:\ " Vertical split set to nil" | |
" " Indentation settings | |
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab | |
set backspace=indent,eol,start | |
set t_Co=256 | |
colorscheme gruvbox | |
set background=dark | |
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h10 | |
hi Normal guibg=NONE ctermbg=NONE | |
"set guioptions-=T "remove toolbar | |
"set guioptions-=r "remove right-hand scroll bar | |
"set guioptions-=L "remove left-hand scroll bar | |
"set guioptions-=m "remove annoying top menu | |
"set guioptions-=e "conole look for tabs | |
" " airline theme | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_theme='gruvbox' | |
let g:airline_powerline_fonts = 1 | |
au GUIEnter * simalt ~x "run maximized" | |
" " Mapping for multi cursors/CtrlP | |
"let g:multi_cursor_prev_key='<C-S-p>' | |
set selection=inclusive | |
" " Leader s for Ag search | |
"map <leader>S :Rg | |
"map <leader>s :Rg <c-r>=expand("<cword>")<cr> | |
" Ctrl-m to open fuzzy finder | |
map <C-m> :FZF<cr> | |
"ack.vim --- {{{ | |
" Use ripgrep for searching ⚡️ | |
" Options include: | |
" --vimgrep -> Needed to parse the rg response properly for ack.vim | |
" --type-not sql -> Avoid huge sql file dumps as it slows down the search | |
" --smart-case -> Search case insensitive if all lowercase pattern, Search case sensitively otherwise | |
if executable('rg') | |
let g:ackprg = 'rg --vimgrep --type-not sql --smart-case' | |
endif | |
" Any empty ack search will search for the work the cursor is on | |
let g:ack_use_cword_for_empty_search = 1 | |
" Don't jump to first match | |
cnoreabbrev Ack Ack! | |
" Navigate quickfix list with ease | |
nnoremap <silent> [q :cprevious<CR> | |
nnoremap <silent> ]q :cnext<CR> | |
" Maps <leader>/ so we're ready to type the search keyword | |
nnoremap <leader>s :Ack!<Space> | |
" }}} | |
" Show line numbers | |
set number | |
" " Speeding up Ctrl-P | |
"let g:ctrlp_user_command = 'ag -i --nocolor --nogroup --depth=40 --hidden --ignore .git --ignore .svn --ignore .hg --ignore .DS_Store --ignore node_modules -g "" %s' | |
"let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } | |
"let g:ctrlp_max_files = 0 | |
"let g:ctrlp_working_path_mode = '' | |
"let g:ctrlp_cache_dir ='~/.vimswap' | |
"let g:ag_working_path_mode='' | |
" " Make vim not clutter all the directories with its temp files | |
set swapfile | |
set dir=~/.vimswap | |
set backup | |
set backupdir=~/.vimtemp | |
set backupskip=~/.vimtemp/* | |
set directory=~/.vimtemp | |
set writebackup | |
" "folding settings | |
set foldmethod=indent "fold based on indent | |
set foldnestmax=10 "deepest fold is 10 levels | |
set nofoldenable "dont fold by default | |
set hlsearch | |
" " Code completion settings | |
" if hidden is not set, TextEdit might fail. | |
set hidden | |
" Some servers have issues with backup files, see #649 | |
set nobackup | |
set nowritebackup | |
" Having longer updatetime (default is 4000 ms = 4s) 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 | |
" Use `[g` and `]g` to navigate diagnostics | |
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" 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') | |
" Symbol renaming | |
nmap <leader>rn <Plug>(coc-rename) | |
" Formatting selected code | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s) | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying code actions to the selected code block | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap keys for applying code actions at the cursor position | |
nmap <leader>ac <Plug>(coc-codeaction-cursor) | |
" Remap keys for apply code actions affect whole buffer | |
nmap <leader>as <Plug>(coc-codeaction-source) | |
" Apply the most preferred quickfix action to fix diagnostic on the current line | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Remap keys for applying refactor code actions | |
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor) | |
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected) | |
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected) | |
" Run the Code Lens action on the current line | |
nmap <leader>cl <Plug>(coc-codelens-action) | |
" Map function and class text objects | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server | |
xmap if <Plug>(coc-funcobj-i) | |
omap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap af <Plug>(coc-funcobj-a) | |
xmap ic <Plug>(coc-classobj-i) | |
omap ic <Plug>(coc-classobj-i) | |
xmap ac <Plug>(coc-classobj-a) | |
omap ac <Plug>(coc-classobj-a) | |
" Remap <C-f> and <C-b> to scroll float windows/popups | |
if has('nvim-0.4.0') || has('patch-8.2.0750') | |
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" | |
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" | |
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
endif | |
" Use CTRL-S for selections ranges | |
" Requires 'textDocument/selectionRange' support of language server | |
nmap <silent> <C-s> <Plug>(coc-range-select) | |
xmap <silent> <C-s> <Plug>(coc-range-select) | |
" Add `:Format` command to format current buffer | |
command! -nargs=0 Format :call CocActionAsync('format') | |
" Add `:Fold` command to fold current buffer | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer | |
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Mappings for CoCList | |
" Show all diagnostics | |
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions | |
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> | |
" Show commands | |
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document | |
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols | |
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item | |
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item | |
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list | |
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmux new-session \; clock-mode \; split-window -v -p 75 \; split-window -h \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Key Mappings | |
# Insert your preferred key mappings here. | |
map t Vomnibar.activateInNewTab keyword=e | |
# Custom search engines | |
w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia | |
# More examples. | |
# | |
# (Vimium supports search completion Wikipedia, as | |
# above, and for these.) | |
# | |
g: https://www.google.com/search?q=%s Google | |
# l: https://www.google.com/search?q=%s&btnI I'm feeling lucky... | |
y: https://www.youtube.com/results?search_query=%s Youtube | |
gm: https://www.google.com/maps?q=%s Google maps | |
# b: https://www.bing.com/search?q=%s Bing | |
d: https://duckduckgo.com/?q=%s DuckDuckGo | |
az: https://www.amazon.ca/s/?field-keywords=%s Amazon | |
# qw: https://www.qwant.com/?q=%s Qwant | |
e: https://www.ecosia.org/search?q=%s Ecosia | |
# Default search | |
https://www.ecosia.org/search?q= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment