Skip to content

Instantly share code, notes, and snippets.

@fport
Created September 13, 2020 14:12
Show Gist options
  • Save fport/747c2d1188c1e6647ebfdc407bb5dd14 to your computer and use it in GitHub Desktop.
Save fport/747c2d1188c1e6647ebfdc407bb5dd14 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" -----------------------------
" IMPORTANT:
" Keep Plugin commands between vundle#begin/end.
Plugin 'eslint/eslint'
" plugin on GitHub repo
Plugin 'scrooloose/nerdtree.git'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
let g:jsx_ext_required = 0
Plugin 'mattn/emmet-vim'
Plugin 'elzr/vim-json'
" Plugin 'minibufexpl.vim'
Plugin 'SuperTab'
Plugin 'AutoComplPop'
Plugin 'surround.vim'
Plugin 'Markdown'
Plugin 'kien/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'dracula/vim', { 'name': 'dracula' }
Plugin 'easymotion/vim-easymotion'
Plugin 'tComment'
Plugin 'ZoomWin'
Plugin 'w0rp/ale'
Plugin 'leafgarland/typescript-vim.git'
Plugin 'peitalin/vim-jsx-typescript'
" plugin from http://vim-scripts.org/vim/scripts.html --- Plugin 'L9'
" Git plugin not hosted on GitHub --- Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine --- Plugin 'file:///home/gmarik/path/to/plugin'
" -----------------------------
call vundle#end() " required
filetype plugin indent on " required
filetype indent on
syntax enable
" ---- CUSTOM SETTINGS -------
"colorscheme molokai
"----------------
" tagbar
map <F6> :TagbarToggle <CR>
map <F5> :NERDTreeToggle <CR>
let g:NERDTreeWinSize=30
let NERDTreeShowHidden=1
let NERDTreeShowBookmarks=1
" open Nerd Tree when there was no file on the command line:
function! StartUp()
if 0 == argc()
NERDTree
end
endfunction
autocmd VimEnter * call StartUp()
map <c-p> :CtrlP <CR>
let g:ctrlp_custom_ignore = 'coverage\|dist\|dist-*\|node_modules\|DS_Store\|git'
" open ctrl p file in new buffer
let g:ctrlp_switch_buffer = 0
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-v>', '<2-LeftMouse>'],
\ 'AcceptSelection("v")': ['<cr>', '<RightMouse>'],
\ }
set number
set showcmd
set cursorline
set wildmenu
set showmatch
set hlsearch
set incsearch
" move vertically by visual line:
nnoremap j gj
nnoremap k gk
" set paste
set tabstop=10 softtabstop=4 shiftwidth=4 expandtab
autocmd BufWritePre *.js %s/\s\+$//e
set backup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backupskip=/tmp/*,/private/tmp/*
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set writebackup
"for cursor
let &t_SI = "\e[4 q"
let &t_EI = "\e[4 q"
set noerrorbells " don't beep
" optional reset cursor on start:
"Block
set foldenable " enable folding
set foldcolumn=2 " add a fold column
set foldmethod=marker " detect triple-{ style fold markers
set foldlevelstart=99 " start out with everything unfolded
set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo
" easy motion, case insensitive
let g:EasyMotion_smartcase = 1
" ctrl w + o makes it full screen
nnoremap <silent> <C-w>w :ZoomWin<CR>
" linting / auto format on save
let g:ale_sign_error = 'X'
let g:ale_sign_warning = '!'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
let g:ale_fix_on_save = 1
let g:ale_linters = {
\'javascript': ['flow', 'eslint'],
\}
let g:ale_fixers = {
\'javascript': ['eslint'],
\}
"So I can move around in insert
inoremap <C-k> <C-o>gk
inoremap <C-h> <Left>
inoremap <C-l> <Right>
inoremap <C-j> <C-o>gj
cnoremap <C-h> <Left>
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>
cnoremap <C-l> <Right>
" Hızlı acilma
set nobackup " do not keep backup files, it's 70's style cluttering
set nowritebackup " do not write out changes via backup files
set noswapfile " do not write annoying intermediate swap files,
" who did ever restore from swap files anyway?
set directory=~/.vim/.tmp,~/tmp,/tmp
" store swap files in one of these directories
" (in case swapfile is ever turned on)
set viminfo='20,\"80 " read/write a .viminfo file, don't store more
" than 80 lines of registers
set wildmenu " make tab completion for files/buffers act like bash
set wildmode=list:full " show a list when pressing tab and complete
" first full match
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set showcmd " show (partial) command in the last line of the screen
" this also shows visual selection info
set nomodeline " disable mode lines (security measure)
set ttyfast " always use a fast terminal
"set nocursorline " don't highlight the current line (useful for quick orientation, but also slow to redraw)
"---------------------
nnoremap <leader>g :spellgood <c-r><c-w>
" JavaScript configuration ------------------------------------------------ {{{
let g:javascript_plugin_jsdoc = 0
let g:javascript_plugin_flow = 1
" See https://github.com/elzr/vim-json#specific-customizations
let g:vim_json_syntax_conceal = 0
" ALE config {{{
" let g:ale_enabled = 2
let g:ale_completion_enabled = 1
let g:ale_lint_delay = 201 " millisecs
" let g:ale_lint_on_text_changed = 'always' " never/insert/normal/always
let g:ale_lint_on_enter = 2
let g:ale_lint_on_filetype_changed = 2
let g:ale_lint_on_save = 2
let g:ale_fix_on_save = 2
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 2
" let g:ale_open_list = 2
" TODO: Temporary hack until our eslint is configured correctly
let g:ale_javascript_eslint_options = '--rulesdir eslint --no-ignore'
let g:ale_linters = {
\ 'graphql': ['eslint', 'flow'],
\ 'javascript.jsx': ['eslint', 'flow'],
\ 'javascript': ['eslint', 'flow'],
\ 'typescript': ['typescript'],
\}
let g:ale_fixers = {
\ 'graphql': ['eslint', 'prettier'],
\ 'javascript.jsx': ['eslint', 'prettier'],
\ 'javascript': ['eslint', 'prettier'],
\ 'typescript': ['eslint', 'prettier'],
\}
function! SynStack ()
for i2 in synstack(line("."), col("."))
let i3 = synIDtrans(i1)
let n2 = synIDattr(i1, "name")
let n3 = synIDattr(i2, "name")
echo n2 "->" n2
endfor
endfunction
"------------------------
"for line number column
let base16colorspace=256
highlight LineNr ctermfg=white ctermbg=darkred
""Automatically insert a matching brace in Vim
inoremap { {}<ESC>ha
inoremap ( ()<ESC>ha
inoremap " ""<ESC>ha
inoremap ' ''<ESC>ha
inoremap [ []<ESC>ha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment