Compare commits

..

23 Commits

Author SHA1 Message Date
fa204e07a0 Move formatexpr config in-tree, out of plugin
Introduces the `format` Python module which provides `clang_format()`
and `yapf()` functions which efficiently (compared to vimscript) invoke
`clang-format` or `yapf` respectively then apply the minimal number of
changes using `difflib.SequenceMatcher`.

Additionally, in order to invoke these Python functions add |autoload|
functions `format#clang_format()` and `format#yapf()` which can be
directly used by the 'formatexpr' setting.

Finally, add |ftplugin| files which set 'formatexpr' when the |autoload|
functions are available.
2021-03-24 23:37:19 +00:00
5de83a0e88 Don't show signcolumn when filetype man 2021-03-23 22:47:45 +00:00
eeee92517b Fix vim :terminal window mappings 2021-03-09 23:24:19 +00:00
f426dba2dc Change yaml default syntax highlights 2021-03-08 17:10:04 +00:00
6a469d374a Replace osc52yank.vim with autoload script 2021-03-03 21:05:25 +00:00
cda1ca2a41 Always enable signcolum except in nvim terminal 2021-03-02 20:48:38 +00:00
fec4126073 Add do#show_documentation() using coc.nvim
Change the `K` normal mode overrides to use the example given in the
coc.nvim README file which uses Vim's builtin help when in `vim` or
`help` files, or checks if coc.nvim is ready and invokes
`CocActionAsync('doHover')`, otherwise fallback to using `keywordprg`.
2021-02-23 13:14:22 +00:00
2f8c1816a5 Use tab width of 2 in yaml files 2021-02-23 13:09:27 +00:00
befdb5c172 Add statusline support for nvim's man pager filetype 2021-02-18 00:42:14 +00:00
93858d7687 Make terminal mode feel like insert mode statusline 2021-02-18 00:41:40 +00:00
0b3e6ce223 Make nvim :terminal more consistent with vim
Vim's :terminal feels much more ergonomic, adding various mappings to
make the experience more similar, mainly by adding a few `<C-w>`
mappings for the most common actions.

Additionally, disable vim-tmux-navigators default mappings and setup
both normal and terminal mode mappings for `<C-w>{h,j,k,l}` in addition
to the normal mode mappings for `<C-{h,j,j,l}>` to make the pane
switching experience more consistent across all buffer types.
2021-02-18 00:39:48 +00:00
a7a9e98678 Use signcolumn=number when available 2021-02-18 00:39:48 +00:00
dc674aba75 Fix statusline l:mode map indentation 2021-02-11 17:04:09 +00:00
619f043665 Remove a unused scriptencoding
There are no utf-8 special characters in the file anymore.
2021-02-08 21:47:23 +00:00
88cf5011f7 Get rid of scrolloff 2021-02-08 21:46:08 +00:00
4d0ad4f837 Replace vim-airline with a custom statusline
Finally got round to making a custom statusline after being inspired by
https://pastebin.com/Fm1NEgBf
2021-02-07 23:14:56 +00:00
15d9a611cc Add list of global coc extensions 2021-02-06 10:57:42 +00:00
61639aac54 Check if .vim directory exists before use
Update `build#dir()` to check for the existence of the `.vim` directory
containing `coc_settings.json` before attempting to read the file. If it
doesn't exist then create it.
2021-02-03 22:47:16 +00:00
284de8eb05 Configure cmake-language-server and coc-cmake
Utilises the following Python package:

```console
$ pip3 install --user cmake-language-server
```
2021-01-29 14:03:24 +00:00
4aceb7aca9 Update build#dir() to configure coc-clangd 2021-01-28 13:33:55 +00:00
f23db08d92 Replace remaining YouCompleteMe mappings 2021-01-28 13:33:55 +00:00
8bdb7b7054 Replace YouCompleteMe with coc.nvim 2021-01-27 21:05:06 +00:00
ae30cf3a09 fresh: NonText as SpecialKey
Don't use `set highlight` to highlight `NonText` like `SpecialKey`,
instead simply set the color of `NonText` in the colorscheme.
2021-01-27 19:50:11 +00:00
41 changed files with 292 additions and 481 deletions

9
.conduit.yaml Normal file
View File

@@ -0,0 +1,9 @@
---
- location: ~/.vim
- pip:
- vim-vint
- yamllint
- cmakelint
- repo:
- remote: https://github.com/k-takata/minpac.git
location: ~/.vim/pack/minpac/opt/minpac

1
.gitignore vendored
View File

