Skip to content

Instantly share code, notes, and snippets.

@stagfoo
Last active December 10, 2017 21:40
Show Gist options
  • Save stagfoo/01d0b97498fd6b3744d2a49aafd3894e to your computer and use it in GitHub Desktop.
Save stagfoo/01d0b97498fd6b3744d2a49aafd3894e to your computer and use it in GitHub Desktop.
vim-config
"No compatibility to traditional vi
set nocompatible
"vim-plug
call plug#begin('~/.config/nvim/plugged')
"Plugin list ------------------------------------------------------------------
Plug 'achimnol/python-syntax'
Plug 'plasticboy/vim-markdown'
Plug 'othree/html5.vim'
Plug 'cakebaker/scss-syntax.vim'
Plug 'cespare/vim-toml'
Plug 'stephpy/vim-yaml'
Plug 'pbrisbin/vim-syntax-shakespeare'
Plug 'elmcast/elm-vim'
Plug 'rust-lang/rust.vim'
Plug 'vim-airline/vim-airline'
Plug 'w0rp/ale' "eslinter
Plug 'Shougo/vimfiler.vim' "file manager
Plug 'simnalamburt/vim-mundo'
Plug 'tpope/vim-fugitive'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'sgur/vim-editorconfig'
"End plugin list --------------------------------------------------------------
call plug#end()
" language en_US
"Syntax highlighting.
syntax on
"Softtab -- use spaces instead tabs.
set expandtab
set tabstop=4 shiftwidth=4 sts=4
set autoindent nosmartindent
"set tab characters apart
set listchars=tab:↹\
"I dislike CRLF.
if !exists("vimpager")
set fileformat=unix
endif
set backspace=2
"Detect modeline hints.
set modeline
"Disable bell
set visualbell t_vb=
"Prefer UTF-8.
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp949,korea,iso-2022-kr
"More tabs
set tabpagemax=40
filetype plugin on
"Some additional syntax highlighters.
au! BufRead,BufNewFile *.wsgi setfiletype python
au! BufRead,BufNewFile *.sass setfiletype sass
au! BufRead,BufNewFile *.scss setfiletype scss
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.less setfiletype less
"These languages have their own tab/indent settings.
au FileType cpp setl ts=2 sw=2 sts=2
au FileType ruby setl ts=2 sw=2 sts=2
au FileType yaml setl ts=2 sw=2 sts=2
au FileType html setl ts=2 sw=2 sts=2
au FileType jinja setl ts=2 sw=2 sts=2
au FileType lua setl ts=2 sw=2 sts=2
au FileType haml setl ts=2 sw=2 sts=2
au FileType sass setl ts=2 sw=2 sts=2
au FileType scss setl ts=2 sw=2 sts=2
au FileType make setl ts=4 sw=4 sts=4 noet
au FileType gitcommit setl spell
"ALE-related configurations.
let g:ale_linters = {
\ 'haskell': ['stack-build', 'hlint'],
\ 'rust': ['cargo'],
\}
"Python-related configurations.
"See also: https://github.com/achimnol/python-syntax#options-used-by-the-script
let python_highlight_builtins = 1
let python_highlight_type_annotations = 1
let python_highlight_exceptions = 1
let python_highlight_string_formatting = 1
let python_highlight_string_format = 1
let python_highlight_string_templates = 0
let python_highlight_indent_errors = 1
let python_highlight_space_errors = 0
let python_highlight_doctests = 1
"Markdown-related configurations.
augroup mkd
autocmd BufRead *.markdown set formatoptions=tcroqn2 comments=n:> spell
autocmd BufRead *.mkdn set formatoptions=tcroqn2 comments=n:> spell
autocmd BufRead *.mkd set formatoptions=tcroqn2 comments=n:> spell
augroup END
"Haskell-related config
let g:haskell_quasi = 0
let g:haskell_interpolation = 0
let g:haskell_regex = 0
let g:haskell_jmacro = 0
let g:haskell_shqq = 0
let g:haskell_sql = 0
let g:haskell_json = 0
let g:haskell_xml = 0
let g:haskell_hsp = 0
"Elm format
let g:elm_format_autosave = 1
"English spelling checker.
setlocal spelllang=en_us
"Keep 80 columns.
set colorcolumn=100
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/
autocmd WinEnter * match OverLength /\%81v.\+/
"I dislike folding.
set nofoldenable
"I dislike visual bell as well.
set novisualbell
"gVim-specific configurations (including MacVim).
if has("gui_running")
set bg=dark
set guioptions=egmrLt
set linespace=1
endif
"MacVim-specific configurations.
if has("gui_macvim") || has("gui_vimr")
set imd
set guifont=Source_Code_Pro_Light:h16.00
endif
"GVim under GNOME
if has("gui_gnome")
set guifont="Fire Code 11"
endif
"GVim under Windows
if has("gui_win32")
set guifont=Consolas:h11:cANSI
endif
"vim-airline
let g:airline_powerline_fonts = 1
"Mundo -- Undo tree visualization
set undofile
set undodir=~/.config/nvim/undo
nnoremap <F5> :MundoToggle
"Use Vimfiler as default explorer like netrw
let g:vimfiler_as_default_explorer = 1
"deoplete
" let g:deoplete#enable_at_startup = 1
"vim-easy-align
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
"VimShell
let g:vimshell_prompt_expr = '$USER . " " . fnamemodify(getcwd(), ":~") . " $ "'
let g:vimshell_prompt_pattern = '^[a-z_-][a-z0-9_-]\{,31\} [~/][^$ ]* $ '
"True colors
if $TERM_PROGRAM == "iTerm.app"
set termguicolors
" set background=dark
else
" set background=dark
endif
"Alias :W to :w
cnoreabbrev W w
"No compatibility to traditional vi
set nocompatible
"vim-plug
call plug#begin('~/.config/nvim/plugged')
"Plugin list ------------------------------------------------------------------
Plug 'achimnol/python-syntax'
Plug 'plasticboy/vim-markdown'
Plug 'othree/html5.vim'
Plug 'cakebaker/scss-syntax.vim'
Plug 'cespare/vim-toml'
Plug 'stephpy/vim-yaml'
Plug 'pbrisbin/vim-syntax-shakespeare'
Plug 'elmcast/elm-vim'
Plug 'rust-lang/rust.vim'
Plug 'Chiel92/vim-autoformat'
Plug 'leafgarland/typescript-vim'
Plug 'vim-airline/vim-airline'
Plug 'w0rp/ale' "eslinter
Plug 'Shougo/vimfiler.vim' "file manager
Plug 'simnalamburt/vim-mundo'
Plug 'tpope/vim-fugitive'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'sgur/vim-editorconfig'
"End plugin list --------------------------------------------------------------
call plug#end()
" language en_US
"Syntax highlighting.
syntax on
"Softtab -- use spaces instead tabs.
set expandtab
set tabstop=2 shiftwidth=2 sts=2
set autoindent nosmartindent
"set tab characters apart
set listchars=tab:↹\
set backspace=2
"Detect modeline hints.
set modeline
" Line Numbers
set number
set numberwidth=1
set relativenumber
highlight LineNr term=bold cterm=NONE ctermfg=green ctermbg=NONE gui=NONE guifg=green guibg=NONE
"Disable bell
set visualbell t_vb=
"Prefer UTF-8.
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp949,korea,iso-2022-kr
"More tabs
set tabpagemax=40
filetype plugin on
"Some additional syntax highlighters.
au! BufRead,BufNewFile *.wsgi setfiletype python
au! BufRead,BufNewFile *.art setfiletype html
au! BufRead,BufNewFile *.sass setfiletype sass
au! BufRead,BufNewFile *.scss setfiletype scss
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.less setfiletype less
"These languages have their own tab/indent settings.
au FileType cpp setl ts=2 sw=2 sts=2
au FileType ruby setl ts=2 sw=2 sts=2
au FileType yaml setl ts=2 sw=2 sts=2
au FileType html setl ts=2 sw=2 sts=2
au FileType jinja setl ts=2 sw=2 sts=2
au FileType lua setl ts=2 sw=2 sts=2
au FileType haml setl ts=2 sw=2 sts=2
au FileType sass setl ts=2 sw=2 sts=2
au FileType scss setl ts=2 sw=2 sts=2
au FileType make setl ts=4 sw=4 sts=4 noet
au FileType gitcommit setl spell
"ALE-related configurations.
let g:ale_linters = {
\ 'haskell': ['stack-build', 'hlint'],
\ 'rust': ['cargo'],
\ 'javascript': ['xo']
\}
let g:ale_fixers = {
\ 'javascript': ['xo', 'eslint', 'flow'],
\}
let g:ale_completion_enabled = 1
hi link ALEErrorSign Error
hi link ALEWarningSign Warning
let g:ale_sign_error = '◆'
let g:ale_sign_warning = '◈'
hi link ALEWarning Warning
hi link ALEError Error
" Set this setting in vimrc if you want to fix files automatically on save.
" " This is off by default.
" let g:ale_fix_on_save = 1
"Python-related configurations.
"See also: https://github.com/achimnol/python-syntax#options-used-by-the-script
let python_highlight_builtins = 1
let python_highlight_type_annotations = 1
let python_highlight_exceptions = 1
let python_highlight_string_formatting = 1
let python_highlight_string_format = 1
let python_highlight_string_templates = 0
let python_highlight_indent_errors = 1
let python_highlight_space_errors = 0
let python_highlight_doctests = 1
"Markdown-related configurations.
augroup mkd
autocmd BufRead *.markdown set formatoptions=tcroqn2 comments=n:> spell
autocmd BufRead *.mkdn set formatoptions=tcroqn2 comments=n:> spell
autocmd BufRead *.mkd set formatoptions=tcroqn2 comments=n:> spell
augroup END
"Haskell-related config
let g:haskell_quasi = 0
let g:haskell_interpolation = 0
let g:haskell_regex = 0
let g:haskell_jmacro = 0
let g:haskell_shqq = 0
let g:haskell_sql = 0
let g:haskell_json = 0
let g:haskell_xml = 0
let g:haskell_hsp = 0
"English spelling checker.
setlocal spelllang=en_us
"I dislike folding.
set nofoldenable
"I dislike visual bell as well.
set novisualbell
"gVim-specific configurations (including MacVim).
if has("gui_running")
set bg=dark
set guioptions=egmrLt
set linespace=1
endif
"highlight Comment cterm=underline ctermbg=Blue ctermfg=White
"highlight Comment ctermbg=Blue ctermfg=White
highlight Comment ctermfg=DarkMagenta
"highlight Constant ctermbg=Blue
"highlight Normal ctermbg=Black
"highlight NonText ctermbg=Black
"highlight Special ctermbg=DarkMagenta
highlight Cursor ctermbg=184
set t_Co=256
"GVim under GNOME
if has("gui_gnome")
set guifont="Fire Code 11"
endif
"vim-airline
let g:airline_powerline_fonts = 1
"Mundo -- Undo tree visualization
set undofile
set undodir=~/.config/nvim/undo
nnoremap <F5> :MundoToggle
"deoplete
" let g:deoplete#enable_at_startup = 1
"vim-easy-align
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
"VimShell
let g:vimshell_prompt_expr = '$USER . " " . fnamemodify(getcwd(), ":~") . " $ "'
let g:vimshell_prompt_pattern = '^[a-z_-][a-z0-9_-]\{,31\} [~/][^$ ]* $ '
"Alias :W to :w
cnoreabbrev W w
@stagfoo
Copy link
Author

stagfoo commented Dec 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment