Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Section: General Config {{{1
- "
- " ----------------------------
- let mapleader = " "
- " Deactivating arrow keys.
- " Appearance
- set autoindent " Automatically set indent of new line.
- set smartindent " Automatically inserts one extra level of indentation in some cases.
- set ttyfast " Faster redrawing.
- set scrolloff=8 " Keep the cursor 8 lines from the top and the bottom.
- set wildmenu " Enhanced command line completion.
- set showmatch " Show matching braces.
- set mat=2 " How many tenths of a second to blink.
- set t_CO=256
- set guitablabel=\[%N\]\ %t\ %M
- " Searching
- set ignorecase " case insensitive searching
- set smartcase " case-sensitive if expresson contains a capital letter
- set hlsearch " highlight search results
- set incsearch " set incremental search, like modern browsers
- set nolazyredraw " don't redraw while executing macros
- set shell=zsh " Set bash as the prompt for Vim
- set backspace=2 " Backspace deletes like most programs in insert mode
- set nobackup
- set nowritebackup
- set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
- set history=50
- set ruler " show the cursor position all the time
- set showcmd " display incomplete commands
- set laststatus=2 " Always display the status line
- set autowrite " Automatically :write before running commands
- set noshowmode
- set timeoutlen=1000
- set ttimeoutlen=0
- set tabstop=2
- set shiftwidth=2
- set shiftround
- set expandtab
- set scrolloff=3
- set list listchars=tab:»·,trail:· " Display extra whitespace characters
- set hidden
- set inccommand=nosplit
- set autochdir
- " Line numbers
- set number
- set numberwidth=5
- " Set spellfile to location that is guaranteed to exist, can be symlinked to
- " Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
- set spellfile=$HOME/.vim-spell-en.utf-8.add
- " Highlight search matches
- set hlsearch
- " Make it obvious where 120 characters is {{{2
- " Lifted from StackOverflow user Jeremy W. Sherman
- " http://stackoverflow.com/a/3765575/2250435
- if exists('+colorcolumn')
- set textwidth=120
- set colorcolumn=+1
- else
- au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>120v.\+', -1)
- endif " }}}2
- " Open new split panes to right and bottom, which feels more natural {{{2
- set splitbelow
- set splitright
- " }}}2
- " Configure grep to use The Silver Searcher {{{2
- if executable('ag')
- " Use ag over grep
- set grepprg=ag\ --nogroup\ --nocolor
- command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
- endif
- " }}}2
- " }}}1
- " Section: Autocommands {{{1
- " --------------------------
- if has("autocmd")
- filetype plugin indent on
- autocmd BufReadPost * " {{{2
- " When editing a file, always jump to the last known cursor position.
- " Don't do it for commit messages, when the position is invalid, or when
- " inside an event handler (happens when dropping a file on gvim).
- \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
- \ exe "normal g`\"" |
- \ endif "}}}2
- " Automatically clean trailing whitespace
- autocmd BufWritePre * :%s/\s\+$//e
- autocmd BufRead,BufNewFile COMMIT_EDITMSG call pencil#init({'wrap': 'soft'})
- \ | set textwidth=0
- autocmd BufRead,BufNewFile *.md set filetype=markdown
- autocmd BufRead,BufNewFile .eslintrc,.jscsrc,.jshintrc,.babelrc set ft=json
- au BufRead,BufNewFile *.scss set filetype=scss.css
- autocmd BufRead,BufNewFile gitconfig set ft=.gitconfig
- endif
- " }}}1
- " Section: External Functions {{{
- " Open current file in Marked {{{
- function! MarkedPreview()
- :w
- exec ':silent !open -a "Marked 2.app" ' . shellescape('%:p')
- redraw!
- endfunction
- nnoremap <leader>md :call MarkedPreview()<CR>
- nnoremap <leader>r :NERDTreeFind<cr>
- " }}}
- " Open current repo in Tower {{{
- function! OpenInGitTower()
- call system('gittower `git rev-parse --show-toplevel`')
- endfunction
- nnoremap <leader>gt :call OpenInGitTower()<CR>
- " }}}
- " }}}
- " Section: Load vim-plug plugins {{{
- " Specify plugins {{{2
- call plug#begin()
- " UI {{{3
- Plug 'trevordmiller/nova-vim'
- Plug 'vim-airline/vim-airline' " Handy info
- Plug 'retorillo/airline-tablemode.vim'
- Plug 'ryanoasis/vim-webdevicons'
- Plug 'ryanoasis/vim-devicons'
- Plug 'junegunn/goyo.vim'
- Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' }
- Plug 'dikiaap/minimalist'
- " Project Navigation {{{3
- Plug 'mhinz/vim-grepper'
- Plug 'vim-scripts/ctags.vim' " ctags related stuff
- Plug 'majutsushi/tagbar'
- Plug 'rbgrouleff/bclose.vim' " Required by ranger.vim
- Plug 'francoiscabrol/ranger.vim'
- " File Navigation {{{3
- Plug 'vim-scripts/matchit.zip' " More powerful % matching
- Plug 'Lokaltog/vim-easymotion' " Move like the wind!
- Plug 'jeffkreeftmeijer/vim-numbertoggle' " Smarter line numbers
- Plug 'kshenoy/vim-signature' " Show marks in the gutter
- Plug 'haya14busa/incsearch.vim' " Better search highlighting
- Plug 'scrooloose/nerdtree'
- "
- " Editing {{{3
- Plug 'tpope/vim-surround' " Change word surroundings
- Plug 'tpope/vim-commentary' " Comments stuff
- Plug 'tpope/vim-repeat'
- Plug 'tpope/vim-endwise'
- Plug 'tpope/vim-unimpaired'
- Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeEnable' }
- Plug 'kana/vim-textobj-user'
- Plug 'jasonlong/vim-textobj-css'
- Plug 'editorconfig/editorconfig-vim'
- Plug 'ctrlpvim/ctrlp.vim'
- " Git
- Plug 'tpope/vim-fugitive' " Git stuff in Vim
- Plug 'airblade/vim-gitgutter'
- Plug 'junegunn/gv.vim', { 'on': 'GV' }
- Plug 'jez/vim-github-hub' " Filetype for hub pull requests
- " Task Running
- Plug 'tpope/vim-dispatch' " Run tasks asychronously in Tmux
- Plug 'w0rp/ale' " Linter
- Plug 'christoomey/vim-tmux-navigator'
- " Autocomplete {{{3
- Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
- Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
- Plug 'autozimu/LanguageClient-neovim', {
- \ 'branch': 'next',
- \ 'do': 'bash install.sh',
- \ }
- Plug 'ervandew/supertab'
- Plug 'jiangmiao/auto-pairs'
- Plug 'valloric/youcompleteme'
- " Language Support {{{3
- " JavaScript {{{4
- Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
- Plug 'carlitux/deoplete-ternjs', { 'for': ['javascript', 'javascript.jsx'] }
- Plug 'honza/vim-snippets'
- Plug 'othree/jspc.vim', { 'for': ['javascript', 'javascript.jsx'] }
- Plug 'ternjs/tern_for_vim', { 'for': ['javascript', 'javascript.jsx'] }
- Plug 'SirVer/ultisnips'
- Plug 'steelsojka/deoplete-flow'
- Plug 'mxw/vim-jsx'
- Plug 'pangloss/vim-javascript'
- Plug 'othree/javascript-libraries-syntax.vim'
- " HTML {{{4
- Plug 'othree/html5.vim'
- Plug 'mattn/emmet-vim', { 'for': ['javascript.jsx', 'javascript', 'html', 'css'] }
- " CSS {{{4
- Plug 'hail2u/vim-css3-syntax', { 'for': 'css' }
- " Sass {{{4
- Plug 'cakebaker/scss-syntax.vim'
- " Markdown {{{4
- Plug 'reedes/vim-pencil' " Markdown, Writing
- Plug 'godlygeek/tabular', { 'for': 'markdown' } " Needed for vim-markdown
- Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
- call plug#end()
- " Load plugin configurations {{{2
- " For some reason, a few plugins seem to have config options that cannot be
- " placed in the `plugins` directory. Those settings can be found here instead.
- let g:javascript_plugin_jsdoc = 1
- let g:javascript_plugin_ngdoc = 1
- let g:javascript_plugin_flow = 1
- let g:jsx_ext_required = 0
- let g:airline#extensions#tabline#fnamemod = ':t'
- let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
- let g:deoplete#sources = {}
- let g:deoplete#sources['javascript.jsx'] = ['file', 'ultisnips', 'ternjs']
- let g:tern#command = ['tern']
- let g:tern#arguments = ['--persistent']
- let g:deoplete#enable_at_startup = 1
- let g:deoplete#auto_complete_delay = 0
- let g:echodoc_enable_at_startup=1
- let g:tern#command = ['tern']
- let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
- let g:UltiSnipsExpandTrigger="<C-j>"
- "inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
- "
- let g:UltiSnipsExpandTrigger="<tab>"
- let g:UltiSnipsJumpForwardTrigger="<c-b>"
- let g:UltiSnipsJumpBackwardTrigger="<c-z>"
- " vim-airline {{{3
- let g:airline_powerline_fonts = 1 " Enable the patched Powerline fonts
- " emmet-vim {{{3
- " lets emmet use jsx shortcuts
- let g:user_emmet_expandabbr_key='<tab>'
- imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
- let g:user_emmet_settings = {
- \ 'javascript.jsx' : {
- \ 'extends': 'jsx',
- \ 'quote_char': "'",
- \ },
- \}
- let g:jsx_ext_required = 0
- " }}}3
- " make YCM compatible with UltiSnips (using supertab)
- let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
- let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
- let g:SuperTabDefaultCompletionType = '<C-n>'
- " better key bindings for UltiSnipsExpandTrigger
- let g:UltiSnipsExpandTrigger = "<tab>"
- let g:UltiSnipsJumpForwardTrigger = "<tab>"
- let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
- let g:ale_sign_error = '●' " Less aggressive than the default '>>'
- " Section: Remaps {{{1
- " Normal Mode Remaps {{{2
- nnoremap zr zR
- nnoremap zm zM
- noremap <up> <nop>
- noremap <down> <nop>
- noremap <left> <nop>
- noremap <right> <nop>
- " NERDTree
- map <F1> :NERDTreeToggle<cr>
- map <F2> :NERDTreeClose<cr>
- nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
- " Smarter pasting
- nnoremap <Leader>p :set invpaste paste?<CR>
- nnoremap <Leader>k ddkP
- nnoremap <Leader>j ddp
- " -- Smart indent when entering insert mode with i on empty lines --------------
- function! IndentWithI()
- if len(getline('.')) == 0
- return "\"_ddO"
- else
- return "i"
- endif
- endfunction
- nnoremap <expr> i IndentWithI()
- " Remap the increment and decrement features of Vim
- nnoremap <A-a> <C-a>
- nnoremap å <C-a>
- nnoremap <A-x> <C-x>
- nnoremap ≈ <C-x>
- " Tab Shortcuts
- nnoremap tk :tabfirst<CR>
- nnoremap tn :tabnext<CR>
- nnoremap tp :tabprev<CR>
- nnoremap tj :tablast<CR>
- nnoremap tnew :tabnew<CR>
- nnoremap tc :CtrlSpaceTabLabel<CR>
- nnoremap td :tabclose<CR>
- nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
- " }}}2
- " Insert Mode Remaps {{{2
- set completeopt=longest,menuone
- " }}}2
- " }}}1
- " Section: Theme {{{
- syntax enable
- let $NVIM_TUI_ENABLE_TRUE_COLOR=1
- set t_ut= " fix 256 colors in tmux http://sunaku.github.io/vim-256color-bce.html
- if has("termguicolors") " set true colors
- set termguicolors
- endif
- set background=dark
- colorscheme minimalist
- " }}}
- " Section: Local-Machine Config {{{
- if filereadable($DOTFILES . "/nvim/init.local.vim")
- source $DOTFILES/nvim/init.local.vim
- endif
- " }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement