Created
August 17, 2018 12:01
-
-
Save j-griffith/e70e6992ceea96f8fc393779caffd1b6 to your computer and use it in GitHub Desktop.
general init.vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.local/share/nvim/plugged') | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
Plug 'tpope/vim-rhubarb' | |
Plug 'bling/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'christooomey/vim-tmux-navigator' | |
Plug 'Shougo/vimshell.vim' | |
Plug 'Shougo/vimproc.vim', {'do' : 'make'} | |
Plug 'airblade/vim-gitgutter' | |
Plug 'AndrewRadev/splitjoin.vim' | |
Plug 'ConradIrwin/vim-bracketed-paste' | |
Plug 'Raimondi/delimitMate' | |
Plug 'SirVer/ultisnips' | |
Plug 'cespare/vim-toml' | |
Plug 'corylanou/vim-present', {'for' : 'present'} | |
Plug 'ekalinin/Dockerfile.vim', {'for' : 'Dockerfile'} | |
Plug 'elzr/vim-json', {'for' : 'json'} | |
Plug 'fatih/vim-go' | |
Plug 'fatih/vim-hclfmt' | |
Plug 'fatih/vim-nginx' , {'for' : 'nginx'} | |
Plug 'godlygeek/tabular' | |
Plug 'hashivim/vim-hashicorp-tools' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'mileszs/ack.vim' | |
Plug 'plasticboy/vim-markdown' | |
Plug 'scrooloose/nerdtree' | |
Plug 't9md/vim-choosewin' | |
Plug 'tmux-plugins/vim-tmux', {'for': 'tmux'} | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-eunuch' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-scriptease' | |
Plug 'neomake/neomake' | |
Plug 'zchee/deoplete-go', { 'do': 'make' } | |
Plug 'tomasiser/vim-code-dark' | |
Plug 'lifepillar/vim-solarized8' | |
Plug 'fmoralesc/molokayo' | |
"Plug 'fatih/molokai' | |
Plug 'tomasr/molokai' | |
Plug 'joshdick/onedark.vim' | |
Plug 'vim-scripts/indentpython.vim' | |
Plug 'nvie/vim-flake8' | |
Plug 'hunek/vim-python-pep8-indent' | |
Plug 'KeitaNakamura/neodark.vim' | |
Plug 'larsbs/vimterial_dark' | |
Plug 'bitfield/vim-gitgo' | |
Plug 'kadekillary/subtle_solo' | |
Plug 'kristijanhusak/vim-hybrid-material' | |
Plug 'skielbasa/vim-material-monokai' | |
Plug 'rakr/vim-one' | |
Plug 'kaicataldo/material.vim' | |
Plug 'hzchirs/vim-material' | |
Plug 'Heorhiy/VisualStudioDark.vim' | |
Plug 'w0ng/vim-hybrid' | |
call plug#end() | |
"===================================================== | |
"===================== SETTINGS ====================== | |
set nocompatible | |
filetype off | |
filetype plugin indent on | |
set ttyfast | |
"if !has('nvim') | |
" set ttymouse=xterm2 | |
" set ttyscroll=3 | |
"endif | |
set laststatus=2 | |
set encoding=utf-8 " Set default encoding to UTF-8 | |
set autoread " Automatically reread changed files without asking me anything | |
set autoindent | |
set backspace=indent,eol,start " Makes backspace key more powerful. | |
set incsearch " Shows the match while typing | |
set hlsearch " Highlight found searches | |
set mouse=c "Enable mouse mode | |
set noerrorbells " No beeps | |
set nonumber " Show line numbers | |
set showcmd " Show me what I'm typing | |
set noswapfile " Don't use swapfile | |
set nobackup " Don't create annoying backup files | |
set splitright " Split vertical windows right to the current windows | |
set splitbelow " Split horizontal windows below to the current windows | |
set autowrite " Automatically save before :next, :make etc. | |
set hidden | |
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats | |
set showmatch " Show matching brackets by flickering | |
set noshowmode " We show the mode with airline or lightline | |
set ignorecase " Search case insensitive... | |
set smartcase " ... but not it begins with upper case | |
set completeopt=menu,menuone | |
set nocursorcolumn " speed up syntax highlighting | |
set nocursorline | |
set updatetime=300 | |
set pumheight=10 " Completion window max size | |
set conceallevel=2 " Concealed text is completely hidden | |
set lazyredraw | |
set clipboard=unnamedplus | |
" trim all whitespaces away | |
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR> | |
" ~/.viminfo needs to be writable and readable | |
set viminfo='200 | |
"if has('persistent_undo') | |
" set undofile | |
" set undodir=~/.cache/vim | |
"endif | |
" color | |
syntax enable | |
"set t_Co=256 | |
set background=dark | |
syntax on | |
"let g:molokai_original = 1 | |
"let g:rehash256 = 1 | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
set termguicolors | |
"colorscheme solarized8 | |
colorscheme hybrid | |
let g:material_terminal_italic=1 | |
" Airline {{{ | |
set laststatus=2 | |
let g:airline_powerline_fonts = 1 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
"let g:airline_theme = 'molokai' | |
let g:airline_theme = 'material' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" unicode symbols | |
let g:airline_left_sep = '»' | |
let g:airline_left_sep = '▶' | |
let g:airline_right_sep = '«' | |
let g:airline_right_sep = '◀' | |
let g:airline_symbols.linenr = '␊' | |
let g:airline_symbols.linenr = '' | |
let g:airline_symbols.linenr = '¶' | |
let g:airline_symbols.branch = '⎇' | |
let g:airline_symbols.paste = 'ρ' | |
let g:airline_symbols.paste = 'Þ' | |
let g:airline_symbols.paste = '∥' | |
let g:airline_symbols.whitespace = 'Ξ' | |
" airline symbols | |
let g:airline_left_sep = '' | |
let g:airline_left_alt_sep = '' | |
let g:airline_right_sep = '' | |
let g:airline_right_alt_sep = '' | |
let g:airline_symbols.branch = '' | |
let g:airline_symbols.readonly = '' | |
let g:airline_symbols.linenr = '' | |
" }}} | |
augroup filetypedetect | |
command! -nargs=* -complete=help Help vertical belowright help <args> | |
autocmd FileType help wincmd L | |
autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux | |
autocmd BufNewFile,BufRead .nginx.conf*,nginx.conf* setf nginx | |
autocmd BufNewFile,BufRead *.hcl setf conf | |
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 | |
autocmd BufNewFile,BufRead *.ino setlocal noet ts=4 sw=4 sts=4 | |
autocmd BufNewFile,BufRead *.txt setlocal noet ts=4 sw=4 | |
autocmd BufNewFile,BufRead *.md setlocal noet ts=4 sw=4 | |
autocmd BufNewFile,BufRead *.html setlocal noet ts=4 sw=4 | |
autocmd BufNewFile,BufRead *.vim setlocal expandtab shiftwidth=2 tabstop=2 | |
autocmd BufNewFile,BufRead *.hcl setlocal expandtab shiftwidth=2 tabstop=2 | |
autocmd BufNewFile,BufRead *.sh setlocal expandtab shiftwidth=2 tabstop=2 | |
autocmd BufNewFile,BufRead *.proto setlocal expandtab shiftwidth=2 tabstop=2 | |
autocmd FileType json setlocal expandtab shiftwidth=2 tabstop=2 | |
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 | |
augroup END | |
"===================================================== | |
"===================== STATUSLINE ==================== | |
let s:modes = { | |
\ 'n': 'NORMAL', | |
\ 'i': 'INSERT', | |
\ 'R': 'REPLACE', | |
\ 'v': 'VISUAL', | |
\ 'V': 'V-LINE', | |
\ "\<C-v>": 'V-BLOCK', | |
\ 'c': 'COMMAND', | |
\ 's': 'SELECT', | |
\ 'S': 'S-LINE', | |
\ "\<C-s>": 'S-BLOCK', | |
\ 't': 'TERMINAL' | |
\} | |
let s:prev_mode = "" | |
function! StatusLineMode() | |
let cur_mode = get(s:modes, mode(), '') | |
" do not update higlight if the mode is the same | |
if cur_mode == s:prev_mode | |
return cur_mode | |
endif | |
if cur_mode == "NORMAL" | |
exe 'hi! StatusLine ctermfg=236' | |
exe 'hi! myModeColor cterm=bold ctermbg=148 ctermfg=22' | |
elseif cur_mode == "INSERT" | |
exe 'hi! myModeColor cterm=bold ctermbg=23 ctermfg=231' | |
elseif cur_mode == "VISUAL" || cur_mode == "V-LINE" || cur_mode == "V_BLOCK" | |
exe 'hi! StatusLine ctermfg=236' | |
exe 'hi! myModeColor cterm=bold ctermbg=208 ctermfg=88' | |
endif | |
let s:prev_mode = cur_mode | |
return cur_mode | |
endfunction | |
function! StatusLineFiletype() | |
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' | |
endfunction | |
function! StatusLinePercent() | |
return (100 * line('.') / line('$')) . '%' | |
endfunction | |
function! StatusLineLeftInfo() | |
let branch = fugitive#head() | |
let filename = '' != expand('%:t') ? expand('%:t') : '[No Name]' | |
if branch !=# '' | |
return printf("%s | %s", branch, filename) | |
endif | |
return filename | |
endfunction | |
exe 'hi! myInfoColor ctermbg=240 ctermfg=252' | |
" start building our statusline | |
set statusline= | |
" mode with custom colors | |
set statusline+=%#myModeColor# | |
set statusline+=%{StatusLineMode()} | |
set statusline+=%* | |
" left information bar (after mode) | |
set statusline+=%#myInfoColor# | |
set statusline+=\ %{StatusLineLeftInfo()} | |
set statusline+=\ %* | |
" go command status (requires vim-go) | |
set statusline+=%#goStatuslineColor# | |
set statusline+=%{go#statusline#Show()} | |
set statusline+=%* | |
" right section seperator | |
set statusline+=%= | |
" filetype, percentage, line number and column number | |
set statusline+=%#myInfoColor# | |
set statusline+=\ %{StatusLineFiletype()}\ %{StatusLinePercent()}\ %l:%v | |
set statusline+=\ %* | |
"===================================================== | |
"===================== MAPPINGS ====================== | |
" This comes first, because we have mappings that depend on leader | |
" With a map leader it's possible to do extra key combinations | |
" i.e: <leader>w saves the current file | |
let mapleader = "," | |
" Some useful quickfix shortcuts for quickfix | |
map <C-n> :cn<CR> | |
map <C-m> :cp<CR> | |
nnoremap <leader>a :cclose<CR> | |
" put quickfix window always to the bottom | |
augroup quickfix | |
autocmd! | |
autocmd FileType qf wincmd J | |
autocmd FileType qf setlocal wrap | |
augroup END | |
" Enter automatically into the files directory | |
autocmd BufEnter * silent! lcd %:p:h | |
" Automatically resize screens to be equally the same | |
" autocmd VimResized * wincmd = | |
" Fast saving | |
nnoremap <leader>w :w!<cr> | |
nnoremap <silent> <leader>q :q!<CR> | |
" Center the screen | |
nnoremap <space> zz | |
" Remove search highlight | |
" nnoremap <leader><space> :nohlsearch<CR> | |
function! s:clear_highlight() | |
let @/ = "" | |
call go#guru#ClearSameIds() | |
endfunction | |
nnoremap <silent> <leader><space> :<C-u>call <SID>clear_highlight()<CR> | |
" Source the current Vim file | |
nnoremap <leader>pr :Runtime<CR> | |
" Close all but the current one | |
nnoremap <leader>o :only<CR> | |
" Better split switching | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-h> <C-W>h | |
map <C-l> <C-W>l | |
" Print full path | |
map <C-f> :echo expand("%:p")<cr> | |
" Terminal settings | |
if has('terminal') | |
" Kill job and close terminal window | |
tnoremap <Leader>q <C-w><C-C><C-w>c<cr> | |
" switch to normal mode with esc | |
tnoremap <Esc> <C-W>N | |
" mappings to move out from terminal to other views | |
tnoremap <C-h> <C-w>h | |
tnoremap <C-j> <C-w>j | |
tnoremap <C-k> <C-w>k | |
tnoremap <C-l> <C-w>l | |
" Open terminal in vertical, horizontal and new tab | |
nnoremap <leader>tv :vsplit<cr>:term ++curwin<CR> | |
nnoremap <leader>ts :split<cr>:term ++curwin<CR> | |
nnoremap <leader>tt :tabnew<cr>:term ++curwin<CR> | |
tnoremap <leader>tv <C-w>:vsplit<cr>:term ++curwin<CR> | |
tnoremap <leader>ts <C-w>:split<cr>:term ++curwin<CR> | |
tnoremap <leader>tt <C-w>:tabnew<cr>:term ++curwin<CR> | |
" always start terminal in insert mode when I switch to it | |
" NOTE(arslan): startinsert doesn't work in Terminal-normal mode. | |
" autocmd WinEnter * if &buftype == 'terminal' | call feedkeys("i") | endif | |
endif | |
" Visual linewise up and down by default (and use gj gk to go quicker) | |
noremap <Up> gk | |
noremap <Down> gj | |
noremap j gj | |
noremap k gk | |
" Exit on j | |
imap jj <Esc> | |
" Source (reload configuration) | |
nnoremap <silent> <F5> :source $MYNVIMRC<CR> | |
nnoremap <F6> :setlocal spell! spell?<CR> | |
" Search mappings: These will make it so that going to the next one in a | |
" search will center on the line it's found in. | |
nnoremap n nzzzv | |
nnoremap N Nzzzv | |
" Same when moving up and down | |
noremap <C-d> <C-d>zz | |
noremap <C-u> <C-u>zz | |
" Remap H and L (top, bottom of screen to left and right end of line) | |
nnoremap H ^ | |
nnoremap L $ | |
vnoremap H ^ | |
vnoremap L g_ | |
" Act like D and C | |
nnoremap Y y$ | |
" Do not show stupid q: window | |
map q: :q | |
" Don't move on * I'd use a function for this but Vim clobbers the last search | |
" when you're in a function so fuck it, practicality beats purity. | |
nnoremap <silent> * :let stay_star_view = winsaveview()<cr>*:call winrestview(stay_star_view)<cr> | |
" Time out on key codes but not mappings. | |
" Basically this makes terminal Vim work sanely. | |
if !has('gui_running') | |
set notimeout | |
set ttimeout | |
set ttimeoutlen=10 | |
augroup FastEscape | |
autocmd! | |
au InsertEnter * set timeoutlen=0 | |
au InsertLeave * set timeoutlen=1000 | |
augroup END | |
endif | |
" Visual Mode */# from Scrooloose {{{ | |
function! s:VSetSearch() | |
let temp = @@ | |
norm! gvy | |
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') | |
let @@ = temp | |
endfunction | |
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> | |
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o> | |
" create a go doc comment based on the word under the cursor | |
function! s:create_go_doc_comment() | |
norm "zyiw | |
execute ":put! z" | |
execute ":norm I// \<Esc>$" | |
endfunction | |
nnoremap <leader>ui :<C-u>call <SID>create_go_doc_comment()<CR> | |
"===================== PLUGINS ====================== | |
" ==================== Fugitive ==================== | |
vnoremap <leader>gb :Gblame<CR> | |
nnoremap <leader>gb :Gblame<CR> | |
" ==================== vim-go ==================== | |
let g:go_fmt_fail_silently = 1 | |
let g:go_fmt_command = "goimports" | |
let g:go_fmt_options = { | |
\ 'goimports': '-local do/', | |
\ } | |
let g:go_debug_windows = { | |
\ 'vars': 'leftabove 35vnew', | |
\ 'stack': 'botright 10new', | |
\ } | |
let g:go_sameid_search_enabled = 1 | |
let g:go_test_prepend_name = 1 | |
let g:go_list_type = "quickfix" | |
let g:go_auto_type_info = 0 | |
let g:go_auto_sameids = 0 | |
let g:go_def_mode = "guru" | |
let g:go_echo_command_info = 1 | |
let g:go_gocode_autobuild = 1 | |
let g:go_gocode_unimported_packages = 1 | |
let g:go_autodetect_gopath = 1 | |
" let g:go_info_mode = "guru" | |
let g:go_metalinter_autosave_enabled = ['vet', 'golint'] | |
let g:go_highlight_space_tab_error = 0 | |
let g:go_highlight_array_whitespace_error = 0 | |
let g:go_highlight_trailing_whitespace_error = 0 | |
let g:go_highlight_extra_types = 0 | |
let g:go_highlight_build_constraints = 1 | |
let g:go_highlight_types = 0 | |
let g:go_highlight_format_strings = 0 | |
let g:go_modifytags_transform = 'camelcase' | |
let g:go_fold_enable = [] | |
nmap <C-g> :GoDecls<cr> | |
imap <C-g> <esc>:<C-u>GoDecls<cr> | |
" run :GoBuild or :GoTestCompile based on the go file | |
function! s:build_go_files() | |
let l:file = expand('%') | |
if l:file =~# '^\f\+_test\.go$' | |
call go#test#Test(0, 1) | |
elseif l:file =~# '^\f\+\.go$' | |
call go#cmd#Build(0) | |
endif | |
endfunction | |
augroup go | |
autocmd! | |
autocmd FileType go nmap <silent> <Leader>v <Plug>(go-def-vertical) | |
autocmd FileType go nmap <silent> <Leader>s <Plug>(go-def-split) | |
autocmd FileType go nmap <silent> <Leader>d <Plug>(go-def-tab) | |
autocmd FileType go nmap <silent> <Leader>x <Plug>(go-doc-vertical) | |
autocmd FileType go nmap <silent> <Leader>i <Plug>(go-info) | |
autocmd FileType go nmap <silent> <Leader>l <Plug>(go-metalinter) | |
autocmd FileType go nmap <silent> <leader>b :<C-u>call <SID>build_go_files()<CR> | |
autocmd FileType go nmap <silent> <leader>t <Plug>(go-test) | |
autocmd FileType go nmap <silent> <leader>r <Plug>(go-run) | |
autocmd FileType go nmap <silent> <leader>e <Plug>(go-install) | |
autocmd FileType go nmap <silent> <Leader>c <Plug>(go-coverage-toggle) | |
" I like these more! | |
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit') | |
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit') | |
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split') | |
autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe') | |
augroup END | |
" ==================== FZF ==================== | |
let g:fzf_command_prefix = 'Fzf' | |
let g:fzf_layout = { 'down': '~20%' } | |
nmap <C-p> :FzfHistory<cr> | |
imap <C-p> <esc>:<C-u>FzfHistory<cr> | |
nmap <C-b> :FzfFiles<cr> | |
imap <C-b> <esc>:<C-u>FzfFiles<cr> | |
let g:rg_command = ' | |
\ rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always" | |
\ -g "*.{js,json,php,md,styl,jade,html,config,py,cpp,c,go,hs,rb,conf}" | |
\ -g "!{.git,node_modules,vendor}/*" ' | |
command! -bang -nargs=* Rg | |
\ call fzf#vim#grep( | |
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1, | |
\ <bang>0 ? fzf#vim#with_preview('up:60%') | |
\ : fzf#vim#with_preview('right:50%:hidden', '?'), | |
\ <bang>0) | |
command! -bang -nargs=* F call fzf#vim#grep(g:rg_command .shellescape(<q-args>), 1, <bang>0) | |
" ==================== delimitMate ==================== | |
let g:delimitMate_expand_cr = 1 | |
let g:delimitMate_expand_space = 1 | |
let g:delimitMate_smart_quotes = 1 | |
let g:delimitMate_expand_inside_quotes = 0 | |
let g:delimitMate_smart_matchpairs = '^\%(\w\|\$\)' | |
imap <expr> <CR> pumvisible() ? "\<c-y>" : "<Plug>delimitMateCR" | |
" ==================== NerdTree ==================== | |
" For toggling | |
noremap <Leader>n :NERDTreeToggle<cr> | |
noremap <Leader>f :NERDTreeFind<cr> | |
let NERDTreeShowHidden=1 | |
" ==================== ag ==================== | |
let g:ackprg = 'ag --vimgrep --smart-case' | |
" ==================== markdown ==================== | |
let g:vim_markdown_folding_disabled = 1 | |
let g:vim_markdown_fenced_languages = ['go=go', 'viml=vim', 'bash=sh'] | |
let g:vim_markdown_toml_frontmatter = 1 | |
let g:vim_markdown_frontmatter = 1 | |
let g:vim_markdown_new_list_item_indent = 2 | |
let g:vim_markdown_no_extensions_in_markdown = 1 | |
" create a hugo front matter in toml format to the beginning of a file. Open | |
" empty markdown file, i.e: '2018-02-05-speed-up-vim.markdown'. Calling this | |
" function will generate the following front matter under the cursor: | |
" | |
" +++ | |
" author = "Fatih Arslan" | |
" date = 2018-02-03 08:41:20 | |
" title = "Speed up vim" | |
" slug = "speed-up-vim" | |
" url = "/2018/02/03/speed-up-vim/" | |
" featured_image = "" | |
" description = "" | |
" +++ | |
" | |
function! s:create_front_matter() | |
let fm = ["+++"] | |
call add(fm, 'author = "Fatih Arslan"') | |
call add(fm, printf("date = \"%s\"", strftime("%Y-%m-%d %X"))) | |
let filename = expand("%:r") | |
let tl = split(filename, "-") | |
" in case the file is in form of foo.md instead of | |
" year-month-day-foo.markdown | |
if !empty(str2nr(tl[0])) | |
let tl = split(filename, "-")[3:] | |
endif | |
let title = join(tl, " ") | |
let title = toupper(title[0]) . title[1:] | |
call add(fm, printf("title = \"%s\"", title)) | |
let slug = join(tl, "-") | |
call add(fm, printf("slug = \"%s\"", slug)) | |
call add(fm, printf("url = \"%s/%s/\"", strftime("%Y/%m/%d"), slug)) | |
call add(fm, 'featured_image = ""') | |
call add(fm, 'description = ""') | |
call add(fm, "+++") | |
call append(0, fm) | |
endfunction | |
" create a shortcode that inserts an image holder with caption or class | |
" attribute that defines on how to set the layout. | |
function! s:create_figure() | |
let fig = ["{{< figure"] | |
call add(fig, 'src="/images/image.jpg"') | |
call add(fig, 'class="left"') | |
call add(fig, 'caption="This looks good!"') | |
call add(fig, ">}}") | |
let res = [join(fig, " ")] | |
call append(line("."), res) | |
endfunction | |
augroup md | |
autocmd! | |
autocmd Filetype markdown command! -bang HugoFrontMatter call <SID>create_front_matter() | |
autocmd Filetype markdown command! -bang HugoFig call <SID>create_figure() | |
augroup END | |
" ==================== vim-json ==================== | |
let g:vim_json_syntax_conceal = 0 | |
" ==================== UltiSnips ==================== | |
function! g:UltiSnips_Complete() | |
call UltiSnips#ExpandSnippet() | |
if g:ulti_expand_res == 0 | |
if pumvisible() | |
return "\<C-n>" | |
else | |
call UltiSnips#JumpForwards() | |
if g:ulti_jump_forwards_res == 0 | |
return "\<TAB>" | |
endif | |
endif | |
endif | |
return "" | |
endfunction | |
function! g:UltiSnips_Reverse() | |
call UltiSnips#JumpBackwards() | |
if g:ulti_jump_backwards_res == 0 | |
return "\<C-P>" | |
endif | |
return "" | |
endfunction | |
if !exists("g:UltiSnipsJumpForwardTrigger") | |
let g:UltiSnipsJumpForwardTrigger = "<tab>" | |
endif | |
if !exists("g:UltiSnipsJumpBackwardTrigger") | |
let g:UltiSnipsJumpBackwardTrigger="<s-tab>" | |
endif | |
au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>" | |
au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=g:UltiSnips_Reverse()<cr>" | |
" ==================== Various other plugin settings ==================== | |
nmap - <Plug>(choosewin) | |
" Trigger a highlight in the appropriate direction when pressing these keys: | |
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] | |
" vim: sw=2 sw=2 et | |
" deoplete | |
set completeopt=longest,menuone " auto complete setting | |
let g:deoplete#enable_at_startup = 1 | |
let g:deoplete#enable_smart_case = 1 | |
let g:deoplete#auto_complete_start_length = 1 | |
let g:deoplete#keyword_patterns = {} | |
let g:deoplete#keyword_patterns['default'] = '\h\w*' | |
let g:deoplete#omni#input_patterns = {} | |
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const'] | |
let g:deoplete#sources#go#align_class = 1 | |
" neomake | |
autocmd BufWritePost * Neomake | |
let g:neomake_error_sign = {'text': '✖', 'texthl': 'NeomakeErrorSign'} | |
let g:neomake_warning_sign = {'text': '∆', 'texthl': 'NeomakeWarningSign'} | |
let g:neomake_message_sign = {'text': '➤', 'texthl': 'NeomakeMessageSign'} | |
let g:neomake_info_sign = {'text': 'ℹ', 'texthl': 'NeomakeInfoSign'} | |
let g:neomake_go_enabled_makers = [ 'go', 'gometalinter' ] | |
let g:neomake_go_gometalinter_maker = { | |
\ 'args': [ | |
\ '--tests', | |
\ '--enable-gc', | |
\ '--concurrency=3', | |
\ '--fast', | |
\ '-D', 'aligncheck', | |
\ '-D', 'dupl', | |
\ '-D', 'gocyclo', | |
\ '-D', 'gotype', | |
\ '-E', 'errcheck', | |
\ '-E', 'misspell', | |
\ '-E', 'unused', | |
\ '%:p:h', | |
\ ], | |
\ 'append_file': 0, | |
\ 'errorformat': | |
\ '%E%f:%l:%c:%trror: %m,' . | |
\ '%W%f:%l:%c:%tarning: %m,' . | |
\ '%E%f:%l::%trror: %m,' . | |
\ '%W%f:%l::%tarning: %m' | |
\ } | |
" clear signcolumns! | |
"noremap <silent> <leader>cls :sign unplace *<CR>:set signcolumn=auto<CR> | |
noremap <silent> <leader>nsc :set scl=no | |
noremap <silent> <leader>sc :set scl=yes | |
let g:clipboard = { | |
\ 'name': 'xclip-xfce4-clipman', | |
\ 'copy': { | |
\ '+': 'xclip -selection clipboard', | |
\ '*': 'xclip -selection clipboard', | |
\ }, | |
\ 'paste': { | |
\ '+': 'xclip -selection clipboard -o', | |
\ '*': 'xclip -selection clipboard -o', | |
\ }, | |
\ 'cache_enabled': 1, | |
\ } | |
set termguicolors | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
" Python stuff | |
"au BufNewFile,BufRead *.py | |
" \ set tabstop=4 | |
" \ set softtabstop=4 | |
" \ set shiftwidth=4 | |
" \ set textwidth=79 | |
" \ set expandtab | |
" \ set autoindent | |
" \ set fileformat=unix | |
" =================== Neomake ======================== | |
let g:neomake_python_enabled_makers = ['flake8', 'pep8', 'vulture'] | |
let g:neomake_python_flake8_maker = { 'args': ['--ignore=E115,E266,E501'], } | |
let g:neomake_python_pep8_maker = { 'args': ['--max-line-length=80', '--ignore=E115,E266'], } | |
autocmd! BufWritePost * Neomake | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
"" Use `:lopen / :lclose` to view output window | |
autocmd FileType * autocmd BufWritePre <buffer> :%s/\s\+$//e | |
let g:neomake_python_flake8_maker = { | |
\ 'args': ['--ignore=E221,E241,E272,E251,W702,E203,E201,E202', '--format=default'], | |
\ 'errorformat': | |
\ '%E%f:%l: could not compile,%-Z%p^,' . | |
\ '%A%f:%l:%c: %t%n %m,' . | |
\ '%A%f:%l: %t%n %m,' . | |
\ '%-G%.%#', | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment