Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filetype off
- " Plug settings.
- call plug#begin('~/.vim/plugged')
- " Themes
- Plug 'rakr/vim-one'
- " Vim defaults
- Plug 'tpope/vim-sensible'
- " Directory tree
- Plug 'scrooloose/nerdtree'
- " Comment stuff out
- Plug 'tpope/vim-commentary'
- " Language pack
- Plug 'sheerun/vim-polyglot'
- " Linter
- Plug 'w0rp/ale'
- " Fuzzy file/buffer finder
- Plug '/usr/local/opt/fzf'
- Plug 'junegunn/fzf.vim'
- " JS formater
- Plug 'prettier/vim-prettier'
- call plug#end()
- " Setup syntax highlights
- set termguicolors
- set background=dark
- colorscheme one
- " Everybody do that
- set nocompatible
- " Disable swap files
- set noswapfile
- " No backup file while editing
- set nowritebackup
- " Auto save the file when closing
- set autowrite
- " Hide buffer when unsaved
- set hidden
- " Show lines number
- set number
- " Show existing tabs with 2 spaces
- set tabstop=2
- " When indenting with '>', use 2 spaces width
- set shiftwidth=2
- " On pressing tabs, insert 2 spaces
- set expandtab
- " Mode in status bar
- set noshowmode
- " Browse files in same dir as open file
- set browsedir=buffer
- " Better split characters
- set fillchars=vert:\ ,stl:\ ,stlnc:\
- set backupcopy=yes
- " Highlight search matches
- set hlsearch
- " Format completeopt list
- set completeopt=longest,menuone,preview
- set previewheight=5
- " Leader key
- let mapleader = ","
- inoremap jk <Esc>
- " Ale configuration
- let g:ale_set_loclist = 1
- let g:ale_set_quickfix = 0
- let g:ale_fixers = { 'javascript': ['eslint'] }
- let g:ale_lint_on_text_changed = 'never'
- let g:ale_lint_on_enter = 0
- let g:ale_javascript_prettier_use_global = 1
- nmap <silent> <C-k> <Plug>(ale_previous_wrap)
- nmap <silent> <C-j> <Plug>(ale_next_wrap)
- " FZF configuration (with Ag)
- set rtp+=/usr/local/opt/fzf
- let $FZF_DEFAULT_COMMAND= 'ag --hidden --ignore .git -g ""'
- let g:fzf_history_dir = '~/.local/share/fzf-history'
- let g:fzf_colors =
- \ { 'fg': ['fg', 'Normal'],
- \ 'bg': ['bg', 'Normal'],
- \ 'hl': ['fg', 'Comment'],
- \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
- \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
- \ 'hl+': ['fg', 'Statement'],
- \ 'info': ['fg', 'PreProc'],
- \ 'prompt': ['fg', 'Conditional'],
- \ 'pointer': ['fg', 'Exception'],
- \ 'marker': ['fg', 'Keyword'],
- \ 'spinner': ['fg', 'Label'],
- \ 'header': ['fg', 'Comment'] }
- " No ext for jsx files
- let g:jsx_ext_required = 0
- command! -bang -nargs=* Rg
- \ call fzf#vim#grep(
- \ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
- \ fzf#vim#with_preview('right:40%'),
- \ <bang>0)
- " Prettier configuration
- let g:prettier#config#semi = 'false'
- let g:prettier#config#trailing_comma = 'es5'
- let g:prettier#config#bracket_spacing = 'true'
- let g:prettier#config#singleQuote = 'true'
- nmap <Leader>b :Buffers<CR>
- nmap <Leader>f :Files<CR>
- nmap <Leader>r :Tags<CR>
- nmap <Leader>s :Rg<CR>
- " Remove all trailing spaces
- autocmd BufWritePre * %s/\s\+$//e
- " Undodir
- set undodir=~/.config/vim/tmp/undo//
- " Backupdir
- set backupdir=~/.config/vim/tmp/backup//
- " Swapfile
- set directory=~/.config/vim/tmp/swap//
- " Make those folders automatically if they don't already exist.
- if !isdirectory(expand(&undodir))
- call mkdir(expand(&undodir), "p")
- endif
- if !isdirectory(expand(&backupdir))
- call mkdir(expand(&backupdir), "p")
- endif
- if !isdirectory(expand(&directory))
- call mkdir(expand(&directory), "p")
- endif
- " Enable backups for Gundo
- set backup
- " Save the file
- set undofile
- map <C-n> :NERDTreeToggle<CR>
Add Comment
Please, Sign In to add comment