@@ -2,4 +2,3 @@ local.vim
.netrwhist
pack/*
spell/*
*.pyc

View File

@@ -27,15 +27,18 @@ class Comment(object):
endglobal
snippet todo "TODO commment"
`!p comment=Comment();snip.rv=comment.before()`TODO${1/.+/(/}$1${1/.+/)/}: $0`!p snip.rv=comment.after()`
`!p comment=Comment()
snip.rv=comment.before()`TODO${1/.+/(/}$1${1/.+/)/}: $0`!p snip.rv=comment.after()`
endsnippet
snippet fixme "FIXME comment"
`!p comment=Comment();snip.rv=comment.before()`FIXME${1/.+/(/}$1${1/.+/)/}: $0`!p snip.rv=comment.after()`
`!p comment=Comment()
snip.rv=comment.before()`FIXME${1/.+/(/}$1${1/.+/)/}: $0`!p snip.rv=comment.after()`
endsnippet
snippet note "NOTE comment"
`!p comment=Comment();snip.rv=comment.before()`NOTE: $0`!p snip.rv=comment.after()`
`!p comment=Comment()
snip.rv=comment.before()`NOTE: $0`!p snip.rv=comment.after()`
endsnippet
global !p

View File

@@ -1,3 +1,13 @@
snippet _template "help file template"
*`!p snip.rv = snip.fn`* For Vim version 8.0 Last change: `!p
from datetime import datetime
snip.rv = datetime.now().strftime('%B %d, %Y')`
$0
vim:tw=78:ts=8:ft=help:norl:
endsnippet
snippet s "help section"
==============================================================================
${1:1}. ${2:Section}`!p

View File

@@ -3,15 +3,20 @@ snippet #! "Shebang"
endsnippet
snippet main "Python main stub"
from argparse import ArgumentParser
def main():
${0:pass}
parser = ArgumentParser()
parser.add_argument('${0:argument}')
args = parser.parse_args()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
exit(130)
pass
endsnippet
snippet debug "Set ipdb breakpoint"

View File

@@ -1,5 +1,6 @@
function! s:set_lit_cfg_filetype()
set filetype=python
ALEDisableBuffer
endfunction
au BufNewFile,BufReadPost lit.cfg call s:set_lit_cfg_filetype()

View File

@@ -9,6 +9,8 @@ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
setlocal commentstring=//%s
" Stop automatic new lines which typing long single liners.
setlocal textwidth=0
" Map K to get YouCompleteMe documentation.
nnoremap K :YcmCompleter GetDoc<CR>
" "ys{motion}t" turns "word" -> "TODO(word):"
let b:surround_{char2nr("t")} = "TODO(\r):"
" "ys{motion}/" turns "text" into "/*text*/"

View File

@@ -1 +0,0 @@
vim.bo.commentstring = '//%s'

View File

@@ -45,7 +45,7 @@ if exists('g:c_doxygen') && g:c_doxygen
" Match: @param name description. @retval name description.
" ^^^^ ^^^^
syn region cDoxygenSpecial matchgroup=cDoxygenComment start='@\(param\(\[\(\|in\|out\|in,out\)\]\)\?\|retval\)\=\s\+' end='\(\s\|$\)' contained display
syn region cDoxygenSpecial matchgroup=cDoxygenComment start='@\(param\(\[\(\|in\|out\|in,out\)\]\)\|retval\)\=\s\+' end='\(\s\|$\)' contained display
" Match: @tparam name description.
" ^^^^

View File

@@ -1,4 +1,3 @@
hi link jsonKeyword Function
hi link jsonNull Constant
hi link jsonQuote Delimiter
setlocal conceallevel=0

View File

@@ -10,26 +10,12 @@ function! build#dir(...) abort
let l:dir = s:dirs[0]
unlet s:dirs
else
" Multiple build directories found, select one.
if exists('*popup_menu')
" Create popup menu to select the build directory. Callback to this
" function on completion, handled in the else branch below.
call popup_menu(s:dirs, #{
\ filter: 'popup_filter_menu',
\ callback: 'build#dir',
\ })
else
" Fallback to inputlist when popup_menu is not available.
let l:choices = []
let l:index = 1
for l:dir in s:dirs
call add(l:choices, string(l:index).': '.l:dir)
let l:index += 1
endfor
let l:index = inputlist(l:choices)
let l:dir = s:dirs[l:index - 1]
echomsg ' '.l:dir
endif
" Multiple build directories found, create popup menu to select one.
" Set the callback to this function on completion, handled below.
call popup_menu(s:dirs, #{
\ filter: 'popup_filter_menu',
\ callback: 'build#dir',
\ })
endif
else
if a:0 == 1
@@ -49,30 +35,17 @@ function! build#dir(...) abort
endif
endif
if exists('l:dir')
" Set build directory.
let l:cwd = substitute(getcwd(), '\\', '\/', 'g')
let $BUILD_DIR = l:cwd.'/'.substitute(l:dir, '\/$', '', '')
if executable('compdb')
" Post-process compile_commands.json with compdb, adds header files to
" missing compile_commands.json for more accurate diagnostics.
let l:database_dir = l:cwd.'/.vim'
let l:compile_commands = l:database_dir.'/compile_commands.json'
call systemlist('compdb -p '.$BUILD_DIR.' list > '.l:compile_commands)
else
let l:database_dir = $BUILD_DIR
endif
" Read/create .vim/coc-settings.json
" Set build directory and restart YouCompleteMe.
let $BUILD_DIR = getcwd().'/'.substitute(l:dir, '\/$', '', '')
let l:coc_settings = {}
if isdirectory('.vim')
let l:coc_settings = json_decode(join(readfile('.vim/coc-settings.json'), ''))
else
call mkdir('.vim')
endif
" Update .vim/coc-settings.json with new build directory.
let l:coc_settings['clangd.compilationDatabasePath'] = l:database_dir
let l:coc_settings['clangd.compilationDatabasePath'] = $BUILD_DIR
let l:coc_settings['cmake.lsp.buildDirectory'] = $BUILD_DIR
call writefile([json_encode(l:coc_settings)], '.vim/coc-settings.json')
" Finally restart coc.nvim with new config.
CocRestart
endif
endfunction

View File

@@ -2,7 +2,6 @@ if !has('pythonx')
finish
endif
" set debug=msg,throw
pythonx import format
function! format#clang_format() abort

16
autoload/snippet.vim Normal file
View File

