Skip to content

Instantly share code, notes, and snippets.

Last active September 19, 2022 09:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
vimrc at work
"Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Plug '~/.vim/plugged/vimwiki'
Plug '~/.vim/plugged/vim-css-color'
Plug '~/.vim/plugged/vim-commentary'
Plug '~/.vim/plugged/fzf.vim'
Plug '~/.vim/plugged/vim-visual-multi'
Plug '~/.vim/plugged/nerdtree'
Plug '~/.vim/plugged/vim-easy-align'
Plug '~/.vim/plugged/vim-find-my-cursor'
Plug '~/.vim/plugged/rainbow'
Plug '~/.vim/plugged/vim-syntastic'
Plug '~/.vim/plugged/vim-airline'
Plug '~/.vim/plugged/vim-airline-themes'
Plug '~/.vim/plugged/vim-phpstan'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
filetype plugin on
set ruler
set showcmd
set showmatch
set encoding=utf-8
set showmode
set title
set ignorecase
set noswapfile
set autoindent
set smartindent
set nocompatible
set visualbell
set hidden
set matchpairs+=(:)
set matchpairs+=<:>
colorscheme deus
set background=dark
syntax enable
set hlsearch
set incsearch
set number relativenumber
set nu rnu
set tabstop=4
set shiftwidth=4
set textwidth=0
set wrapmargin=0
set wrap!
set mouse=a
set scrolloff=10
let mapleader=" "
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,trail:·,precedes:←,extends:→,eol:↲,nbsp:␣,space:·
nmap <leader>h :nohl<CR>
nmap <leader>, :set spell!<CR>
nmap <C-p> :Explore<CR>
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
set backspace=indent,eol,start
set wildmode=longest,list,full
set wildmenu
" copy and paste
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
" center view on the search result
noremap n nzz
noremap N Nzz
nnoremap j gj
nnoremap k gk
noremap <A-Left> :-tabmove<cr>
noremap <A-Right> :+tabmove<cr>
set noendofline binary
hi SpecialKey ctermfg=66 guifg=#aeb2b2
hi SpecialKey ctermbg=66 guibg=#010201
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
return "\<c-p>"
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
set colorcolumn=120
nnoremap <leader>1 1gt
nnoremap <leader>2 2gt
nnoremap <leader>3 3gt
nnoremap <leader>4 4gt
nnoremap <leader>5 5gt
nnoremap <leader>6 6gt
nnoremap <leader>7 7gt
nnoremap <leader>8 8gt
nnoremap <leader>9 9gt
nnoremap <leader>0 0gt
let g:fzf_preview_window = ['right:50%', 'ctrl-\']
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" Make finding a key easier
nnoremap <leader>f <CMD>FindCursor #9c67bc 500<CR>
noremap % %<CMD>FindCursor 0 500<CR>
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
" syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_php_checkers = ['php', 'phpstan']
let g:syntastic_javascript_checkers = ['eslint', 'standard']
" Highlighter
" Highlight all instances of word under cursor, when idle.
" Useful when studying strange source code.
" Type z/ to toggle highlighting on/off.
nnoremap z/ :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR>
function! AutoHighlightToggle()
let @/ = ''
if exists('#auto_highlight')
au! auto_highlight
augroup! auto_highlight
setl updatetime=4000
echo 'Highlight current word: off'
return 0
augroup auto_highlight
au CursorHold * let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'
augroup end
setl updatetime=500
echo 'Highlight current word: ON'
return 1
" phpstan
let g:phpstan_analyse_level = 9%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment