Skip to content

Instantly share code, notes, and snippets.

@paveltretyakovru
Last active September 30, 2022 13:05
Show Gist options
  • Save paveltretyakovru/f05ed7fd908994dbfe0b638a65a3ee94 to your computer and use it in GitHub Desktop.
Save paveltretyakovru/f05ed7fd908994dbfe0b638a65a3ee94 to your computer and use it in GitHub Desktop.
vimrc configuration file
" Tabulation highlights syntax
set tabstop=2
set shiftwidth=2
set smarttab
set expandtab " Copy current line tabs to new line
set smartindent " ...like a expandtab but it adding {} tabs
" ========================= Short keys settings" ==============================
" NERDTree
map <silent> <C-b> :NERDTreeToggle<CR> " NERDTree toggle
map <C-l> :tabn<CR> " NERDTree next tab
map <C-h> :tabp<CR> " NERDTree previous tab
map <C-n> :tabnew<CR> " NERDTree create tab
" map <C-S-w> <Esc>:tabclose<CR> " NERDTree close tab
" Foldings code blocks
inoremap <F9> <C-O>za
nnoremap <F9> za
onoremap <F9> <C-C>za
vnoremap <F9> zf
" Git Diff changes
" Moving betwing hunks
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)
" ============================== /short keys ==================================
" Install vim-plug. To install -> :PlugInstall
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin('~/.vim/plugged')
" NERDTree
Plug 'https://github.com/scrooloose/nerdtree.git'
" JavScript highlights syntax plugin
Plug 'https://github.com/pangloss/vim-javascript.git'
" Quick open like Ctrl-P in other IDEs
Plug 'https://github.com/kien/ctrlp.vim.git'
" Vim ES linter
Plug 'dense-analysis/ale'
" Emmet plugin
" Type 'html:5' then type <c-y>, (Ctrl + y + ,)
Plug 'https://github.com/mattn/emmet-vim.git'
" Prettier
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'css', 'scss', 'json', 'markdown', 'yaml', 'html'] }
" Quick commenting
Plug 'scrooloose/nerdcommenter'
Plug 'https://github.com/tpope/vim-commentary.git'
" JSX syntax
Plug 'https://github.com/mxw/vim-jsx.git'
" TypeScript syntax
Plug 'https://github.com/leafgarland/typescript-vim.git'
" Global search in current directory (:Ack <search>)
Plug 'https://github.com/mileszs/ack.vim.git'
" Autoimport typescript and other snypets (see on the repo)
Plug 'https://github.com/Quramy/tsuquyomi.git'
" Color table (:XtermColorTable to show table)
Plug 'https://github.com/guns/xterm-color-table.vim.git'
" Generator of JSDoc blocks
Plug 'https://github.com/heavenshell/vim-jsdoc.git'
" Git Diff tool
Plug 'https://github.com/airblade/vim-gitgutter.git'
" Git last commit info
Plug 'zivyangll/git-blame.vim'
" Dart
Plug 'dart-lang/dart-vim-plugin'
" Vim-lsc
Plug 'https://github.com/natebosch/vim-lsc.git'
Plug 'natebosch/vim-lsc-dart'
" Mustache & handlebars hightlights
Plug 'https://github.com/mustache/vim-mustache-handlebars.git'
" Languaages cheats
" :Howin dart read file
Plug 'https://github.com/dbeniamine/cheat.sh-vim.git'
call plug#end()
" Ctrol-P plugin configuration
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
" Enable JSDoc highlights syntax
let g:javascript_plugin_jsdoc = 1
" Column line settings
highlight ColorColumn ctermbg=gray
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" ESLint configuration
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\}
" Some commands configuration
command! W write " Fix to save file when write capital w at frist time
" Show invisible chars (current I have set a caret and spaces)
":set list
":set listchars=eol:↩,space:·
" set nolist
" NERDTree configuration
let g:NERDTreeWinSize=30 " Width of files panel. shit + a -> to toggle width
let NERDTreeShowHidden=1 " Display hidden files
" Enabling line number
" set nonumber
set number
" Enable code fold blocks
set foldenable
set foldmethod=syntax
" To save and autoload blocks in the file
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
" Configuration for ack.vim with using silver search app
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" Configuration tsuquyomi (autoimport for typescript and other snippets)
:let g:tsuquyomi_single_quote_import=1
" Configruation for the global search ack.vim plugin
" Disable autoopen first result of search
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space
" Configure background of folded blocks
highlight Folded ctermbg=232
" Code comment plugin configuration
" To add commenting jsx code add command
" set commentstring={/*\ %s\ */}
" to ~/.vim/plugged/vim-jsx/after/ftplugin/jsx.vim file
" And now to comment {/* */} use gcc, comment /* */ use \+c+c
" JSDoc comments generator configuration
:let g:jsdoc_enable_es6=1
" Dart configuration
let g:lsc_auto_map = v:true
let dart_html_in_string=v:true
let g:dart_style_guide = 2
let g:lsc_server_commands = {'dart': 'dart_language_server'}
" Git blame settings
" \s - to show git line information
nnoremap <Leader>s :<C-u>call gitblame#echo()<CR>
# Install to search in vim
sudo aptitude install silversearcher-ag;
# Install PlugVim to install vim packages
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
#... then, to install plugins - :PlugInstall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment