Skip to content

Instantly share code, notes, and snippets.

@carolusquintus
Last active March 22, 2023 04:48
Show Gist options
  • Save carolusquintus/aa1ec06196c4e752276d747a480c4a6f to your computer and use it in GitHub Desktop.
Save carolusquintus/aa1ec06196c4e752276d747a480c4a6f to your computer and use it in GitHub Desktop.
" start ~/.config/nvim/init.vim
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc
" end ~/.config/nvim/init.vim
" show line numbers
set number
" defines line numbers width
set numberwidth=2
" allow mouse interaction
set mouse=a
" allow copy/paste from clipboard & vim
set clipboard^=unnamed,unnamedplus
" show matching brackets/parenthesis
syntax enable
" show commands on bar
set showcmd
" show cursor positon
set ruler
" utf-8 as default
set encoding=utf-8
" show closing brackets
set showmatch
" shows line numbers to move on files
set relativenumber
" always show status bar
set laststatus=2
" shell interactive to load aliases from .bashrc | .zshrc
set shellcmdflag=-ic
" show invisibles
set listchars=eol:⏎
set listchars+=tab:→—
set listchars+=trail:␣
set listchars+=space:·
set list
" insert spaces when tab is pressed "
set tabstop=4
set shiftwidth=4
set expandtab
augroup filetype
au! BufRead,BufNewFile *.proto setfiletype proto
augroup end
call plug#begin('~/.vim/plugins')
Plug 'morhetz/gruvbox'
Plug 'easymotion/vim-easymotion'
Plug 'scrooloose/nerdtree'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-commentary'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-entire'
Plug 'powerline/powerline'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'chaoren/vim-wordmotion'
call plug#end()
" Space character as <Leader>
let mapleader=' '
" no highlight
nmap <Leader>nh :noh<CR>
" write & quit
nmap <Leader>q! :q!<CR>
nmap <Leader>wq :wq<CR>
nmap <Leader>w :w<CR>
nmap <Leader>q :q<CR>
" theme
if (has('termguicolors'))
set termguicolors
endif
let g:gruvbox_contrast_dark='hard'
colorscheme gruvbox
" easymotion
nmap <Leader>em <Plug>(easymotion-s2)
" NERDTree
nmap <Leader>nt :NERDTreeFind<CR>
" NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" NERDTree when Vim starts with a directory argument.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" let NERDTreeQuitOnOpen=1
" prettyfy json
nmap <Leader>pj :%!jq .
" inline json
nmap <Leader>ij :%!jq -c .
" tmux-navigator
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <C-x><Left> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-x><Down> :TmuxNavigateDown<cr>
nnoremap <silent> <C-x><Up> :TmuxNavigateUp<cr>
nnoremap <silent> <C-x><Right> :TmuxNavigateRight<cr>
nnoremap <silent> <C-x>.. :TmuxNavigatePrevious<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment