1
0
forked from extern/nix-config
donovanglover-nix-config/dots/common/.vimrc

155 lines
5.3 KiB
VimL
Raw Normal View History

2018-02-28 02:31:44 +01:00
" New Start: A modern Arch workflow built with an emphasis on functionality.
" Copyright (C) 2017-2018 Donovan Glover
if &shell =~# 'fish$'
set shell=sh
endif
2017-10-24 13:46:54 +02:00
source ~/.vim/plugins.vim
source ~/.vim/config.vim
source ~/.vim/colors.vim
source ~/.vim/keybindings.vim
2017-10-24 13:46:54 +02:00
" =================================== Plugin-Specific ===================================
let g:ale_lint_on_text_changed = 'never' " Do not lint while typing
let g:ale_lint_on_insert_leave = 1 " Only lint after leaving insert mode
let g:ackprg = 'rg --vimgrep' " Use rg instead of ag / ack / grep
2017-12-25 21:14:32 +01:00
let g:plug_window = 'rightbelow topleft new' " Show vim-plug above instead of to the left
let g:vimfiler_as_default_explorer = 1 " Replace netrw with vimfiler as the default FileEx
let g:indentLine_enabled = 0 " Disable indent lines by default
let g:indentLine_color_term = 8 " Set the color for the indent line
"let g:vimfiler_no_default_key_mappings = 1
2017-10-24 13:46:54 +02:00
2017-12-25 21:14:32 +01:00
" Note that indent lines breaks with pencil mode, although you really
" shouldn't be using both at the same time anyway.
" NOTE: To view all the items you can change the color of, use:
" :so $VIMRUNTIME/syntax/hitest.vim
" Set the color for the vertical split line (6 is as good as 8 here)
hi vertsplit ctermfg=8 ctermbg=none
" Remove the background color from the status line
hi StatusLine ctermbg=none
hi StatusLineNC ctermbg=none
" Remove the background color from tabs
hi TabLine ctermbg=none
hi TabLineFill ctermbg=none
hi TabLineSel ctermbg=none
" Finally, an easier way to read search results
hi Search ctermbg=240 ctermfg=255
" We have to set the color for while we search as well
" To keep things simple, we'll just invert the colors here
" As an added bonus, this looks rather nice as well
hi IncSearch ctermbg=255 ctermfg=240
" Disable all vimtex keybindings so we can define our own
let g:vimtex_mappings_enabled = 0
let g:vimtex_imaps_enabled = 0
let g:vimtex_view_method = 'zathura'
let g:vimtex_index_show_help = 0
let g:vimtex_index_split_width = 50
let g:vimtex_index_split_pos = 'vert rightbelow'
let g:vimtex_compiler_latexmk = {'build_dir': '.tex'}
map <localleader>a <plug>(vimtex-toc-toggle)
map <localleader>f <plug>(vimtex-view)
map <localleader>g <plug>(vimtex-compile)
map <localleader>c <plug>(vimtex-errors)
map <localleader>w :VimtexCountWords<CR>
" Delete the surrounding environment
map <localleader>d <plug>(vimtex-env-delete)
map <localleader>c <plug>(vimtex-env-change)
" Toggle stars
2017-12-25 21:14:32 +01:00
nnoremap <localleader>s <plug>(vimtex-env-toggle-star)
nnoremap <localleader>e <plug>(vimtex-cmd-toggle-star)
2017-12-25 21:14:32 +01:00
inoremap ]] <plug>(vimtex-delim-close)
" Use incsearch and tab / shift+tab to go through the results
cno <expr> <tab> getcmdtype() =~ '[?/]' ? '<c-g>' : feedkeys('<tab>', 'int')[1]
cno <expr> <s-tab> getcmdtype() =~ '[?/]' ? '<c-t>' : feedkeys('<s-tab>', 'int')[1]
" Easily repeat a command on multiple lines through visual mode
vnoremap . :normal .<CR>
" Easily show lines that go past the character count
2017-12-25 21:14:32 +01:00
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" Automatically close the file viewer when it's the only thing left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Use w!! to force write a file as sudo
" cmap w!! w !sudo tee > /dev/null %
" Make the tabline not have an X in it
function MyTabLine()
let s = ''
for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr()
let s .= '%#TabLineSel#'
else
let s .= '%#TabLine#'
endif
" set the tab page number (for mouse clicks)
let s .= '%' . (i + 1) . 'T'
" the label is made by MyTabLabel()
let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
endfor
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
return s
endfunction
function MyTabLabel(n)
let buflist = tabpagebuflist(a:n)
let winnr = tabpagewinnr(a:n)
return bufname(buflist[winnr - 1])
endfunction
set tabline=%!MyTabLine()
" Custom highlighting
" Highlight key words that we like to use
match Function /@requires/
2017-12-25 21:14:32 +01:00
" Use syntax highlighting for .ecr files
autocmd BufNewFile,BufRead *.ecr set syntax=html
2018-02-28 02:31:44 +01:00
" Use syntax highlighting for .slang files
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim
autocmd BufNewFile,BufRead *.slang setlocal filetype=slim
" autocmd BufReadPost *.slang set syntax=slim
" Use htmldjango for html files
" autocmd BufNewFile,BufRead *.html setlocal filetype=htmldjango
" autocmd BufNewFile,BufRead *.html setlocal filetype=html
autocmd BufNewFile,BufRead *.html setlocal filetype=jinja
" Disable vim-markdown folding
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_math = 1
let g:vim_markdown_frontmatter = 1
autocmd BufNewFile,BufRead *.md set conceallevel=2
" au BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
" Change cursor back to blink after exiting neovim
au VimLeave * set guicursor=a:block-blinkon1
2018-08-31 19:43:14 +02:00
" Only hide the dots we don't need
let g:vimfiler_ignore_pattern = ['^\.git$', '^\.shards$', '^\.sass-cache$']
" Only use standard for JavaScript
let g:ale_linters = {'javascript': ['standard']}
" Ignore syntax concealing for markdown files
let g:vim_markdown_conceal = 0
let g:tex_conceal = ""
let g:vim_markdown_math = 1