@@ -0,0 +1,16 @@
" Description: Expand snippet on file creation.
" Attempt to expand the _template snippet if this is a new file.
" https://noahfrederick.com/log/vim-templates-with-ultisnips-and-projectionist
function! snippet#template() abort
" Return if non-empty buffer or file exists.
if !(line('$') == 1 && getline('$') ==# '') || filereadable(expand('%'))
return
endif
" Attempt to expand the _template snippet.
execute "normal! i_template\<C-r>=UltiSnips#ExpandSnippet()\<CR>"
if g:ulti_expand_res == 0
" Expansions failed, undo insert.
silent! undo
endif
endfunction

View File

@@ -16,6 +16,6 @@ function! tmux#isOption(option, value) abort
if !tmux#inSession()
return 0
endif
let l:option = trim(system('tmux show-options -g '.a:option))
return l:option ==# a:option.' '.a:value
let l:set_clipboard = trim(system('tmux show-options -g '.a:option))
return l:set_clipboard ==# 'set-clipboard '.a:value
endfunction

View File

@@ -1,3 +0,0 @@
function! wsl#isDetected() abort
return $WSLENV !=# ''
endfunction

View File

@@ -1,81 +1 @@
{
"cmake.lsp.enable": true,
"diagnostic.enableHighlightLineNumber": false,
"diagnostic.errorSign": "▸",
"diagnostic.hintSign": "▸",
"diagnostic.infoSign": "▸",
"diagnostic.warningSign": "▸",
"inlayHint.enable": false,
"powershell.integratedConsole.showOnStartup": false,
"snippets.priority": 100,
"suggest.noselect": true,
"yaml.schemas": {
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json": [
".gitlab-ci.yml",
".gitlab/ci.yml",
".gitlab/ci/*.yml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json": [
".ansible-lint",
".config/ansible-lint.yml",
".config/ansible-lint.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-navigator.json": [
"ansible-navigator.yml",
"ansible-navigator.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json": [
"execution-environment.yml",
"execution-environment.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/galaxy.json": [
"galaxy.yml",
"galaxy.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json": [
"inventory.yaml",
"inventory.yml",
"inventory/*.yml",
"inventory/*.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta-runtime.json": [
"meta/runtime.yml",
"meta/runtime.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/molecule.json": [
"molecule/*/molecule.yml",
"molecule/*/molecule.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/playbook.json": [
"playbooks/*.yml",
"playbooks/*.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/requirements.json": [
"requirements.yml",
"requirements.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/rulebook.json": [
"rulebooks/*.yml",
"rulebooks/*.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/tasks.json": [
"tasks/*.yml",
"tasks/*.yaml",
"handlers/*.yml",
"handlers/*.yaml"
],
"https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/vars.json": [
"playbooks/vars/*.yml",
"playbooks/vars/*.yaml",
"vars/*.yml",
"vars/*.yaml",
"defaults/*.yml",
"defaults/*.yaml",
"host_vars/*.yml",
"host_vars/*.yaml",
"group_vars/*.yml",
"group_vars/*.yaml"
]
},
"snippets.ultisnips.pythonPrompt": false
}
{"cmake.lsp.enable": true}

View File

@@ -126,9 +126,7 @@ if has('gui_running') || &t_Co == 256
call s:hi('SpellLocal', '5', '', '')
call s:hi('SpellRare', '3', '', '')
call s:hi('StatusLine', '15', '233', '')
call s:hi('StatusLineTerm', '15', '233', '')
call s:hi('StatusLineNC', '', '235', '')
call s:hi('StatusLineTermNC', '', '235', '')
call s:hi('TabLine', '246', '235', 'bold')
call s:hi('TabLineFill', '', '235', '')
call s:hi('TabLineSel', '248', '', 'bold')
@@ -187,10 +185,6 @@ if has('gui_running') || &t_Co == 256
call s:hi('Todo', '202', '', 'bold')
"" }}}
"" NVIM Groups {{
call s:hi('NormalFloat', '', '235', '')
"" }}
"" Terminal Groups {{{
call s:hi('debugBreakpoint', '1', '', 'reverse')
call s:hi('debugPC', '25', '', 'reverse')
@@ -202,15 +196,10 @@ if has('gui_running') || &t_Co == 256
call s:hi('Important', '220', '', 'bold')
call s:hi('Research', '202', '', 'bold')
call s:hi('CocErrorSign', '160', '233', '')
call s:hi('CocErrorFloat', '160', '235', '')
call s:hi('CocWarningSign', '129', '233', '')
call s:hi('CocWarningFloat', '129', '235', '')
call s:hi('CocInfoSign', '8', '233', '')
call s:hi('CocInfoFloat', '8', '235', '')
call s:hi('CocHintSign', '33', '233', '')
call s:hi('CocHintFloat', '33', '235', '')
call s:hi('CocInlayHint', '8', '', '')
call s:hi('ALEError', '160', '', '')
call s:hi('ALEWarning', '129', '', '')
call s:hi('ALEErrorSign', '160', '233', 'bold')
call s:hi('ALEWarningSign', '129', '233', 'bold')
call s:hi('SyntasticErrorSign', '160', '233', 'bold')
call s:hi('SyntasticWarningSign', '129', '233', 'bold')

View File

@@ -1 +0,0 @@
autocmd BufNewFile,BufReadPost */requirements.txt set filetype=requirements

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,6 +1,3 @@
" Add <> to % matches
setlocal matchpairs+=<:>
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#clang_format()
if exists('*format#clang_format')
set formatexpr=format#clang_format()
endif

View File

@@ -1,3 +1,3 @@
if has('pythonx')
setlocal formatexpr=format#yapf()
if exists('*format#yapf')
set formatexpr=format#yapf()
endif

View File

@@ -1 +0,0 @@
set commentstring=#%s

View File

@@ -1,8 +0,0 @@
if exists(':GuiFont')
GuiFont! CaskaydiaCove\ Nerd\ Font\ Mono:h9
endif
if exists(':GuiTabline')
" Don't use GUI tabline, matches terminal tabline.
GuiTabline 0
endif

2
gvimrc
View File

@@ -6,7 +6,7 @@
set guioptions=aegi
if platform#is_windows()
set guifont=Source\ Code\ Pro:h10
set guifont=Consolas:h10:cDEFAULT
else
" Set default font
set guifont=Source\ Code\ Pro\ Medium\ 9

View File

@@ -1 +0,0 @@
runtime vimrc

1
init.vim Symbolic link
View File

@@ -0,0 +1 @@
vimrc

View File

@@ -1,28 +0,0 @@
---
- name: nodejs get json containing latest version
uri:
url: https://nodejs.org/dist/index.json
register: latest
- name: nodejs create directory for downloaded package
file:
state: directory
dest: ~/.local/src
- name: nodejs download latest package
get_url:
url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz'
dest: ~/.local/src/node.tar.gz
- name: nodejs extract downloaded package
unarchive:
src: ~/.local/src/node.tar.gz
dest: ~/.local/src
remote_src: true
- name: nodejs create symlink links
file:
state: link
src: '~/.local/src/node-{{latest.json[0].version}}-linux-x64/bin/{{item}}'
dest: '~/.local/bin/{{item}}'
with_items: [corepack, node, npm, npx]

View File

@@ -12,12 +12,19 @@ augroup benieAugroup
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\ | exe "normal! g'\"" | endif
" Highlight conflict markers in any filetype
au FileType * call matchadd('Todo', '^\(<<<<<<<\s.*\||||||||\|=======\|>>>>>>>\s.*\)$')
" Update `Last change: <date>` on write & go back previous cursor position
au FileType help au BufWritePre <buffer>
\ 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e|norm!``
" Read template into buffer then send line 1 to the black hold register
au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _
" Attempt to expand snippet named `_template` if it exists
au BufNewFile * silent! call snippet#template()
" Do the same when filetype changes to help
au FileType help silent! call snippet#template()
" Augment vim-signify by modifying it's autocmds
au User SignifyAutocmds call do#signify()

View File

@@ -8,5 +8,7 @@ if !platform#is_windows() &&
echo "Setup the shell to do something similar on load"
echo "env TERM=xterm-256color /usr/bin/zsh"
endif
colorscheme fresh
if !platform#is_windows() || has("gui_running")
colorscheme fresh
endif
syntax sync minlines=1000

View File

@@ -1,3 +1,11 @@
" minpac
function! s:minpac_init() abort
packadd minpac | call minpac#init() | source $MYVIMRC
endfunction
command! PackUpdate call s:minpac_init() | call minpac#update('', {'do': 'call minpac#status()'})
command! PackStatus call s:minpac_init() | call minpac#status()
command! PackClean call s:minpac_init() | call minpac#clean()
" Sort Python Imports
command! ISort call do#isort()

View File

@@ -1,14 +1,10 @@
" coc.nvim
inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<TAB>"
nnoremap <silent> <leader>fi <Plug>(coc-fix-current)
nnoremap <silent> <leader>gd <Plug>(coc-definition)
nnoremap <silent> <leader>gt <Plug>(coc-type-definition)
nnoremap <silent> <leader>sd <Plug>(coc-diagnostic-info)
nnoremap <silent> <leader>gr <Plug>(coc-references)
nnoremap <silent> <leader>gu <Plug>(coc-references-used)
nnoremap <silent> K :call do#show_documentation()<CR>
nnoremap <silent> <C-n> <Plug>(coc-diagnostic-next)
nnoremap <silent> <C-p> <Plug>(coc-diagnostic-prev)
if has('nvim')
" Make nvim :terminal more like vim :terminal
@@ -24,6 +20,10 @@ tnoremap <C-G> :Gdb<CR>
tnoremap <C-E> :Program<CR>
tnoremap <C-S> :Source<CR>
" GitGutter
nnoremap <leader>gn :GitGutterNextHunk<CR>
nnoremap <leader>gp :GitGutterPrevHunk<CR>
" Quickfix list
nnoremap <leader>qo :copen<CR>
nnoremap <leader>qc :cclose<CR>
@@ -66,31 +66,24 @@ nnoremap k gk
nnoremap <leader>w :w!<CR>
" Switch panes in a tmux aware way
if !tmux#inSession() || has('win32')
nnoremap <silent> <C-h> <C-w>h
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-l> <C-w>l
nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <C-j> :TmuxNavigateDown<CR>
nnoremap <silent> <C-k> :TmuxNavigateUp<CR>
nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
nnoremap <silent> <C-w>h :TmuxNavigateLeft<CR>
nnoremap <silent> <C-w>j :TmuxNavigateDown<CR>
nnoremap <silent> <C-w>k :TmuxNavigateUp<CR>
nnoremap <silent> <C-w>l :TmuxNavigateRight<CR>
if has('nvim')
tnoremap <silent> <C-w>h <C-\><C-n>:TmuxNavigateLeft<CR>
tnoremap <silent> <C-w>j <C-\><C-n>:TmuxNavigateDown<CR>
tnoremap <silent> <C-w>k <C-\><C-n>:TmuxNavigateUp<CR>
tnoremap <silent> <C-w>l <C-\><C-n>:TmuxNavigateRight<CR>
else
nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
nnoremap <silent> <C-j> :TmuxNavigateDown<CR>
nnoremap <silent> <C-k> :TmuxNavigateUp<CR>
nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
nnoremap <silent> <C-w>h :TmuxNavigateLeft<CR>
nnoremap <silent> <C-w>j :TmuxNavigateDown<CR>
nnoremap <silent> <C-w>k :TmuxNavigateUp<CR>
nnoremap <silent> <C-w>l :TmuxNavigateRight<CR>
if has('nvim')
tnoremap <silent> <C-w>h <C-\><C-n>:TmuxNavigateLeft<CR>
tnoremap <silent> <C-w>j <C-\><C-n>:TmuxNavigateDown<CR>
tnoremap <silent> <C-w>k <C-\><C-n>:TmuxNavigateUp<CR>
tnoremap <silent> <C-w>l <C-\><C-n>:TmuxNavigateRight<CR>
else
tnoremap <silent> <C-w>h <C-w>N:TmuxNavigateLeft<CR>
tnoremap <silent> <C-w>j <C-w>N:TmuxNavigateDown<CR>
tnoremap <silent> <C-w>k <C-w>N:TmuxNavigateUp<CR>
tnoremap <silent> <C-w>l <C-w>N:TmuxNavigateRight<CR>
endif
tnoremap <silent> <C-w>h <C-w>N:TmuxNavigateLeft<CR>
tnoremap <silent> <C-w>j <C-w>N:TmuxNavigateDown<CR>
tnoremap <silent> <C-w>k <C-w>N:TmuxNavigateUp<CR>
tnoremap <silent> <C-w>l <C-w>N:TmuxNavigateRight<CR>
endif
" Quick tabs
@@ -117,10 +110,6 @@ else
noremap <leader>p "+p
noremap <leader>P "+P
endif
if has('nvim-0.5.2')
" Undo neovim's default mapping of Y to y$
unmap Y
endif
" Quickly access spelling menu
inoremap <C-s> <C-g>u<C-X>s

View File

@@ -112,8 +112,6 @@ set isfname-=:
set hlsearch incsearch
" Set ignore search case unless mixed
set ignorecase smartcase
" Don't ignore case in command line file completions
set nofileignorecase
" Allow buffers with changes to be hidden
set hidden
@@ -154,7 +152,11 @@ set formatoptions+=rq
" Always show the signcolum
if exists('&signcolumn')
set signcolumn=yes
try
set signcolumn=number
catch /E474/
set signcolumn=yes
endtry
endif
" Enable modeline
@@ -174,7 +176,7 @@ if &t_Co == 8 && $TERM !~# '^linux\|^Eterm'
endif
" Change cursor dependant on current mode
if !has('nvim') && has('cursorshape') && has('unix') && !has('gui_running')
if has('cursorshape') && has('unix') && !has('gui_running')
if $TMUX ==# '' && $ITERM_PROFILE !=# ''
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"

View File

@@ -1,23 +1,21 @@
" Show the statusline above the commandline.
scriptencoding utf-8
set laststatus=2
" Define color variables.
let g:statusline#light_green = {'fg': ['235', '#262626'], 'bg': [ '35', '#00af5f']}
let g:statusline#light_blue = {'fg': ['235', '#262626'], 'bg': [ '33', '#0087ff']}
let g:statusline#light_orange = {'fg': ['235', '#262626'], 'bg': ['209', '#ff875f']}
let g:statusline#light_red = {'fg': ['235', '#262626'], 'bg': ['124', '#af0000']}
let g:statusline#light_grey = {'fg': ['235', '#262626'], 'bg': ['246', '#949494']}
let g:statusline#light_violet = {'fg': ['235', '#262626'], 'bg': [ '99', '#875fff']}
let g:statusline#light_green = {'fg': ['235', '#080808'], 'bg': [ '35', '#0087ff']}
let g:statusline#light_blue = {'fg': ['235', '#080808'], 'bg': [ '33', '#0087ff']}
let g:statusline#light_orange = {'fg': ['235', '#080808'], 'bg': ['209', '#eb754d']}
let g:statusline#light_red = {'fg': ['235', '#080808'], 'bg': ['124', '#af0000']}
let g:statusline#light_grey = {'fg': ['250', "#bcbcbc"], 'bg': ['236', "#303030"]}
let g:statusline#light_violet = {'fg': ['235', '#080808'], 'bg': [ '99', '#986fec']}
let g:statusline#dark_white = {'fg': [ '15', '#ffffff'], 'bg': ['233', '#121212']}
let g:statusline#dark_yellow = {'fg': ['179', '#dfaf5f'], 'bg': ['233', '#121212']}
let g:statusline#dark_grey = {'fg': ['244', '#808080'], 'bg': ['233', '#121212']}
" Create highlight groups.
function! s:hi(group, color) abort
execute 'highlight '.a:group
\.' ctermfg='.a:color['fg'][0].' ctermbg='.a:color['bg'][0]
\.' guifg='.a:color['fg'][1].' guibg='.a:color['bg'][1]
\.' guifg='.a:color['fg'][1].' guibg='.a:color['fg'][1]
endfunction
" StatusLineLight is shows the mode and cursor information, it is dynamically
@@ -29,12 +27,9 @@ call s:hi('StatusLineDusk', g:statusline#light_grey)
" StatusLineDark shows the filename and filetype and takes up most of the
" statusline, give it a dark background.
call s:hi('StatusLineDark', g:statusline#dark_white)
" StatusLineChange shows changes in the file by changing the colour of the
" StatusLineChange show changes in the file by changing the colour of the
" filename, give if a dark background.
call s:hi('StatusLineChange', g:statusline#dark_yellow)
" StatusLineFade shows the status of completion engines but using colors which
" fade into the background to avoid grabbing attention.
call s:hi('StatusLineDuskFade', g:statusline#dark_grey)
" Construct a statusline for special buffer types.
function! statusline#special(group, name, title)
@@ -49,7 +44,7 @@ function! statusline#special(group, name, title)
endfunction
" Construct a statusline for generic buffer types.
function! statusline#generic(group, mode, coc)
function! statusline#generic(group, mode)
" Display current mode with dynamic highlights.
let l:mode = '%#'.a:group.'# '.a:mode.' '
" Display spell or paste if set with dusk highlights in a group to swallow
@@ -59,17 +54,11 @@ function! statusline#generic(group, mode, coc)
\.'%{&paste ? "Paste " : ""}'
\.'%)'
" Display filename with dark or changed highlights.
let l:file = (&modified ? '%#StatusLineChange#' : '%#StatusLineDark#').' %<%f'
let l:file = (&modified ? '%#StatusLineChange#' : '%#StatusLineDark#').' %f'
" Display readonly and nomodifiable if set.
let l:state = '%#StatusLineDark#'
\.'%{&readonly ? " 🔒" : ""}'
\.'%{&modifiable ? "" : " ⛔"}'
if a:coc && exists('*coc#status')
" Display coc.nvim status.
let l:coc = '%#StatusLineDuskFade#%( %{coc#status()}%)'
else
let l:coc = ''
endif
" Display filetype if set.
let l:type = '%#StatusLineDark# %{&filetype} '
" Display fileencoding if not utf-8 and fileformat if not unix with dusk
@@ -81,7 +70,7 @@ function! statusline#generic(group, mode, coc)
" Display current/total lines and column with dynamic highlights.
let l:line = '%#'.a:group.'# ☰ %l/%L ㏑%2c '
" Combine the elements into a single string to be evaluated.
return l:mode.l:edit.l:file.l:state.l:coc.'%='.l:type.l:format.l:line
return l:mode.l:edit.l:file.l:state.'%='.l:type.l:format.l:line
endfunction
" Define active statusline, this statusline is dynamic with StatusLineLight
@@ -108,11 +97,11 @@ function! statusline#active()
if l:mode ==# 'Normal'
let l:mode = 'Preview'
endif
return statusline#generic('StatusLineLight', l:mode, v:false)
return statusline#generic('StatusLineLight', l:mode)
elseif &filetype ==# 'man'
return statusline#special('StatusLineDusk', 'Manual', '%f')
endif
return statusline#generic('StatusLineLight', l:mode, v:true)
return statusline#generic('StatusLineLight', l:mode)
endfunction
" Define inactive statusline, this remains static until the buffer gains
@@ -130,11 +119,11 @@ function! statusline#inactive()
elseif &buftype ==# 'terminal'
let l:statusline = statusline#special('StatusLineDusk', 'Terminal', '%f')
elseif &previewwindow
let l:statusline = statusline#generic('StatusLineDusk', 'Preview', v:false)
let l:statusline = statusline#generic('StatusLineDusk', 'Preview')
elseif &filetype ==# 'man'
let l:statusline = statusline#special('StatusLineDusk', 'Manual', '%f')
else
let l:statusline = statusline#generic('StatusLineDusk', 'Idle', v:false)
let l:statusline = statusline#generic('StatusLineDusk', 'Idle')
endif
" Escape spaces and double quotes for use in setlocal.
let l:statusline = substitute(l:statusline, '\([ "]\)', '\\\0', 'g')

Binary file not shown.

View File

@@ -1,11 +0,0 @@
if exists('b:current_syntax')
finish
endif
highlight default link requirementsComment Comment
highlight default link requirementsVersion Identifier
highlight default link requirementsOperator Operator
syntax region requirementsComment start='^\w*#' end='$' contains=@Spell
syntax match requirementsVersion '\d\+\.\d\+\.\d\+\w*'
syntax match requirementsOperator '=='

View File

@@ -1,121 +0,0 @@
---
- set_fact:
plugin_dir: '{{vim_config_dir}}/pack/managed'
plugins:
# ====================== Completion & Diagnostics ========================
# Conqueror of Completion
- repo: neoclide/coc.nvim
branch: release
# Snippet collection
- repo: honza/vim-snippets
# Completion for vimscript
- repo: vim-scripts/vimomni
mode: opt
# Version control differences in the sign column
- repo: mhinz/vim-signify
# Conflict marker utilities
- repo: rhysd/conflict-marker.vim
# Doxygen documentation stubs
- repo: vim-scripts/DoxygenToolkit.vim
mode: opt
# Easy table manipulation
- repo: dhruvasagar/vim-table-mode
# =========================== User Interface =============================
# Sanley numbered tabs in tabline
- repo: mkitt/tabline.vim
# Fuzzy finder
# TODO: Still necessary?
- repo: junegunn/fzf
- repo: junegunn/fzf.vim
# Replay macros with the enter key
- repo: wincent/replay
# Improved % matching
- repo: andymass/vim-matchup
# Forgot about this...
- repo: kbenzie/note.vim
# View term and hex colors
- repo: guns/xterm-color-table.vim
# ============================== Text Objects ============================
# Library for creating text objects
- repo: kana/vim-textobj-user
# TODO: Doesn't work with nvim
- repo: kana/vim-textobj-entire
# Text object for URI's
- repo: jceb/vim-textobj-uri
# Text object for comment blocks
- repo: glts/vim-textobj-comment
# Text object for sentences
- repo: reedes/vim-textobj-sentence
# Text object & bindings for arguments
- repo: PeterRincker/vim-argumentative
# ================================ Tim Pope ==============================
# Toggle comments
- repo: tpope/vim-commentary
# Edit delimiters
- repo: tpope/vim-surround
# Better dot command
- repo: tpope/vim-repeat
# Git wrapper
- repo: tpope/vim-fugitive
# Unix command warppers
- repo: tpope/vim-eunuch
# Improved directory browser
- repo: tpope/vim-vinegar
# PascalCase to under_score to camelCase
# TODO: Copy the good bit remove this plugin
- repo: tpope/vim-abolish
# Mappings for pairs of tasks
- repo: tpope/vim-unimpaired
# Sane date manipulation
- repo: tpope/vim-speeddating
# Wisely add end{if,function} fork with cmake support
- repo: godbyk/vim-endwise
branch: patch-1
# Text object & formatting for json
- repo: tpope/vim-jdaddy
# Granular project configuration
- repo: tpope/vim-projectionist
# ================================ tmux ==================================
# Seemless vim/tmux pane navigation
- repo: 'christoomey/vim-tmux-navigator'
mode: opt
# Enable focus events when in tmux session
- repo: 'tmux-plugins/vim-tmux-focus-events'
mode: opt
# =============================== Syntax =================================
- repo: editorconfig/editorconfig-vim
- repo: kalekundert/vim-coiled-snake
- repo: kbenzie/vim-spirv
- repo: rperier/vim-cmake-syntax
- repo: tikhomirov/vim-glsl
- repo: beyondmarc/hlsl.vim
- repo: frasercrmck/opencl.vim
- repo: asciidoc/vim-asciidoc
- repo: mustache/vim-mustache-handlebars
- repo: joshglendenning/vim-caddyfile
- repo: kbenzie/vim-khr
- repo: jrozner/vim-antlr
- repo: sophacles/vim-bundle-mako
- repo: Glench/Vim-Jinja2-Syntax
- name: remove minpac directory
when: ansible_os_family != "Windows"
file:
path: '{{vim_config_dir}}/pack/minpac'
state: absent
- name: remove minpac directory
when: ansible_os_family == "Windows"
win_file:
path: '{{vim_config_dir}}/pack/minpac'
state: absent

226
vimrc
View File

@@ -11,21 +11,140 @@ if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
if exists('*minpac#init')
" When minpac is loaded define the Pack command to add packages.
command! -nargs=+ Pack call minpac#add(<args>)
else
" Otherwise define the Pack command to do nothing.
command! -nargs=+ Pack
endif
" Append work config to runtimepath and packpath.
set runtimepath+=~/.config/work
set packpath+=~/.config/work
" Disable unused providers
let g:loaded_node_provider = 0
let g:loaded_perl_provider = 0
let g:loaded_ruby_provider = 0
" tabline.vim - sanely numbered tabs
Pack 'mkitt/tabline.vim'
" Markdown fenced code block languages
" coc.nvim Conqueror of Completion
Pack 'neoclide/coc.nvim', {'branch': 'release'}
let g:coc_global_extensions = [
\ 'coc-clangd',
\ 'coc-cmake',
\ 'coc-css',
\ 'coc-html',
\ 'coc-json',
\ 'coc-marketplace',
\ 'coc-pyls',
\ 'coc-ultisnips',
\ 'coc-vimlsp',
\ 'coc-yaml',
\]
" ultisnips - snippet engine
Pack 'SirVer/ultisnips'
Pack 'honza/vim-snippets'
" vimomni - Completion for vimscript
Pack 'vim-scripts/vimomni', {'type': 'opt'}
" ale - Asynchronous Lint Engine
Pack 'w0rp/ale'
let g:ale_sign_error = '▸'
let g:ale_sign_warning = '▸'
let g:ale_echo_msg_format = '[%linter%] %s (%code%)'
let g:ale_linters = {'c': [], 'cpp': []}
let g:ale_cmake_cmakelint_options =
\ '-convention/filename,-package/consistency,-package/stdargs'
" Version control differences in the sign column
Pack 'mhinz/vim-signify'
" vim-textobj-user - library for creating text objects
Pack 'kana/vim-textobj-user'
" vim-textobj-entire - Entire file text object
let g:textobj_entire_no_default_key_mappings = 1
Pack 'kana/vim-textobj-entire'
xmap a% <Plug>(textobj-entire-a)
omap a% <Plug>(textobj-entire-a)
xmap i% <Plug>(textobj-entire-i)
omap i% <Plug>(textobj-entire-i)
" vim-textobj-parameter - Parameter text object
Pack 'sgur/vim-textobj-parameter'
" vim-textobj-uri - URI text object
Pack 'jceb/vim-textobj-uri'
" vim-textobj-comment - Comment text object
Pack 'glts/vim-textobj-comment'
omap a/ <Plug>(textobj-comment-a)
xmap a/ <Plug>(textobj-comment-a)
omap i/ <Plug>(textobj-comment-i)
xmap i/ <Plug>(textobj-comment-i)
" vim-textobj-sentence - Improved sentence text object
Pack 'reedes/vim-textobj-sentence'
" vim-commentary - toggle comments
Pack 'tpope/vim-commentary'
" vim-surround - edit delimiters
Pack 'tpope/vim-surround'
" vim-repeat - better dot command
Pack 'tpope/vim-repeat'
" vim-fugitive - git wrapper
Pack 'tpope/vim-fugitive'
" vim-eunuch - unix command warppers
Pack 'tpope/vim-eunuch'
" vim-vinegar - improved directory browser
Pack 'tpope/vim-vinegar'
" vim-abolish - CamelCase to under_score to mixedCase
" TODO: Copy the good bit remove this plugin
Pack 'tpope/vim-abolish'
" vim-unimpaired - for pairs of tasks
Pack 'tpope/vim-unimpaired'
" vim-speeddating - sane date manipulation
Pack 'tpope/vim-speeddating'
" vim-endwise - wisely add end{if,function}, fork with cmake support
Pack 'godbyk/vim-endwise', {'rev': 'patch-1'}
" vim-jdaddy - text object & formatting for json
Pack 'tpope/vim-jdaddy'
" vim-projectionist - granular project configuration
Pack 'tpope/vim-projectionist'
" fzf.vim - Fuzzy finder
Pack 'junegunn/fzf'
Pack 'junegunn/fzf.vim'
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\ }
Pack 'kbenzie/note.vim'
let g:note_directory = '~/Sync/Notes'
if !has('win32')
" Seemless vim/tmux pane navigation
Pack 'christoomey/vim-tmux-navigator'
let g:tmux_navigator_no_mappings = 1
" Enable focus events when in tmux session
Pack 'tmux-plugins/vim-tmux-focus-events'
endif
" replay macros with the enter key
Pack 'wincent/replay'
" vim-matchit - Improved % matching
Pack 'andymass/vim-matchup'
let g:matchup_matchparen_offscreen = {'method': 'status_manual'}
" vim-table-mode - Easy table manipulation
Pack 'dhruvasagar/vim-table-mode'
let g:table_mode_map_prefix = '<leader>t'
let g:table_mode_toggle_map = 'M'
" DoxygenToolkit.vim - documentation stubs
Pack 'vim-scripts/DoxygenToolkit.vim', {'type': 'opt'}
let g:DoxygenToolkit_commentType = 'C++'
" markdown fenced code block languages
let g:markdown_fenced_languages =
\ ['cpp', 'c', 'cmake', 'console', 'sh', 'vim', 'python', 'yaml']
" reStructedText enable code styles
let g:rst_style = 1
" reStructuredText code block languages
let g:rst_syntax_code_list = {
\ 'vim': ['vim'],
@@ -36,81 +155,28 @@ let g:rst_syntax_code_list = {
\ 'python': ['python']
\ }
" Python folding
Pack 'kalekundert/vim-coiled-snake'
" reStructedText
let g:rst_style = 1
" Enable builtin syntax folding
let g:xml_syntax_folding = 1
let g:sh_fold_enabled = 1
if wsl#isDetected()
" Make gx work in WSL
let g:netrw_browsex_viewer='cmd.exe /C start'
endif
" xterm-color-table.vim - view term and hex colors
Pack 'guns/xterm-color-table.vim'
if tmux#inSession()
" Seemless vim/tmux pane navigation
packadd vim-tmux-navigator
let g:tmux_navigator_no_mappings = 1
" Enable focus events when in tmux session
packadd vim-tmux-focus-events
endif
" coc.nvim
let g:coc_global_extensions = [
\ 'coc-clangd',
\ 'coc-cmake',
\ 'coc-css',
\ 'coc-docker',
\ 'coc-html',
\ 'coc-jedi',
\ 'coc-json',
\ 'coc-marketplace',
\ 'coc-pyright',
\ 'coc-snippets',
\ 'coc-vimlsp',
\ 'coc-yaml',
\]
if has("win32")
let g:coc_global_extensions += [
\ 'coc-powershell'
\]
endif
let g:coc_default_semantic_highlight_groups = 0
" vim-signify
let g:signify_sign_change = '~'
" vim-textobj-entire
let g:textobj_entire_no_default_key_mappings = 1
xmap a% <Plug>(textobj-entire-a)
omap a% <Plug>(textobj-entire-a)
xmap i% <Plug>(textobj-entire-i)
omap i% <Plug>(textobj-entire-i)
" vim-textobj-comment
omap a/ <Plug>(textobj-comment-a)
xmap a/ <Plug>(textobj-comment-a)
omap i/ <Plug>(textobj-comment-i)
xmap i/ <Plug>(textobj-comment-i)
" fzf.vim
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\ }
" note.vim
let g:note_directory = '~/Sync/Notes'
" vim-matchit
let g:matchup_matchparen_offscreen = {'method': 'status_manual'}
" vim-table-mode
let g:table_mode_map_prefix = '<leader>t'
let g:table_mode_toggle_map = 'M'
" DoxygenToolkit.vim
let g:DoxygenToolkit_commentType = 'C++'
" vim-spirv
let g:spirv_enable_current_id = 0
let g:spirv_enable_extinst_error = 0
" Syntax plugins
Pack 'kbenzie/vim-spirv'
let g:spirv_current_id_highlight = 'ctermbg=234, guibg=#1c1c1c'
Pack 'rperier/vim-cmake-syntax'
Pack 'tikhomirov/vim-glsl'
Pack 'beyondmarc/hlsl.vim'
Pack 'frasercrmck/opencl.vim'
Pack 'asciidoc/vim-asciidoc'
Pack 'mustache/vim-mustache-handlebars'
Pack 'joshglendenning/vim-caddyfile'
Pack 'kbenzie/vim-khr'
Pack 'jrozner/vim-antlr'