Skip to content

Instantly share code, notes, and snippets.

@rowinf
Last active July 7, 2021 21:00
Show Gist options
  • Save rowinf/65b3126f812b6e2985ed828d8bdd9e5f to your computer and use it in GitHub Desktop.
Save rowinf/65b3126f812b6e2985ed828d8bdd9e5f to your computer and use it in GitHub Desktop.
"
" Gist url
" https://gist.github.com/rowinf/65b3126f812b6e2985ed828d8bdd9e5f
"
" Normally this if-block is not needed, because `:set nocp` is done
" automatically when .vimrc is found. However, this might be useful
" when you execute `vim -u .vimrc` from the command line.
if &compatible
" `:set nocp` has many side effects. Therefore this should be done
" only when 'compatible' is set.
set nocompatible
endif
filetype off
" minpac is built on top of the native vim package manager
"
" install minpac manually first
" https://github.com/k-takata/minpac
"
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('tpope/vim-fugitive')
call minpac#add('junegunn/fzf')
call minpac#add('junegunn/fzf.vim')
call minpac#add('mileszs/ack.vim')
call minpac#add('sheerun/vim-polyglot')
" colors
" twilight - https://www.vim.org/scripts/script.php?script_id=1677
call minpac#add('chriskempson/base16-vim')
call minpac#add('ayu-theme/ayu-vim')
call minpac#add('ryuta69/elly.vim')
call minpac#add('wadackel/vim-dogrun')
call minpac#add('vimwiki/vimwiki')
call minpac#add('tpope/vim-sleuth')
call minpac#add('tpope/vim-surround')
call minpac#add('prettier/vim-prettier')
call minpac#add('jlanzarotta/bufexplorer')
call minpac#add('airblade/vim-gitgutter')
call minpac#add('tpope/vim-commentary')
call minpac#add('tpope/vim-sensible')
call minpac#add('tpope/vim-vinegar')
call minpac#add('tpope/vim-repeat')
call minpac#add('w0rp/ale')
call minpac#add('easymotion/vim-easymotion')
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
command! PackStatus call minpac#status()
set showcmd
set guifont=Inconsolata-g:h14
set termguicolors
set secure
set exrc
set number
set mouse=a
set cursorline!
set autoindent
set ignorecase
set smartcase
" netrw
let g:netrw_lisstyle = 3
"let g:prettier#autoformat_config_present = 1
let $FZF_DEFAULT_COMMAND='ag -l --path-to-ignore ~/.ag_ignore --nocolor --hidden'
colorscheme evening
" nnoremap <silent> <F4> :set cursorline!<CR>
nnoremap <C-p> :<C-u>FZF<CR>
if executable('ag')
let g:ackprg = 'ag --vimgrep --path-to-ignore ~/.ag_ignore'
set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column
set grepformat=%f:%l:%c:%m,%f:%l:%m
endif
if exists('$TMUX')
let g:fzf_layout = { 'tmux': '-p90%,60%' }
else
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
endif
let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'syntax': 'markdown', 'ext': '.md'}]
" change the cursor on insert mode
autocmd! InsertEnter,InsertLeave * set cul!
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" ale settings
let g:ale_linters = {
\ 'javascript': ['eslint'],
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier', 'eslint'],
\}
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 0
let g:ale_completion_autoimport = 1
set omnifunc=ale#completion#OmniFunc
nmap <silent> [W <Plug>(ale_first)
nmap <silent> [w <Plug>(ale_previous)
nmap <silent> ]w <Plug>(ale_next)
nmap <silent> ]W <Plug>(ale_last)
" Quickfix shortcuts
" https://vim.fandom.com/wiki/Learn_to_use_help
:nnoremap <S-F1> :cc<CR>
:nnoremap <F2> :cnext<CR>
:nnoremap <S-F2> :cprev<CR>
:nnoremap <F3> :cnfile<CR>
:nnoremap <S-F3> :cpfile<CR>
:nnoremap <F4> :cfirst<CR>
:nnoremap <S-F4> :clast<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment