Skip to content

Instantly share code, notes, and snippets.

@barelyhuman
Last active April 25, 2023 02:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barelyhuman/16285b2195cfd25d8c84356676cc807d to your computer and use it in GitHub Desktop.
Save barelyhuman/16285b2195cfd25d8c84356676cc807d to your computer and use it in GitHub Desktop.
self sufficient single Vim file for a minimal, portable vim

Vim Portable Config

The above config is single file for portability between environments.

Here's dependents that you need to set it up

macOS

brew install ripgrep vim
curl -sL  https://gist.githubusercontent.com/barelyhuman/16285b2195cfd25d8c84356676cc807d/raw/.vimrc > ~/.vimrc
vim +'PlugInstall --sync' +qa

This should

  • normalize the backspace behaviour
  • Setup fzf on ,+p for file search
  • Setup ripgrep on ,+f for global file content search
  • LspInstallServer should auto install language servers for your current programming language
" setup vim plug
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" plugs
call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'mattn/vim-goimports'
Plug 'preservim/nerdtree'
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-vinegar'
Plug 'chriskempson/base16-vim'
Plug 'zah/nim.vim'
Plug 'w0rp/ale'
Plug 'rose-pine/vim'
call plug#end()
" vim configuration
" theme
set background=dark
let g:disable_bg = 1
colorscheme rosepine
let g:lightline = { 'colorscheme': 'rosepine' }
" syntax handlers
let g:ale_fixers = {
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint']
\ }
let g:ale_fix_on_save = 1
" syntax and shortcuts
syntax on
set autoread
set scrolloff=5
set laststatus=2
set backspace=indent,eol,start
let mapleader = ","
nnoremap <leader>e :NERDTreeToggle<CR>
inoremap <leader>w <Esc>:w<cr>
nmap <leader>p :FZF<CR>
nmap <leader>f :Rg<CR>
" Mouse support
set mouse=a
set ttymouse=sgr
set balloonevalterm
" Truecolor support
let &t_8f = "\e[38:2:%lu:%lu:%lum"
let &t_8b = "\e[48:2:%lu:%lu:%lum"
let &t_RF = "\e]10;?\e\\"
let &t_RB = "\e]11;?\e\\"
" Window title
let &t_ST = "\e[22;2t"
let &t_RT = "\e[23;2t"
" background color fix
let &t_ut=''
" lsp config
let g:lsp_diagnostics_enabled = 0
let g:ale_virtualtext_cursor = 'current'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment