Skip to content

Instantly share code, notes, and snippets.

@sei0o
Last active December 6, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sei0o/b9ea8c3e8fcbc847a6b394f63cc1e0c3 to your computer and use it in GitHub Desktop.
Save sei0o/b9ea8c3e8fcbc847a6b394f63cc1e0c3 to your computer and use it in GitHub Desktop.
some config
if status is-interactive
# Commands to run in interactive sessions can go here
end
zoxide init fish | source
alias ls=exa
xkbcomp ~/.Xkeymap $DISPLAY 2>/dev/null
function cl
cd $argv
ls
end
alias cu="cd .."
alias cul="cd .. && ls"
alias cdl="cd $argv && ls"
alias cwd="pwd | xsel -ib"
# fzf
set -gx FZF_DEFAULT_COMMAND 'rg --files --follow --hidden'
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
# bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec --no-startup-id alacritty
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
#bindsym $mod+d exec --no-startup-id dmenu_run
# A more modern dmenu replacement is rofi:
bindcode $mod+40 exec "rofi -modi drun,run,combi -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
# walk around workspaces
bindsym $mod+j workspace prev
bindsym $mod+k workspace next
# change focus
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
# bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# using plasma's logout screen instead of i3's
bindsym $mod+Shift+e exec --no-startup-id qdbus-qt5 org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout -1 -1 -1
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar {
# status_command i3status
# }
# Plasma compatibility improvements
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [class="yakuake"] floating enable
for_window [class="systemsettings"] floating enable
for_window [class="plasmashell"] floating enable;
for_window [class="Plasma"] floating enable; border none
for_window [title="plasma-desktop"] floating enable; border none
for_window [title="win7"] floating enable; border none
for_window [class="krunner"] floating enable; border none
for_window [class="Kmix"] floating enable; border none
for_window [class="Klipper"] floating enable; border none
for_window [class="Plasmoidviewer"] floating enable; border none
for_window [class="(?i)*nextcloud*"] floating disable
for_window [class="plasmashell" window_type="notification"] border none, move right 700px, move down 450px
no_focus [class="plasmashell" window_type="notification"]
for_window [title="Desktop — Plasma"] kill; floating enable; border none
# exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# Hide window title bars
default_border none
default_floating_border none
" ============= Vim-Plug ============== "{{{
" auto-install vim-plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
"" ALE options must be set before its installation
set omnifunc=ale#completion#OmniFunc
" work with Coc
let g:ale_completion_enabled = 0
let g:ale_completion_autoimport = 0
let g:ale_disable_lsp = 1
let g:ale_sign_column_always = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'tslint'],
\ 'css': ['prettier'],
\ 'dart': ['dart-format'],
\ 'c': ['clang-format'],
\}
let g:ale_linters = {
\ 'rust': ['analyzer'],
\ 'javascript': ['eslint'],
\}
" Coc AutoCompletion
inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
"" lightline
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype']
\ ],
\ },
\ 'tabline': {
\ 'left': [ ['buffers'] ],
\ 'right': [ ['close'] ]
\ },
\ 'component_expand': {
\ 'buffers': 'lightline#bufferline#buffers',
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ },
\ 'component_type': {
\ 'buffers': 'tabsel',
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right',
\ }
\ }
call plug#begin(expand('~/.config/nvim/plugged'))
"}}}
" ================= looks and GUI stuff ================== "{{{
Plug 'ryanoasis/vim-devicons' " pretty icons everywhere
Plug 'luochen1990/rainbow' " rainbow parenthesis
Plug 'hzchirs/vim-material' " material color themes
Plug 'gregsexton/MatchTag' " highlight matching html tags
Plug 'Jorengarenar/vim-MvVis' " move visual selection
"}}}
" ================= Functionalities ================= "{{{
Plug 'neoclide/coc.nvim', {'branch': 'release'} " LSP and more
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fzf itself
Plug 'junegunn/fzf.vim' " fuzzy search integration
Plug 'honza/vim-snippets' " actual snippets
Plug 'Yggdroot/indentLine' " show indentation lines
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'} " better python
Plug 'tpope/vim-commentary' " better commenting
Plug 'mhinz/vim-startify' " cool start up screen
Plug 'tpope/vim-fugitive' " git support
Plug 'psliwka/vim-smoothie' " some very smooth ass scrolling
Plug 'wellle/tmux-complete.vim' " complete words from a tmux panes
Plug 'tpope/vim-eunuch' " run common Unix commands inside Vim
Plug 'machakann/vim-sandwich' " make sandwiches
Plug 'christoomey/vim-tmux-navigator' " seamless vim and tmux navigation
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
Plug 'itchyny/lightline.vim'
Plug 'cespare/vim-toml'
Plug 'dense-analysis/ale'
Plug 'rust-lang/rust.vim'
Plug 'mengelbrecht/lightline-bufferline'
Plug 'sheerun/vim-polyglot'
Plug 'maximbaz/lightline-ale'
Plug 'tpope/vim-obsession'
Plug 'nvim-lua/plenary.nvim'
Plug 'windwp/nvim-spectre'
call plug#end()
"}}}
" ==================== general config ======================== "{{{
set termguicolors " Opaque Background
set mouse=a " enable mouse scrolling
"set clipboard+=unnamedplus " use system clipboard by default
set tabstop=2 softtabstop=2 shiftwidth=2 autoindent " tab width
set expandtab smarttab " tab key actions
set incsearch ignorecase smartcase hlsearch " highlight text while searching
set list listchars=trail:»,tab:»- " use tab to navigate in list mode
set fillchars+=vert:\▏ " requires a patched nerd font (try FiraCode)
set wrap breakindent " wrap long lines to the width set by tw
set encoding=utf-8 " text encoding
set number " enable numbers on the left
set relativenumber " current line is 0
set title " tab title as file name
set noshowmode " dont show current mode below statusline
set noshowcmd " to get rid of display of last command
set conceallevel=2 " set this so we wont break indentation plugin
set splitright " open vertical split to the right
set splitbelow " open horizontal split to the bottom
set tw=90 " auto wrap lines that are longer than that
set emoji " enable emojis
set history=1000 " history limit
set backspace=indent,eol,start " sensible backspacing
set undofile " enable persistent undo
set undodir=/tmp " undo temp file directory
set foldlevel=0 " open all folds by default
set inccommand=nosplit " visual feedback while substituting
set showtabline=0 " always show tabline
set laststatus=2
set grepprg=rg\ --vimgrep " use rg as default grepper
" performance tweaks
set cursorline
set nocursorcolumn
set scrolljump=5
set lazyredraw
set redrawtime=10000
set synmaxcol=180
set re=1
set showtabline=2
" required by coc
set hidden
set nobackup
set nowritebackup
set cmdheight=1
set updatetime=300
set shortmess+=c
set signcolumn=yes
" Oh my CJK
"set ttimeout
"set ttimeoutlen=50
" Themeing
let g:material_style = 'oceanic'
colorscheme vim-material
hi Pmenu guibg='#00010a' guifg=white " popup menu colors
hi Comment gui=italic cterm=italic " italic comments
hi Search guibg=#b16286 guifg=#ebdbb2 gui=NONE " search string highlight color
hi NonText guifg=bg " mask ~ on empty lines
hi clear CursorLineNr " use the theme color for relative number
hi CursorLineNr gui=bold " make relative number bold
hi SpellBad guifg=NONE gui=bold,undercurl " misspelled words
" colors for git (especially the gutter)
hi DiffAdd guibg=#0f111a guifg=#43a047
hi DiffChange guibg=#0f111a guifg=#fdd835
hi DiffRemoved guibg=#0f111a guifg=#e53935
" coc multi cursor highlight color
hi CocCursorRange guibg=#b16286 guifg=#ebdbb2
"}}}
" ======================== Plugin Configurations ======================== "{{{
"" built in plugins
let loaded_netrw = 0 " diable netew
let g:omni_sql_no_default_maps = 1 " disable sql omni completion
let g:loaded_python_provider = 0
let g:loaded_perl_provider = 0
let g:loaded_ruby_provider = 0
if glob('~/.python3') != ''
let g:python3_host_prog = expand('~/.python3/bin/python')
else
let g:python3_host_prog = systemlist('which python3')[0]
endif
" rust.vim
let g:rustfmt_autosave = 1
"" coc
" Navigate snippet placeholders using tab
let g:coc_snippet_next = '<Tab>'
let g:coc_snippet_prev = '<S-Tab>'
" list of the extensions to make sure are always installed
let g:coc_global_extensions = [
\'coc-yank',
\'coc-pairs',
\'coc-json',
\'coc-css',
\'coc-yaml',
\'coc-lists',
\'coc-tsserver',
\'coc-html',
\'coc-snippets',
\'coc-pyright',
\'coc-clangd',
\'coc-xml',
\'coc-syntax',
\'coc-git',
\'coc-marketplace',
\'coc-highlight',
\'coc-sh',
\]
" indentLine
let g:indentLine_char_list = ['▏', '¦', '┆', '┊']
let g:indentLine_setColors = 0
let g:indentLine_setConceal = 0 " actually fix the annoying markdown links conversion
let g:indentLine_fileTypeExclude = ['startify']
"" startify
let g:startify_padding_left = 10
let g:startify_session_persistence = 1
let g:startify_enable_special = 0
let g:startify_change_to_vcs_root = 1
let g:startify_lists = [
\ { 'type': 'dir' },
\ { 'type': 'files' },
\ { 'type': 'sessions' },
\ { 'type': 'bookmarks' },
\ { 'type': 'commands' },
\ ]
" bookmark examples
let g:startify_bookmarks = [
\ {'v': '~/.config/nvim'},
\ {'d': '~/.dotfiles' }
\ ]
" custom commands
let g:startify_commands = [
\ {'ch': ['Health Check', ':checkhealth']},
\ {'ps': ['Plugins status', ':PlugStatus']},
\ {'pu': ['Update vim plugins',':PlugUpdate | PlugUpgrade']},
\ {'uc': ['Update coc Plugins', ':CocUpdate']},
\ {'h': ['Help', ':help']},
\ ]
" custom banner
let g:startify_custom_header = [
\ ' our work is never over',
\]
" rainbow brackets
let g:rainbow_active = 1
" tmux navigator
let g:tmux_navigator_no_mappings = 1
" semshi settings
let g:semshi#error_sign = v:false " let ms python lsp handle this
"" FZF
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'border': 'sharp' } }
let g:fzf_tags_command = 'ctags -R'
let $FZF_DEFAULT_OPTS = '--layout=reverse --inline-info'
let $FZF_DEFAULT_COMMAND = "rg --files --hidden --glob '!.git/**' --glob '!build/**' --glob '!.dart_tool/**' --glob '!.idea' --glob '!node_modules'"
"}}}
" ======================== Commands ============================= "{{{
au BufEnter * set fo-=c fo-=r fo-=o " stop annoying auto commenting on new lines
au FileType help wincmd L " open help in vertical split
au BufWritePre * :%s/\s\+$//e " remove trailing whitespaces before saving
au CursorHold * silent call CocActionAsync('highlight') " highlight match on cursor hold
" enable spell only if file type is normal text
let spellable = ['markdown', 'gitcommit', 'txt', 'text', 'liquid', 'rst']
autocmd BufEnter * if index(spellable, &ft) < 0 | set nospell | else | set spell | endif
" coc completion popup
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" startify if no passed argument or all buffers are closed
augroup noargs
" startify when there is no open buffer left
autocmd BufDelete * if empty(filter(tabpagebuflist(), '!buflisted(v:val)')) | Startify | endif
" open startify on start if no argument was passed
autocmd VimEnter * if argc() == 0 | Startify | endif
augroup END
" fzf if passed argument is a folder
augroup folderarg
" change working directory to passed directory
autocmd VimEnter * if argc() != 0 && isdirectory(argv()[0]) | execute 'cd' fnameescape(argv()[0]) | endif
" start startify (fallback if fzf is closed)
autocmd VimEnter * if argc() != 0 && isdirectory(argv()[0]) | Startify | endif
" start fzf on passed directory
autocmd VimEnter * if argc() != 0 && isdirectory(argv()[0]) | execute 'Files ' fnameescape(argv()[0]) | endif
augroup END
" Return to last edit position when opening files
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" python renaming
autocmd FileType python nnoremap <leader>rn :Semshi rename <CR>
" format with available file format formatter
command! -nargs=0 Format :call CocAction('format')
" organize imports
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" files in fzf
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--inline-info']}), <bang>0)
" advanced grep
command! -nargs=* -bang Rg call RipgrepFzf(<q-args>, <bang>0)
"}}}
" ================== Custom Functions ===================== "{{{
" advanced grep(faster with preview)
function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
" startify file icons
function! StartifyEntryFormat()
return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path'
endfunction
" check if last inserted char is a backspace (used by coc pmenu)
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" show docs on things with K
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
"}}}
" ======================== Custom Mappings ====================== "{{{
"" the essentials
let mapleader=","
nnoremap ; :
nmap \ <leader>q
map <F6> :Startify <CR>
nmap <leader>r :so ~/.config/nvim/init.vim<CR>
nmap <leader>q :bd<CR>
nmap <leader>w :w<CR>
map <leader>f :Format<CR>
"nmap <Tab> :bnext<CR>
"nmap <S-Tab> :bprevious<CR>
nnoremap <silent> <C-PageUp> :bprev<CR>
nnoremap <silent> <C-PageDown> :bnext<CR>
noremap <leader>e :PlugInstall<CR>
noremap <C-q> :q<CR>
" new line in normal mode and back
map <Enter> o<ESC>
map <S-Enter> O<ESC>
" use a different register for delete and paste
"nnoremap d "_d
"vnoremap d "_d
"vnoremap p "_dP
"nnoremap x "_x
" emulate windows copy, cut behavior
vnoremap <LeftRelease> "+y<LeftRelease>
vnoremap <C-c> "+y<CR>
vnoremap <C-x> "+d<CR>
" switch between splits using ctrl + {h,j,k,l}
inoremap <C-h> <C-\><C-N><C-w>h
inoremap <C-j> <C-\><C-N><C-w>j
inoremap <C-k> <C-\><C-N><C-w>k
inoremap <C-l> <C-\><C-N><C-w>l
nnoremap <C-h> <C-w>h
noremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" disable hl with 2 esc
noremap <silent><esc> <esc>:noh<CR><esc>
" trim white spaces
nnoremap <F2> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
" markdown preview
au FileType markdown nmap <leader>m :MarkdownPreview<CR>
"" FZF
nnoremap <C-p> :Files<CR>
nmap <leader>b :Buffers<CR>
nmap <leader>c :Commands<CR>
nmap <leader>t :BTags<CR>
nmap <leader>/ :Rg<CR>
nmap <leader>gc :Commits<CR>
nmap <leader>gs :GFiles?<CR>
nmap <leader>sh :History/<CR>
" show mapping on all modes with F1
nmap <F1> <plug>(fzf-maps-n)
imap <F1> <plug>(fzf-maps-i)
vmap <F1> <plug>(fzf-maps-x)
"" coc
" use tab to navigate snippet placeholders
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Use enter to accept snippet expansion
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>"
" multi cursor shortcuts
nmap <silent> <C-a> <Plug>(coc-cursors-word)
xmap <silent> <C-a> <Plug>(coc-cursors-range)
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" other stuff
nmap <leader>rn <Plug>(coc-rename)
nmap <leader>o :OR <CR>
" jump stuff
nmap <leader>jd <Plug>(coc-definition)
nmap <leader>jy <Plug>(coc-type-definition)
nmap <leader>ji <Plug>(coc-implementation)
nmap <leader>jr <Plug>(coc-references)
" other coc actions
nnoremap <silent> K :call <SID>show_documentation()<CR>
nmap <leader>a <Plug>(coc-codeaction-line)
xmap <leader>a <Plug>(coc-codeaction-selected)
" fugitive mappings
nmap <leader>gd :Gdiffsplit<CR>
nmap <leader>gb :Git blame<CR>
" tmux navigator
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
" nvim-spectre
nnoremap <leader>S :lua require('spectre').open()<CR>
" search current word
nnoremap <leader>sw :lua require('spectre').open_visual({select_word=true})<CR>
vnoremap <leader>s :lua require('spectre').open_visual()<CR>
" search in current file
nnoremap <leader>sp viw:lua require('spectre').open_file_search()<cr>
"}}}
" ======================== Additional sourcing ====================== "{{{
"source ~/.config/nvim/statusline.vim
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment