Last active
March 14, 2018 03:52
-
-
Save zacps/c910b41407b18377c02d1d0730a6e839 to your computer and use it in GitHub Desktop.
This file contains 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
" ╔═╗╦ ╦╔═╗╦╔╦╗╔═╗ | |
" ╠═╣║ ║║ ╦║ ║ ║╣ | |
" ╩ ╩╚═╝╚═╝╩ ╩ ╚═╝ | |
" An overloaded neovim config | |
" Setup {{{ | |
" Set directory for all vim files | |
let $vimdir = $HOME.(has('win32') ? '\vimfiles\' : '/.config/nvim/') | |
" Setup the User augroup | |
augroup Augite | |
autocmd! | |
augroup Augite | |
" Installs vimplug and plugins automatically if not found. | |
if empty(glob('~/.config/nvim/autoload')) && executable('curl') | |
silent !mkdir -p $vimdir/{autoload,plugged} | |
silent !curl -fLo $vimdir/autoload/plug.vim | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
source $vimdir/autoload/plug.vim | |
autocmd Augite VimEnter * PlugInstall | |
endif | |
" }}} | |
" Options {{{ | |
" Enable/Disable language plugins | |
let Cpp = 1 | |
let Go = 1 | |
let Python = 1 | |
let Rust = 1 | |
let JS = 1 " Untested | |
let PHP = 1 | |
" Enables vim-devicons/airline symbols | |
let patched_font = 1 | |
" }}} | |
" General Settings {{{ | |
set number | |
" Filetype detection | |
filetype plugin indent on | |
" Syntax highlighting | |
if !exists("g:syntax_on")|syntax enable|endif | |
" Allow hidden buffers | |
set hidden | |
" Set soft maximum line length | |
set tw=80 | |
" Make tabs smaller | |
set tabstop=4 shiftwidth=4 | |
" Stops stupid hard line breaks. See |fo-table| | |
set formatoptions=lcqjn | |
" Shown through statusline | |
set noshowmode | |
" Sensible splits | |
set splitright splitbelow | |
" Show the command being typed | |
set showcmd | |
" Case insensitive search - Unless begins with uppercase | |
set ignorecase smartcase | |
" Hide formatting characters unless in current line or in insert or command mode | |
set conceallevel=2 concealcursor=nc | |
" Better command completion | |
set wildmode=longest,list,full | |
" Keep indentation after wrapping and don't break words | |
set breakindent linebreak | |
" Don't redraw during macros/register usage | |
set lazyredraw | |
" Enable folds but open them by default | |
set foldenable foldlevelstart=10 | |
" Enable modelines | |
set modeline | |
" Lines to keep visible above/below, left/right of the cursor | |
set scrolloff=10 sidescrolloff=5 | |
" Substituations can happen more than once per line by default | |
set gdefault | |
" Write a buffer when switching off of it | |
set autowrite | |
" These are neovim defaults on some terminals, set them for all | |
" Enable changing cursor shape | |
set guicursor=n-v-c:block-Cursor/lCursor-blinkon0,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor | |
" Use mouse | |
set mouse=a | |
" Remember last cursor position | |
autocmd Augite BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | |
" Files | |
set undofile | |
let &undodir=$vimdir . '/undo' | |
let &viminfo=$vimdir . '/viminfo' | |
let &spellfile=$vimdir . '/spell/en.utf-8.add' | |
" Terminal specific settings {{{ | |
" Some terminals are too slow to handle relative number | |
if $term == 'rxvt-unicode-256color' || $ACTUALTERM == 'alacritty' | |
" Show absolute line number on current line and relative on the rest | |
set relativenumber | |
endif | |
if $ACTUALTERM == 'alacritty' | |
" Enable truecolour for terminals that support it | |
set termguicolors | |
endif | |
" }}} | |
" }}} | |
" Commands {{{ | |
" Diff original file against current buffer | |
command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | |
\ | wincmd p | diffthis | |
" Shortcut to rename a tab | |
command! Tre TabooRename | |
" Sudo write | |
command! Swrite w !sudo tee % | |
" Highlight test | |
command! HighlightTest so $VIMRUNTIME/syntax/hitest.vim | |
" }}} | |
" Filetype settings {{{ | |
" Use 80ch wide vert splits for :help | |
autocmd Augite FileType help | |
\ wincmd L | | |
\ vert resize 80 | |
" Use Goyo for markdown, text and vim files | |
" This creates more issues than it's worth | |
" autocmd Augite FileType markdown,vim,text | |
" \ if WinCount() == 1 | Goyo | endif | |
" PHP Syntax | |
let php_sql_query = 1 | |
let php_htmlInStrings = 1 | |
" }}} | |
" Key bindings {{{ | |
let mapleader = ',' " \ is used to refer to leader for simplicity | |
" Easy command mode | |
nnoremap ; : | |
" Easily remove search highlighting | |
nnoremap <Leader><Space> :nohlsearch<Cr> | |
" Navigate by display lines | |
nnoremap j gj | |
nnoremap k gk | |
" Backspace in normal mode | |
nnoremap <BS> dh | |
" Language Server | |
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR> | |
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR> | |
" Switch files on space | |
nnoremap <Space> :Files<CR> | |
" Close FZF with <Esc> | |
autocmd Augite Filetype fzf tnoremap <buffer> <Esc> <plug>(fzf-maps-n)<c-w>q | |
nnoremap <CR> o<Esc>k | |
" Lint on \l | |
nnoremap <leader>l :ALELint<cr> | |
" Smarter tab - Described in functions | |
" imap <expr><TAB> <SID>neosnippet_complete() | |
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>" | |
" Regular back entry for shift-tab | |
inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>" | |
" F Bindings | |
" Toggle NERDTree on F2 | |
nnoremap <F2> :NERDTreeToggle<CR> | |
" Show undo tree on F3 | |
nnoremap <f3> :UndotreeToggle<cr> | |
" Toggle tagbar on F4 | |
nnoremap <F4> :TagbarToggle<CR> | |
" Run meta linter on F6 | |
autocmd Augite Filetype go nmap <buffer> <F6> :GoMetaLinter<CR> | |
" Toggle spell check for current buffer on F7 | |
nnoremap <F7> :setlocal spell!<CR> | |
" Find the highlight groups used under cursor - from http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor | |
nnoremap <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' | |
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" | |
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> | |
" Reload config on \rr - Goyo doesn't like the syntax changes so we turn it off | |
nnoremap <leader>rr :source $vimdir/init.vim <bar> :Goyo! <CR> | |
" Show start screen on \st | |
nnoremap <leader>st :Startify<cr> | |
" Don't loose selection on indent | |
xnoremap < <gv | |
xnoremap > >gv | |
" Map escape to exit terminal mode, \t to open a terminal in a split and \T to | |
" open a terminal in a tab | |
if has('nvim') | |
nnoremap <leader>t :vsplit +terminal<cr> | |
" /bin/bash -c unexpected token newline | |
"nnoremap <leader>T :tab sp | terminal<cr> | |
tnoremap <esc> <c-\><c-n> | |
endif | |
" }}} | |
" Plugins {{{ | |
" Add a condition to a single plugin | |
function! Require(cond, ...) | |
let opts = get(a:000, 0, {}) | |
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] }) | |
endfunction | |
call plug#begin($vimdir . 'plugged') | |
"General {{{ | |
" Git helper | |
Plug 'tpope/vim-fugitive' | |
" Git line gutter - Hunk bindings are amazing | |
Plug 'airblade/vim-gitgutter' | |
" Surround text easily | |
Plug 'tpope/vim-surround' | |
" Async linting framework | |
Plug 'w0rp/ale' | |
" Commenting | |
Plug 'scrooloose/nerdcommenter' | |
" Fuzzy file search - TODO Mappings for commands | |
"Especially: Files, Buffers, Tags, Marks?, History | |
"Remember: Commits, Maps, Commands, Helptags | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
" Plugin to set options based on a .editorconfig file | |
Plug 'editorconfig/editorconfig-vim' | |
" Sets indent settings based on file and other files of the same type in the | |
" current/parent directory | |
" Plug 'tpope/vim-sleuth' | |
" Continuously updated sessons :Obsess | |
Plug 'tpope/vim-obsession' | |
" Fancy start screen | |
Plug 'mhinz/vim-startify' | |
" (Google) Calendar | |
Plug 'itchyny/calendar.vim' | |
" Provides motions for camel case or underscored words, leader w, leader b, | |
" leader e. Seems super slow for some reason? | |
Plug 'bkad/CamelCaseMotion' | |
" Rename tabs | |
Plug 'gcmt/taboo.vim' | |
" Vertical alignment | |
Plug 'godlygeek/tabular' | |
" Organisation | |
" Calendar | |
Plug 'mattn/calendar-vim' | |
" Text linking | |
Plug 'vim-scripts/utl.vim' | |
" In/de crement dates | |
Plug 'tpope/vim-speeddating' " (c-a, c-x) | |
" Bars/Panels {{{ | |
" File tree | |
Plug 'scrooloose/nerdtree' | |
" Show git status | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
" Guess project directory from VCS | |
Plug 'janlay/NERD-tree-project' | |
" Highlight devicons | |
if patched_font | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
endif | |
" Tagbar | |
Plug 'majutsushi/tagbar', Require(executable('ctags')) | |
" }}} | |
" }}} | |
" Autocomplete {{{ | |
if has('nvim') | |
" TODO Native vim autocomplete | |
function! DoRemote(arg) | |
UpdateRemotePlugins | |
endfunction | |
Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') } | |
" Language server | |
Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' } | |
endif | |
" Also completes from included files(?) | |
"Plug 'Shougo/neoinclude.vim' | |
" Complete parens and space brackets properly | |
Plug 'jiangmiao/auto-pairs' | |
" }}} | |
" Snippets {{{ | |
" Snippet engine | |
Plug 'Shougo/neosnippet.vim' | |
" Actual snippets | |
Plug 'Shougo/neosnippet-snippets' | |
" }}} | |
" Filetype specific {{{ | |
" Golang {{{ | |
if Go && executable('go') | |
Plug 'fatih/vim-go', { 'for': ['go'] } | |
" Refactoring tool | |
Plug 'godoctor/godoctor.vim', { 'for': ['go'] } | |
" Generate method stubs to implement an interface | |
Plug 'rhysd/vim-go-impl', { 'for': ['go'], 'do': 'go get -u github.com/josharian/impl' } | |
" Autocomplete for golang | |
Plug 'nsf/gocode' ", { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' } ??? | |
Plug 'zchee/deoplete-go', { 'for': ['go'], 'do': 'make'} | |
" Debugger | |
Plug 'sebdah/vim-delve', Require(executable('dlv')) | |
" Go template language -- TODO Support for this should be in vim-go soon | |
Plug 'warbear0129/vim-qtpl' | |
endif | |
" }}} | |
" Python {{{ | |
if Python && (executable('python') || executable('python3')) | |
" Python syntax, linting, debugger, etc | |
" Plug 'python-mode/python-mode', { 'for': 'python' } | |
" Autocompletetion | |
Plug 'zchee/deoplete-jedi' | |
" Sort python imports | |
Plug 'fisadev/vim-isort', { 'for': 'python', 'do': 'pip install --user isort' } | |
endif | |
" }}} | |
" C++ {{{ | |
if Cpp && executable("clang") | |
" Deoplete source | |
Plug 'zchee/deoplete-clang' | |
" Not sure about the filetype for headers | |
Plug 'xaizek/vim-inccomplete' | |
" Syntax highlighting | |
Plug 'octol/vim-cpp-enhanced-highlight' | |
" Highlighting for tags (User typedefs etc) not strictly for cpp | |
Plug 'abudden/taghighlight-automirror', { 'for': ['cpp', 'h'] } | |
endif | |
" }}} | |
" Rust {{{ | |
if Rust && executable('cargo') | |
Plug 'rust-lang/rust.vim', { 'for': 'rust' } | |
Plug '~/.config/nvim/plugged/zsyntax-tweaks' | |
endif | |
" }}} | |
" JavaScript {{{ | |
if JS && executable('npm') | |
Plug 'ternjs/tern_for_vim', { 'do': 'npm install', 'for': 'javascript' } | |
Plug 'ramitos/jsctags', { 'for': 'javascript' } | |
" Better syntax highlighting | |
Plug 'pangloss/vim-javascript', { 'for': 'javascript' } | |
" Typescript | |
" call system( | |
" 'npm install --global git+https://github.com/Perlence/tstags.git' | |
" ) | |
endif | |
" }}} | |
" PHP {{{ | |
if PHP && executable('composer') | |
" Language server for PHP | |
Plug 'roxma/LanguageServer-php-neovim', {'do': 'composer install && composer run-script parse-stubs'} | |
" Looks like this has been replaced by the languager server | |
"Plug 'lvht/phpcd.vim', { 'for': 'php', 'do': 'pecl install msgpack && composer install' } | |
endif | |
" }}} | |
" }}} | |
" Appearance {{{ | |
" Statusline - Breaks with :Goyo on a filetype autocmd | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
" Focus mode | |
Plug 'junegunn/goyo.vim' | |
" Colours schemes | |
" Base16 (All) | |
Plug 'chriskempson/base16-vim' | |
" Nord - Light blue theme | |
Plug 'arcticicestudio/nord-vim' | |
" }}} | |
" Organisation {{{ | |
" Remove one of these once a preferred one is reached | |
" Org-mode | |
" Plug 'jceb/vim-orgmode', { 'for': 'org' } | |
" Vim-wiki | |
" Plug 'vimwiki/vimwiki' | |
" Alternative vim-wiki with default markdown syntax | |
Plug 'lervag/wiki' | |
" }}} | |
" Syntax Plugins {{{ | |
Plug 'alvan/vim-closetag' | |
Plug 'othree/html5.vim' | |
Plug 'posva/vim-vue', { 'for': ['vue', 'html'] } | |
Plug 'burner/amber.vim', { 'for': 'amber' } | |
Plug 'yosssi/vim-ace', { 'for': 'ace' } | |
Plug 'cespare/vim-toml', { 'for': 'toml' } | |
Plug 'digitaltoad/vim-pug', { 'for': 'pug' } | |
Plug 'baskerville/vim-sxhkdrc' | |
Plug 'dag/vim-fish' | |
" PostgreSQL syntax, used for ALL sql files! | |
Plug 'exu/pgsql.vim', { 'for': 'sql' } | |
" Highlight hex colours | |
Plug 'chrisbra/Colorizer' | |
" }}} | |
" Final load (MUST BE LAST) {{{ | |
Plug 'ryanoasis/vim-devicons' | |
" }}} | |
call plug#end() | |
" }}} | |
" Plugin settings {{{ | |
" Deoplete {{{ | |
let g:deoplete#enable_at_startup = 1 | |
" Autoclose the suggestion window if you complete something or leave insert | |
autocmd Augite InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif | |
" Without this deoplete will flash with 'pattern not found' on html files. | |
set shortmess+=c | |
let g:deoplete#auto_complete_delay = 100 "In milliseconds, default 50 | |
" Enter inserts a new line AND closes deoplete | |
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() abort | |
return deoplete#close_popup() . "\<CR>" | |
endfunction | |
" Deoplete-go | |
let g:deoplete#sources#go#use_cache = 1 | |
let g:deoplete#sources#go#json_directory = '~/.cache/deoplete/go' | |
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const'] | |
let g:deoplete#sources#go#gocode_binary = $GOPATH.'/bin/gocode' | |
" For PHP from github.com/lvht/phpcd.vim | |
let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {}) | |
let g:deoplete#ignore_sources.php = ['omni'] | |
" }}} | |
" Ale {{{ | |
let g:airline#extensions#ale#enabled = 1 | |
" High delay if using continuous linting | |
let g:ale_lint_delay = 750 "ms | |
" This was the syntastic default, leave it for now | |
let g:ale_open_list = 1 | |
" Lint on write or InsertLeave | |
let g:ale_lint_on_text_changed = 'never' | |
" Can't use InsertLeave because we don't want to lint if we're entering visual/select mode | |
inoremap <Esc> <Esc>:ALELint<Cr> | |
inoremap <c-\><c-n> <Esc>:ALELint<Cr> | |
" Linters {{{ | |
let g:ale_linters = { | |
\ 'go': ['gometalinter', 'gofmt'], | |
\ 'rust': ['rls'] | |
\ } | |
" }}} | |
" Go options | |
let g:ale_go_gometalinter_options = "--enable=goimports --enable=gosimple --enable=unparam --enable=unused --enable=safesql --disable=gotype --enable=staticcheck --aggregate --vendored-linters -e 'should have comment or be unexported'" | |
" }}} | |
" Rust linters {{{ | |
" let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] | |
" }}} | |
" Vim-go {{{ | |
let g:go_highlight_build_constraints = 1 | |
let g:go_highlight_extra_types = 1 | |
let g:go_highlight_fields = 1 | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_structs = 1 | |
let g:go_highlight_types = 1 | |
" gofmt + imports - maybe replace this with ALEFix | |
let g:go_fmt_command = "goimports" | |
let g:go_snippet_engine = "neosnippet" | |
" }}} | |
" Tagbar {{{ | |
let g:tagbar_type_go = { | |
\ 'ctagstype' : 'go', | |
\ 'kinds' : [ | |
\ 'p:package', | |
\ 'i:imports:1', | |
\ 'c:constants', | |
\ 'v:variables', | |
\ 't:types', | |
\ 'n:interfaces', | |
\ 'w:fields', | |
\ 'e:embedded', | |
\ 'm:methods', | |
\ 'r:constructor', | |
\ 'f:functions' | |
\ ], | |
\ 'sro' : '.', | |
\ 'kind2scope' : { | |
\ 't' : 'ctype', | |
\ 'n' : 'ntype' | |
\ }, | |
\ 'scope2kind' : { | |
\ 'ctype' : 't', | |
\ 'ntype' : 'n' | |
\ }, | |
\ 'ctagsbin' : 'gotags', | |
\ 'ctagsargs' : '-sort -silent' | |
\ } | |
let g:tagbar_type_markdown = { | |
\ 'ctagstype' : 'markdown', | |
\ 'kinds' : [ | |
\ 'h:Heading_L1', | |
\ 'i:Heading_L2', | |
\ 'k:Heading_L3' | |
\ ] | |
\ } | |
let g:tagbar_type_rust = { | |
\ 'ctagstype' : 'rust', | |
\ 'kinds' : [ | |
\'T:Types', | |
\'f:Functions', | |
\'g:Enums', | |
\'s:Structs', | |
\'m:Module names', | |
\'c:Static/Constant', | |
\'t:Traits', | |
\'i:Implementations', | |
\] | |
\} | |
let g:tagbar_type_typescript = { | |
\ 'ctagsbin' : 'tstags', | |
\ 'ctagsargs' : '-f-', | |
\ 'kinds': [ | |
\ 'e:enums:0:1', | |
\ 'f:function:0:1', | |
\ 't:typealias:0:1', | |
\ 'M:Module:0:1', | |
\ 'I:import:0:1', | |
\ 'i:interface:0:1', | |
\ 'C:class:0:1', | |
\ 'm:method:0:1', | |
\ 'p:property:0:1', | |
\ 'v:variable:0:1', | |
\ 'c:const:0:1', | |
\ ], | |
\ 'sort' : 0 | |
\ } | |
" Omit help and empty lines | |
let g:tagbar_compact = 1 | |
let g:tagbar_autoshowtag = 1 | |
" }}} | |
" Startify {{{ | |
let g:startify_bookmarks = [ | |
\ { 'config': '~/.config/nvim/init.vim' }, | |
\ { 'cheatsheet': '~/.cheat/neovim' }, | |
\ { 'diary': '~/diary/diary.md' } | |
\ ] | |
" Where to store session files | |
let g:Startify_session_dir = $vimdir . 'startifysession/' | |
" Autoload a session file if vim is opened in it's directory. | |
let g:Startify_session_autoload = 1 | |
" Automatically save a session when leaving vim or loading a new session | |
let g:Startify_session_persistence = 1 | |
" When opening file/bookmark change to vcs root {MSLOW} | |
let g:startify_change_to_vcs_root = 1 | |
" Might break depending on the font, uses unicode for the top message box | |
let g:startify_fortune_use_unicode = 0 | |
" Improves speed at the cost of consistency | |
"let g:startify_enable_unsafe = 0 | |
" Sort sessions by mod date | |
let g:startify_session_sort = 0 | |
" Use environment variables in paths if they're shorter than the path | |
let g:startify_use_env = 1 | |
" }}} | |
" NERDCommenter {{{ | |
let g:NERDSpaceDelims = 1 | |
" }}} | |
" Language Server Client {{{ | |
let g:LanguageClient_autoStart = 1 | |
" Command to run for each language | |
let g:LanguageClient_serverCommands = { | |
\ 'rust': ['rustup', 'run', 'nightly', 'rls'], | |
\ } | |
" }}} | |
" PSQL {{{ | |
" Use pgsql for all sql files, might want to remove this at some point | |
let g:sql_type_default = 'pgsql' | |
" }}} | |
" Fugitive {{{ | |
" Vertical diffs | |
set diffopt+=vertical | |
" }}} | |
" Racer (Rust autocomplete) {{{ | |
let g:racer_experimental_completer = 1 | |
let g:racer_cmd = "~/.cargo/bin/racer" "Maybe not needed | |
" }}} | |
" Rust.vim {{{ | |
" I think this might be causing the jump to EOF | |
let g:rustfmt_autosave = 1 | |
let g:rustfmt_fail_silently = 0 | |
let g:rust_conceal = 1 | |
let g:rust_conceal_mod_path = 1 | |
let g:rust_conceal_pub = 1 | |
let g:rust_fold = 1 | |
" let g:ftplugin_rust_source_path = $HOME.'/programming/rust' | |
" }}} | |
" NERDCommenter {{{ | |
" Allow commenting and inverting empty lines (useful when commenting a region) | |
let g:NERDCommentEmptyLines = 1 | |
" Enable trimming of trailing whitespace when uncommenting | |
let g:NERDTrimTrailingWhitespace = 1 | |
" Use spaces after a comment character | |
let g:NERDSpaceDelims = 1 | |
" }}} | |
" Airline {{{ | |
if patched_font | |
let g:airline_powerline_fonts = 1 | |
endif | |
" Show a $ if obsession is enabled | |
let g:airline_section_z = airline#section#create(['%{ObsessionStatus(''$'', '''')}', 'windowswap', '%3p%% ', 'linenr', ':%3v ']) | |
" Enable the buffer list | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
" Disable trailing separator | |
let g:airline_skip_empty_sections = 1 | |
" Disable current function because it doesn't update often enough | |
let g:airline#extensions#tagbar#enabled = 0 | |
let g:airline#extensions#whitespace#checks = [ 'indent', 'mixed-indent-file' ] | |
" }}} | |
" Wiki {{{ | |
let g:wiki = { 'root' : '~/Documents/wiki' } | |
" }}} | |
" Neosnippet {{{ | |
" Enable completing snippets | |
let g:neosnippet#enable_completed_snippet = 1 | |
" Keybindings | |
" Open snippet | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
" Move to next mark - This doesn't work if deoplete has something to complete | |
" smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
" \ \"\<Plug>(neosnippet_expand_or_jump)" : \"\<TAB>" | |
imap <expr><TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
" }}} | |
" Universal text linking (utl) {{{ | |
" let g:utl_cfg_hdl_scm_http=g:utl_cfg_hdl_scm_http__wget | |
" }}} | |
" }}} | |
" Functions {{{ | |
" Returns the number of windows in the current tab | |
function! WinCount() | |
let wincount = 0 | |
windo let wincount += 1 | |
return wincount | |
endfunction | |
" Smarter tab. If there's a snippet to expand or a jump do that. If we're in a | |
" completion popup move to the next item. Otherwise insert a tab. | |
function! s:neosnippet_complete() | |
if pumvisible() | |
if neosnippet#expandable_or_jumpable() | |
return "\<Plug>(neosnippet_expand_or_jump)" | |
endif | |
return "\<tab>" | |
else | |
return "\<c-n>" | |
endif | |
endfunction | |
" Close NERDTree if it's the last window | |
autocmd Augite bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" Close quickfix window if it's the last window | |
autocmd Augite BufEnter * call MyLastWindow() | |
function! MyLastWindow() | |
" if the window is quickfix go on | |
if &buftype=="quickfix" | |
" if this window is last on screen quit without warning | |
if winbufnr(2) == -1 | |
quit! | |
endif | |
endif | |
endfunction | |
" Exit goyo callback | |
function! s:goyo_leave() | |
call s:SyntaxTweaks() | |
endfunction | |
autocmd Augite User GoyoLeave nested call <SID>goyo_leave() | |
" }}} | |
" Appearance {{{ | |
" Colourscheme {{{ | |
set background=dark | |
let base16colorspace=256 | |
colorscheme base16-twilight | |
let g:airline_theme="base16_twilight" | |
" }}} | |
" Colourscheme tweaks {{{ | |
function! s:SyntaxTweaks() | |
" Transparent background and number line | |
hi Normal ctermbg=none guibg=none | |
hi LineNr ctermbg=none guibg=none | |
hi NonText ctermbg=none guibg=none | |
hi Todo ctermbg=none guibg=none | |
hi SignColumn ctermbg=none guibg=none | |
hi CursorLineNr ctermbg=none guibg=none | |
" Remove background on gitgutter signs | |
let g:gitgutter_override_sign_column_highlight = 0 | |
hi SignifySignAdd ctermbg=none guibg=none | |
hi SignifySignDelete ctermbg=none guibg=none | |
hi SignifySignChange ctermbg=none guibg=none | |
hi GitGutterDeleteInvisible ctermbg=none guibg=none | |
hi GitGutterAddInvisible ctermbg=none guibg=none | |
hi GitGutterChangeInvisible ctermbg=none guibg=none | |
hi GitGutterAdd ctermbg=none guibg=none | |
hi GitGutterChange ctermbg=none guibg=none | |
hi GitGutterDelete ctermbg=none guibg=none | |
hi GitGutterChangeDelete ctermbg=none guibg=none | |
" Transparent spelling highlights | |
hi SpellBad ctermbg=none guibg=none | |
hi SpellCap ctermbg=none guibg=none | |
hi SpellRare ctermbg=none guibg=none | |
hi SpellLocal ctermbg=none guibg=none | |
" Transparent tabline | |
hi TabLineFill ctermbg=none guibg=none | |
hi TabLine ctermbg=none guibg=none | |
hi TabLineSel ctermbg=none guibg=none | |
" Solid vsplit line | |
hi VertSplit ctermbg=none guibg=none | |
set fillchars+=vert:│ | |
" Lighter yellow search background | |
hi Search ctermfg=black ctermbg=16 | |
" Clearer text | |
hi Wildmenu ctermfg=white | |
hi PmenuSbar ctermfg=white | |
hi Error ctermfg=white | |
" Creates a line under the tabline, using underline for this is not ideal | |
hi TabLine cterm=underline gui=underline | |
hi TabLineSel cterm=underline gui=underline | |
hi TabLineFill cterm=underline gui=underline | |
" Italic comments | |
hi Comment cterm=italic gui=italic | |
endfunction " }}} | |
" autocmd Augite FileType rust syn match FunctionDef "fn" conceal cchar=ƒ | |
" autocmd Augite FileType go syn match FunctionDef "func" conceal cchar=ƒ | |
call s:SyntaxTweaks() | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment