Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Use Vim settings, rather then Vi settings (much better!).
- " This must be first, because it changes other options as a side effect.
- set nocompatible
- set autochdir
- " leader is just used elsewhere
- let mapleader = "\<Space>"
- " save
- nnoremap <Leader>w :w<CR>
- " space space to visual line mode
- nmap <Leader><Leader> V
- " Vundle and some plugins: NerdTree and Dash
- filetype off " required for Vundle
- set rtp+=~/.vim/bundle/Vundle.vim
- call vundle#begin()
- Plugin 'gmarik/Vundle.vim'
- Plugin 'w0rp/ale'
- Plugin 'dart-lang/dart-vim-plugin'
- Plugin 'thosakwe/vim-flutter'
- Plugin 'udalov/kotlin-vim'
- Plugin 'scrooloose/nerdtree'
- Plugin 'rizzatti/dash.vim'
- Plugin 'altercation/vim-colors-solarized'
- Plugin 'pangloss/vim-javascript'
- Plugin 'jeler/vim-javascript-syntax'
- Plugin 'airblade/vim-gitgutter'
- Plugin 'marijnh/tern_for_vim'
- Plugin 'Valloric/YouCompleteMe'
- Plugin 'SirVer/ultisnips'
- Plugin 'honza/vim-snippets'
- Plugin 'epilande/vim-es2015-snippets'
- Plugin 'epilande/vim-react-snippets'
- Plugin 'kien/ctrlp.vim'
- Plugin 'terryma/vim-expand-region'
- Plugin 'vim-scripts/gitignore'
- Plugin 'tpope/vim-commentary'
- Plugin 'tpope/vim-rsi'
- Plugin 'bling/vim-airline'
- Plugin 'jeffkreeftmeijer/vim-numbertoggle'
- Plugin 'mxw/vim-jsx'
- Plugin 'othree/html5.vim'
- Plugin 'digitaltoad/vim-pug'
- Plugin 'haya14busa/incsearch.vim'
- call vundle#end()
- " javascript / eslint goodness
- let g:ale_fixers = {
- \ 'javascript': ['eslint']
- \ }
- let g:ale_sign_error = '❌'
- let g:ale_sign_warning = '⚠️'
- let g:ale_fix_on_save = 1
- " dart goodness
- let g:lsc_server_commands = {'dart': 'dart_language_server'}
- let g:lsc_auto_map = {
- \ 'defaults': v:true,
- \ 'NextReference': '',
- \ 'PreviousReference': '',
- \ }
- let dart_format_on_save = 1
- let dart_style_guide = 2
- " flutter goodness
- nnoremap <leader>fa :FlutterRun<cr>
- nnoremap <leader>fq :FlutterQuit<cr>
- nnoremap <leader>fr :FlutterHotReload<cr>
- nnoremap <leader>fR :FlutterHotRestart<cr>
- nnoremap <leader>fD :FlutterVisualDebug<cr>
- let g:UltiSnipsSnippetDirectories=["UltiSnips", "tim-snippets"]
- " airline
- set laststatus=2
- set noshowmode
- let g:airline#extensions#tabline#enabled = 1
- " gitgutter will complain all the time if it exceeds the max
- let g:gitgutter_max_signs=9999
- " git gutter commands
- nmap <Leader>hn <Plug>GitGutterNextHunk
- nmap <Leader>hN <Plug>GitGutterPrevHunk
- nmap <Leader>hs <Plug>GitGutterStageHunk
- nmap <Leader>hu <Plug>GitGutterUndoHunk
- " region expanding
- vmap v <Plug>(expand_region_expand)
- vmap <C-v> <Plug>(expand_region_shrink)
- " make ctrl-p faster
- let g:ctrlp_use_caching = 0
- if executable('ag')
- set grepprg=ag\ --nogroup\ --nocolor
- let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
- else
- let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
- let g:ctrlp_prompt_mappings = {
- \ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'],
- \ }
- endif
- " ultisnip configuration
- let g:UltiSnipsExpandTrigger="<c-j>"
- let g:UltiSnipsJumpForwardTrigger="<c-j>"
- let g:UltiSnipsJumpBackwardTrigger="<c-k>"
- " If you want :UltiSnipsEdit to split your window.
- "let g:UltiSnipsEditSplit="vertical"
- " sets terminal title upon exit so the unhelpful Thanks for flying message is not shown
- let &titleold=getcwd()
- " ycm: show results as you type in CSS / SASS
- let g:ycm_semantic_triggers = {
- \ 'css,scss': [ 're!^\s{4}', 're!:\s+' ],
- \ }
- " disable ycm for .rb (it complains that gems are not built)
- let g:ycm_filetype_blacklist = { 'ruby': 1 }
- " disable the scratch preview window in omnicomplete
- set completeopt-=preview
- " set nowrap
- set expandtab
- set tabstop=2
- set shiftwidth=2
- set autowrite
- set mouse=a
- set title
- " line numbers (plugin uses relative)
- set number
- " exit insert mode (ESC is far away)
- :imap jj <Esc>
- " use system clipboard yank / put
- set clipboard=unnamed
- " nerd tree with t key
- nnoremap <silent> q :NERDTreeToggle<CR>
- " moves cursor to previous line when hitting back/forward movement
- set whichwrap+=<,>,h,l,[,]
- " move through buffers (must disable ale_fix_on_save first because it will
- " error
- command! ALEToggleFixer execute "let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) ? 0 : 1"
- nmap <silent> <C-j> :ALEToggleFixer<CR>:bn<CR>:ALEToggleFixer<CR>
- nmap <silent> <C-k> :ALEToggleFixer<CR>:bp<CR>:ALEToggleFixer<CR>
- nmap <silent> <C-h> :ALEToggleFixer<CR>:update<CR>:bd<CR>:ALEToggleFixer<CR>
- " allow the minimum window height to be zero so only file name is visible
- set wmh=0
- " quickly resize
- nmap - <C-W>-
- nmap + <C-W>+
- nmap _ <C-W>_
- nmap = <C-W>=
- " Open new split panes to right and bottom, which feels more natural than Vim’s default:
- set splitbelow
- set splitright
- " allow backspacing over everything in insert mode
- set backspace=indent,eol,start
- set history=50 " keep 50 lines of command line history
- set ruler " show the cursor position all the time
- set showcmd " display incomplete commands
- " incsearch plugin does highlighting
- set hlsearch
- map / <Plug>(incsearch-forward)
- map ? <Plug>(incsearch-backward)
- map g/ <Plug>(incsearch-stay)
- let g:incsearch#auto_nohlsearch = 1
- map n <Plug>(incsearch-nohl-n)zz
- map N <Plug>(incsearch-nohl-N)zz
- map * <Plug>(incsearch-nohl-*)
- map # <Plug>(incsearch-nohl-#)
- map g* <Plug>(incsearch-nohl-g*)
- map g# <Plug>(incsearch-nohl-g#)
- " Don't use Ex mode, use Q for formatting
- map Q gq
- " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
- " so that you can undo CTRL-U after inserting a line break.
- inoremap <C-U> <C-G>u<C-U>
- " Switch syntax highlighting on, when the terminal has colors
- " Also switch on highlighting the last used search pattern.
- if &t_Co > 2 || has("gui_running")
- syntax on
- " set hlsearch
- endif
- " Only do this part when compiled with support for autocommands.
- if has("autocmd")
- " Enable file type detection.
- " Use the default filetype settings, so that mail gets 'tw' set to 72,
- " 'cindent' is on in C files, etc.
- " Also load indent files, to automatically do language-dependent indenting.
- filetype plugin indent on
- " Put these in an autocmd group, so that we can delete them easily.
- augroup vimrcEx
- au!
- " For all text files set 'textwidth' to 78 characters.
- autocmd FileType text setlocal textwidth=78
- " When editing a file, always jump to the last known cursor position.
- " Don't do it when the position is invalid or when inside an event handler
- " (happens when dropping a file on gvim).
- " Also don't do it when the mark is in the first line, that is the default
- " position when opening a file.
- autocmd BufReadPost *
- \ if line("'\"") > 1 && line("'\"") <= line("$") |
- \ exe "normal! g`\"" |
- \ endif
- augroup END
- else
- set autoindent " always set autoindenting on
- endif " has("autocmd")
- " Convenient command to see the difference between the current buffer and the
- " file it was loaded from, thus the changes you made.
- " Only define it when not defined already.
- if !exists(":DiffOrig")
- command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
- \ | wincmd p | diffthis
- endif
- " solarized dark color scheme
- "set background=light
- set background=dark
- colorscheme solarized
- set t_Co=256
- " highlight after 80 characters
- let &colorcolumn=join(range(81,999),",")
- " this clears the terrible Solarized support for the SignColumn of gitgutter
- highlight clear SignColumn
- " put swap files and backups in a better place
- set backup
- set backupdir=/Users/omar/tmp
- set dir=/Users/omar/tmp
- " code folding
- " autocmd Syntax html,ruby,javascript setlocal foldmethod=syntax
- " automatically unfold things when it starts
- " autocmd Syntax html,ruby,javascript normal zR
- "let javaScript_fold=1
- "let html_fold=1
- "let ruby_fold=1
- " jsx highlighting in .js files
- let g:jsx_ext_required = 0
- " this should improve performance of syntax highlighting
- set nocursorcolumn
- set nocursorline
- " syntax sync minlines=256
- autocmd BufEnter * :syntax sync fromstart
- " this sets .jst.ejs to same as .erb
- au BufNewFile,BufRead *.ejs set filetype=html
- " es6
- au BufNewFile,BufRead *.es6 set filetype=javascript
- au BufNewFile,BufRead *.ts set filetype=javascript
- " rails things
- au BufNewFile,BufRead *.cap set filetype=ruby
- au BufNewFile,BufRead *.rabl set filetype=ruby
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement