Compare commits

...

126 Commits

Author SHA1 Message Date
00e30facd3 Disable Node, Perl, and Ruby providers
I never used these so disable attempting to load them.
2024-03-02 10:48:07 +00:00
e378b83549 Update nvim-qt GuiFont setting 2023-12-09 11:09:32 +00:00
1de326471c Switch to vim-argumentative, remove vim-textobj-parameter 2023-11-23 23:22:15 +00:00
aab402fa73 Disable vim-spirv settings that are slow in large files 2023-09-13 16:50:59 +01:00
586141cb14 Fix todo (and other) snippets
coc-snippets stopped accepting the multiline python code in the todo
(and other) snippets, this fixes an `UnexpectedIndentation` exception.
2023-07-27 17:53:20 +01:00
f8407f959f Fix cpp commentstring, its a lua setting now... 2023-07-16 18:43:13 +01:00
97c7c974cf Add plugin Vim-Jinja2-Syntax 2023-06-28 14:08:14 +01:00
35acaa6cb2 Don't prompt for ultisnips in coc.nvim 2023-06-16 10:18:41 +01:00
3334451c2a Add workaround for coc-yaml's Ansible failings 2023-04-25 20:55:31 +01:00
d29cfc6aab Remove support for _template snippets 2023-03-30 15:28:42 +01:00
024268db74 Remove argparse from Python main snippet 2023-03-30 15:01:53 +01:00
0c515161b0 Add coc.nvim mapping for references used 2023-02-15 16:58:03 +00:00
525f6c2a5f Add editorconfig plugin 2023-02-15 16:57:39 +00:00
0d4dab892e Don't ignore case in command line file completions 2023-01-26 17:52:11 +00:00
24de16b587 Drop UltiSnips and move to coc-snippets
Also change the completion confirm mapping to <TAB> and make the
priority of snippets higher.
2023-01-25 00:40:41 +00:00
226765f88a Disable coc.nvim inlay hints globally 2023-01-19 12:17:20 +00:00
20c3c27bd7 Drop ale plugin and config 2023-01-13 22:46:29 +00:00
877d90dd90 Fix windows switching mappings when not in tmux 2023-01-09 23:20:15 +00:00
8f578862ef Add vim-bundle-mako plugin for mako template language 2022-11-25 14:13:07 +00:00
9cc65d5e1f Remove comments from individual syntax plugins 2022-11-25 14:12:55 +00:00
86659d8db6 Don't use signcolumn=number 2022-11-25 12:33:33 +00:00
e066388627 Fix statusline light highlight colors 2022-11-11 11:06:56 +00:00
5457b54a3a Merge plugins.yaml into tasks.yaml
Having `tasks.yaml` depend on `plugins.yaml` not work, except when
running on `localhost` which is not always the case.
2022-11-08 15:36:17 +00:00
5972ec6aa8 Switch over to managing plugins with Ansible
The `tasks.yaml` has been updated to include the new variables file
`plugins.yaml` which defines the `plugin_dir` and `plugins` variables.
These are in turn used by config/local> to manage the plugin list
outwith (neo)vim.
2022-11-08 13:57:02 +00:00
2694c76a67 Remove all references of Pack command
The previous commit removed all command related to minpac, including
`Pack` which was still being referenced in `vimrc`.
2022-11-08 13:23:22 +00:00
ee5110efd8 Remove minpac in preparation for using Ansible 2022-11-08 11:21:08 +00:00
330329ef2b Replace ad hoc conflict markers with plugin 2022-11-07 14:27:13 +00:00
32610db521 Make gx work in WSL 2022-11-06 11:21:32 +00:00
4c142d2fa5 Only setup cursor shape in vim, not nvim
Neovim already changes cursor shape by default, there's no need to
override it.
2022-11-06 11:12:06 +00:00
cde38c5469 Make CocInlayHint look like Comment 2022-10-31 11:48:44 +00:00
dfc26e9c40 Disable coc-powershell integrated console 2022-10-29 11:44:15 +01:00
5476d9ec86 Fix coc.nvim change of default first selection 2022-10-25 11:08:25 +01:00
78ae575efe Disable clangd inlay type hints 2022-10-13 10:45:01 +01:00
3577aa13bc Drop some coc-yaml schemas 2022-09-09 22:49:07 +01:00
2ce3d322ca Add coc-powershell on Windows only 2022-06-15 22:15:23 +01:00
27c42a6a92 Don't use GUI tabs in neovim-qt 2022-06-15 22:15:23 +01:00
61ce53bfd3 Don't conceal things in json 2022-06-08 13:56:37 +01:00
d0af1c7116 Fix Doxygen @param highlight
There are two forms of `@param`:

* `@param <name> <description>`
* `@param[<use>] <name> <description>`

Prior to this patch only the latter was highlighting `<name>` as a
special comment, now both forms do this.
2022-05-31 10:59:28 +01:00
ec2b973fc0 Update schemastore URLs 2022-05-22 15:57:11 +01:00
98b48377cd Add GitLab CI schema paths 2022-05-04 14:14:03 +01:00
eb9579e1b6 Add more ansible tasks lsp matches 2022-04-30 13:31:29 +01:00
a689039ae2 Add yaml.schemas not matches by default 2022-04-30 09:38:25 +01:00
3da17559e9 Update minpac submodule 2022-04-29 21:58:31 +01:00
68c699882d Use Source Code Pro 10 on Windows GUI 2022-04-29 21:57:05 +01:00
51c56a8633 Fix glitch in StatusLineTerm highlight group 2022-04-22 15:53:01 +01:00
14d34e0b6b Don't set formatexpr globally, only in specific filetypes 2022-04-14 10:50:52 +01:00
fd31549a32 Add coc-docker to list of global extensions 2022-02-26 17:25:09 +00:00
d66ff687d4 Install node.js dependency for coc.nvim 2022-02-19 14:39:20 +00:00
db5ebc701d Bump unmap Y version check 2022-02-18 19:51:29 +00:00
e6e3a10c87 Don't unmap Y before nvim 0.5
This version check might need some refinement, not actually sure when it
was introduced but it's deffo not in 0.4.4.
2022-02-15 10:53:58 +00:00
8277ad04ab Add <> to % matches in cpp filetype 2022-02-03 14:25:41 +00:00
caa83e88d2 Undo neovims default mapping of Y to y$ 2022-01-14 20:03:07 +00:00
177dbad101 Use ! to silence font warning on Windows
See https://github.com/equalsraf/neovim-qt/issues/732 for more context.
2021-12-22 12:05:16 +00:00
d7c1bdd27c Fix bug in #tmux#isOption()
Actually use `a:option` instead of `'set-clipboard'` string when
comparing the tmux option value. This hasn't been an issue because the
only use of the function happens to be checking the value of
`'set-clipboard'`.
2021-12-16 23:06:03 +00:00
775d07414c Use package name lists 2021-12-15 00:31:50 +00:00
49051cff43 Only install clangd-12 on Ubuntu 20.04 2021-11-19 22:34:46 +00:00
8ffdfd41cd Move main.yaml to tasks.yaml 2021-11-19 21:49:13 +00:00
aa2190daec Install clangd language server on Debian 2021-11-11 21:52:42 +00:00
b2cf9ace96 Install cmake-language-server 2021-11-11 21:35:29 +00:00
a46b128741 Start using Ansible for config management 2021-11-05 14:13:41 +00:00
c06b56115a Add minpac as a submodule 2021-07-27 23:04:35 +01:00
e1bc4428c5 Disable coc.nvim semantic highlights 2021-07-18 16:19:48 +01:00
c9711deade Only display coc#status() in regular active buffer
The statusline is only dynamically updated for the active buffer, thus
when there are multiple splits the statusline for inactive buffers may
include non-updated output of `coc#status()`. This patch adds a boolean
flag to `statusline#generic()` which enables `statusline#active()` and
`statusline#inactive()` to control when `coc#status()` is included in
the statusline.
2021-07-14 17:33:54 +01:00
0961c13316 Use compdb to post-process compile_commands.json
When selecting a `:BuildDir` for the `clangd` LSP use `compdb` to
post-process the `compile_commands.json` to also include flags for
stand alone header files.
2021-07-14 11:38:21 +01:00
eabec4e9b6 Add build#dir() popup_menu() fallback
When `popup_menu()` is not available, i.e. neovim or old version of vim,
fallback to using `inputlist()` instead.
2021-07-13 21:00:48 +01:00
7491736987 Don't set nospell in requirements.txt 2021-07-12 13:47:00 +01:00
c26d837047 Add init.vim as a regular file 2021-07-12 13:41:26 +01:00
38b8ab2fae Remove init.vim symlink 2021-07-12 13:41:04 +01:00
30c601e8b3 Add pip requirements.txt syntax highlighting 2021-07-12 13:36:44 +01:00
2188095b2f Always use fresh colorscheme on Windows
Windows Terminal has support for 256 color so there is not need to
restrict where to use `fresh` as the `colorscheme`.
2021-07-11 16:53:22 +01:00
a881d3e62a Add nvim-qt configuration
Set font and colorscheme for `nvim-qt`.
2021-07-10 14:49:16 +01:00
2ab332db65 Don't use tmux navigation mappings on Windows
Since `tmux` integration is not enabled on Windows, don't use the
`vim-tmux-natigation` command mappings for movingin between splits.
2021-07-10 14:46:52 +01:00
dbff00b6fc Make init.vim work on Windows
Symbolic links committed to Git repositories do not work on Windows.
Repalce the `init.vim` symbolic link with a regular file which loads
`vimrc`, this should work on all platforms.
2021-07-10 14:43:39 +01:00
9cc1ac8d87 Fix statusline background higlights in gui 2021-07-10 14:42:12 +01:00
34073608c8 Update Python main snippet 2021-05-30 20:51:55 +01:00
06335a18da Change vim-signify changed sign from ! to ~ 2021-05-22 17:02:04 +01:00
4a47908717 Customize coc.nvim highlights in fresh colorscheme 2021-04-27 23:37:06 +01:00
6053174173 Don't let coc.nvim highlight the number column 2021-04-27 23:36:49 +01:00
0315c070f5 Customise coc.nvim signcolumn signs 2021-04-27 18:01:33 +01:00
05b047f374 Add coc.nvim next/previous diagnostic mappings 2021-04-27 17:34:54 +01:00
455c1f1b94 Move statusline truncation market after mode 2021-04-20 23:20:51 +01:00
46283e3b95 Remove unused vim-gitgutter mappings 2021-04-19 20:28:08 +01:00
0f1b35eda3 Don't call coc#status() if it doesn't exist 2021-04-19 20:10:29 +01:00
9aa45a4df5 Use coc-jedi and coc-pyright instead of coc-pyls 2021-04-19 20:10:29 +01:00
78e821e386 Add a call to coc#status() in statusline
Don't miss out on the status of coc.nvim by insuring updates are
rendered in the statusline.
2021-04-19 20:10:29 +01:00
2b02d0ae81 Ignore compiled python files 2021-04-19 20:10:29 +01:00
f00eb38200 Fix coc.nvim mappings in C/C++ files 2021-04-19 20:10:29 +01:00
46d27c17fd 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-04-19 20:10:29 +01:00
4e00e225d4 Don't show signcolumn when filetype man 2021-04-18 14:42:33 +01:00
3a44fa1e48 Fix vim :terminal window mappings 2021-04-18 14:42:33 +01:00
96ff72433d Change yaml default syntax highlights 2021-04-18 14:42:33 +01:00
837aa12f9f Replace osc52yank.vim with autoload script 2021-04-18 14:42:33 +01:00
41a0658cf2 Always enable signcolum except in nvim terminal 2021-04-18 14:42:33 +01:00
3a2337cd63 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-04-18 14:42:33 +01:00
ecd8659df7 Use tab width of 2 in yaml files 2021-04-18 14:42:33 +01:00
d6106bac84 Add statusline support for nvim's man pager filetype 2021-04-18 14:42:33 +01:00
873acacaa6 Make terminal mode feel like insert mode statusline 2021-04-18 14:42:33 +01:00
c284486540 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-04-18 14:42:33 +01:00
587aeef5d7 Use signcolumn=number when available 2021-04-18 14:42:33 +01:00
c67f11a8f5 Fix statusline l:mode map indentation 2021-04-18 14:42:33 +01:00
cef963d805 Remove a unused scriptencoding
There are no utf-8 special characters in the file anymore.
2021-04-18 14:42:33 +01:00
dc6a8b0032 Get rid of scrolloff 2021-04-18 14:42:33 +01:00
9a1b1ed2fc Replace vim-airline with a custom statusline
Finally got round to making a custom statusline after being inspired by
https://pastebin.com/Fm1NEgBf
2021-04-18 14:42:33 +01:00
bee751201d Add list of global coc extensions 2021-04-18 14:42:33 +01:00
eb1a4a71d8 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-04-18 14:42:33 +01:00
bf6deaf1ed Configure cmake-language-server and coc-cmake
Utilises the following Python package:

```console
$ pip3 install --user cmake-language-server
```
2021-04-18 14:42:33 +01:00
8a2ca8c53f Update build#dir() to configure coc-clangd 2021-04-18 14:42:33 +01:00
824aeb431a Replace remaining YouCompleteMe mappings 2021-04-18 14:42:33 +01:00
4a99f582f3 Replace YouCompleteMe with coc.nvim 2021-04-18 14:42:33 +01:00
3b3121aa28 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-04-18 14:42:33 +01:00
82303f075e Move RST settings together 2021-02-06 11:05:23 +00:00
92a23103e3 Fix vim-tmux-focus-events errors in command-line
When changing focus away and back to vim while in the middle of editing
the command-line, vim-tmux-focus-events emits errors from the function
called by the `:cnoremap` mappings. This patch replaces these mappings
with a call to `do#sink()` which does nothing. Simply removing the
mappings will result in `<F24><F25>` being inserted on the command-line
since tmux will send this text when `tmux set-option -g focus-events
on`, this is why `do#sink()` is needed.
2021-01-27 19:23:13 +00:00
9c64158445 Replace vim-gitgutter with vim-signify
vim-gitgutter is buggy. vim-signify might be better, it does allow
configuration of which events trigger a sign column update and this
patch takes advantage of that. Firstly, the `CursorHold` and
`CursorHoldI` events are disabled and replaced with `InsertLeave` and
`TextChanged` events. This makes the sign column updates immediate, and
since vim-signify is asynchronous it's faster too.
2021-01-26 23:45:49 +00:00
eac02b26d3 Add xterm-kitty to list of supported $TERM values 2021-01-25 21:37:09 +00:00
aaa8acf5a2 Update build#dir() to open a popup_menu()
Use `popup_menu()` in `build#dir()` when the `:BuildDir` command is uses
without an argument to specify a build directory. If there are no build
directories, print an error message. If there is a single build
directory, use it. If there are multiple build directories use
`popup_menu()` to prompt the user to select the desired build directory.

Update `build#targets()` and `build#run()` with comments and error
messages.
2021-01-06 00:23:32 +00:00
c94bc3ba90 Add autoloaded echomsg utility functions
* `echo#warning({message})` sets `echohl WarningMsg` and echos the message
* `echo#error({message})` sets `echohl ErrorMsg` and echos the message
2021-01-06 00:23:19 +00:00
a0df92852a Add :Build command to invoke ninja or make
The `:Build [<target> ...]` command utilises the `$BUILD_DIR` variable set
by `:BuildDir {directory}` to invoke `ninja` or `make` based on the
existence of `$BUILD_DIR/build.ninja` or `$BUILD_DIR/Makefile`
respectively. The following commands are invoked in a new `:terminal`
window.

* `ninja -C $BUILD_DIR [<target> ...]` when `$BUILD_DIR/build.ninja` exists
* `make -C $BUILD_DIR [<target> ...]` when `$BUILD_DIR/Makefile` exists

In the case of `ninja`, completion for the targets supplied to the
`:Build` command is made available by the `build#targets()` function.
The list of targets returned by `ninja -C $BUILD_DIR -t targets` is
processed to generate the list of targets. Support for `make` target
completion is less straight forwards so has been omitted for now.
2021-01-05 21:45:43 +00:00
0cd93f1823 Generalise tmux option check 2020-12-31 18:22:37 +00:00
db2079994a Disable some cmakelint checks in ale
Some of `cmakelint`s opinions around convention don't provide a benefit.
2020-12-14 15:14:24 +00:00
c17f7ea0d9 Refactor tmux and set-clipboard detection
Move logic to `autoload/tmux.vim` to detect the `vim` is being run
inside a `tmux` sessions and if the `set-clipboard` option is enabled.
This cleans up adding the optional `oscyank.vim` plugin when needed.
2020-12-10 18:07:24 +00:00
76acb9cd90 Once again fix minpac initialization 2020-12-10 17:41:17 +00:00
48913e09c3 Fix isdirectory() uses with relative paths
After upgrading VIM 8.2 (2019 Dec 12, compiled Oct 24 2020 16:26:37)
uses of `isdirectory()` with relative paths in `$MYVIMRC` stopped
working. These must now be absolute paths.
2020-12-10 17:38:58 +00:00
e4a11a2ffe Fix package load init order bugs
* Move calls to `minpac#init()` into commands which use minpac
* Check if optional package directories exist before using `packadd`
2020-11-28 17:16:11 +00:00
3cc1e3d2d8 Change some Python highlight groups 2020-10-26 13:33:43 +00:00
6435ed4c4d Add TODO to cpp syntax 2020-10-26 13:33:14 +00:00
d063e60559 Make explicit more implicit (and changed) hl groups 2020-10-26 13:32:47 +00:00
56 changed files with 1005 additions and 388 deletions

View File

@@ -1,9 +0,0 @@
---
- 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,3 +2,4 @@ local.vim
.netrwhist
pack/*
spell/*
*.pyc

View File

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

View File

@@ -1,6 +1,5 @@
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,11 +9,7 @@ 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*/"
let b:surround_{char2nr("/")} = "/*\r*/"
" Map K to get YouCompleteMe documentation.
nnoremap K :YcmCompleter GetDoc<CR>

View File

@@ -1,6 +1,3 @@
" Add omnifunc completion plugin.
packadd vim-cmake-completion
" Enable syntax folding, see .vim/after/syntax/cmake.vim
setlocal foldmethod=syntax
" Set comment string

1
after/ftplugin/cpp.lua Normal file
View File

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

View File

@@ -1,5 +1,3 @@
" Add Doxygen documentation generation plugin.
packadd DoxygenToolkit.vim
nnoremap <leader>d :Dox<CR>
" Map K to get YouCompleteMe documentation
nnoremap K :YcmCompleter GetDoc<CR>

View File

@@ -5,4 +5,4 @@ setlocal nospell
setlocal scrolloff=0
" Don't display line numbers
setlocal nonumber norelativenumber
setlocal nonumber norelativenumber signcolumn=no

2
after/ftplugin/man.vim Normal file
View File

@@ -0,0 +1,2 @@
setlocal showbreak=
set signcolumn=no

View File

@@ -25,6 +25,3 @@ setlocal encoding=utf-8
" Set up file format
setlocal fileformat=unix
let g:python_highlight_all=1
" Mappings
nnoremap K :YcmCompleter GetDoc<CR>

View File

@@ -1,9 +1,6 @@
" Add omnifunc completion package.
packadd vimomni
" Mapping for Vim help of the word under cursor.
nnoremap K :help <C-r><C-w><CR>
" Set custom fold expression
setlocal foldmethod=expr
setlocal foldexpr=VimFold(v:lnum)

View File

@@ -0,0 +1,8 @@
if get(g:, 'loaded_tmux_focus_events', 0)
" Override vim-tmux-focue-events command-line mappings when tmux send <F24>
" FocusLost and <F25> FocusLost instead of to call do#sink() which does
" nothing. This is required due to errors emitted from the
" vim-tmux-focus-events plugin when chaning focus.
cnoremap <silent> <F24> <C-\>edo#sink()<CR>
cnoremap <silent> <F25> <C-\>edo#sink()<CR>
endif

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,3 +1,4 @@
hi link jsonKeyword Function
hi link jsonNull Constant
hi link jsonQuote Delimiter
setlocal conceallevel=0

2
after/syntax/python.vim Normal file
View File

@@ -0,0 +1,2 @@
highlight link pythonException Conditional
highlight link pythonExceptions Keyword

7
after/syntax/yaml.vim Normal file
View File

@@ -0,0 +1,7 @@
setlocal tabstop=2
setlocal shiftwidth=2
setlocal softtabstop=2
highlight link yamlBlockMappingKey Keyword
highlight link yamlAnchor PreProc
highlight link yamlAlias PreProc

View File

@@ -1,73 +0,0 @@
" fresh palette
let g:airline#themes#fresh#palette = {}
" NORMAL mode
let s:N1 = ['#005f00', '#afdf00', 22, 148, '']
let s:N2 = ['#ffffff', '#005f00', 15, 22, '']
let s:N3 = ['#ffffff', '#121212', 15, 233, 'bold']
let s:W = ['#000000', '#8700df', 232, 92, '']
let s:E = ['#000000', '#990000', 232, 160]
let g:airline#themes#fresh#palette.normal =
\ airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#fresh#palette.normal.airline_warning = s:W
let g:airline#themes#fresh#palette.normal.airline_error = s:E
let g:airline#themes#fresh#palette.normal_modified = {
\ 'airline_c': ['#ffffff', '#5f0087', 15, 53, 'bold'], }
" INSERT mode
let s:I1 = ['#0000df', '#00dfff', 20, 45, '']
let s:I2 = ['#ffffff', '#005fdf', 15, 26, '']
let s:I3 = ['#ffffff', '#121212', 15, 233, 'bold']
let g:airline#themes#fresh#palette.insert =
\ airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#fresh#palette.insert.airline_warning = s:W
let g:airline#themes#fresh#palette.insert.airline_error = s:E
let g:airline#themes#fresh#palette.insert_modified =
\ g:airline#themes#fresh#palette.normal_modified
let g:airline#themes#fresh#palette.insert_paste = {
\ 'airline_a': [s:I1[0], '#ffff00', s:I1[2], 11, ''], }
" REPLACE mode
let s:R1 = [s:I2[0], '#af0000', s:I2[2], 124, '']
let s:R2 = ['#ffffff', '#5f0000', 15, 52, '']
let s:R3 = ['#ffffff', '#121212', 15, 233, 'bold']
let g:airline#themes#fresh#palette.replace =
\ airline#themes#generate_color_map(s:R1, s:R2, s:R3)
let g:airline#themes#fresh#palette.replace.airline_warning = s:W
let g:airline#themes#fresh#palette.replace.airline_error = s:E
let g:airline#themes#fresh#palette.replace_modified =
\ g:airline#themes#fresh#palette.normal_modified
" VISAUL mode
let s:V1 = ['#ff5f00', '#ff5f00', 52, 208, '']
let s:V2 = ['#ffffff', '#005f00', 15, 124, '']
let s:V3 = ['#ffffff', '#121212', 15, 233, 'bold']
let g:airline#themes#fresh#palette.visual =
\ airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#fresh#palette.visual.airline_warning = s:W
let g:airline#themes#fresh#palette.visual.airline_error = s:E
let g:airline#themes#fresh#palette.visual_modified =
\ g:airline#themes#fresh#palette.normal_modified
" INACTIVE mode
let s:IA1 = ['#4e4e4e', '#1c1c1c', 239, 234, '']
let s:IA2 = ['#4e4e4e', '#262626', 239, 235, '']
let s:IA3 = ['#ffffff', '#121212', 15, 233, 'bold']
let g:airline#themes#fresh#palette.inactive =
\ airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#fresh#palette.inactive.airline_warning = s:IA2
let g:airline#themes#fresh#palette.inactive.airline_error = s:IA2
let g:airline#themes#fresh#palette.inactive_modified = {
\ 'airline_c': ['#875faf', '', 97, '', ''], }
let g:airline#themes#fresh#palette.accents = {
\ 'red': [ '#ff0000' , '' , 160 , '' ] }
if !get(g:, 'loaded_ctrlp', 0)
finish
endif
let g:airline#themes#fresh#palette.ctrlp =
\ airline#extensions#ctrlp#generate_color_map(
\ ['#d7d7ff', '#5f00af', 189, 55, ''],
\ ['#ffffff', '#875fd7', 231, 98, ''],
\ ['#5f00af', '#ffffff', 55, 231, 'bold'] )

View File

@@ -1,6 +1,110 @@
function! build#dir(dir) abort
let l:cwd = getcwd()
let $BUILD_DIR = l:cwd.'/'.a:dir
let g:ycm_clangd_args = ['--compile-commands-dir='.$BUILD_DIR]
YcmRestartServer
function! build#dir(...) abort
if a:0 == 0
" No arguments, find build directories.
let s:dirs = split(substitute(globpath('.', 'build*'), '\.\/', '', 'g'), '\n')
let l:len = len(s:dirs)
if l:len == 0
echoerr 'no build directories found'
elseif l:len == 1
" One build directory found, use it.
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
endif
else
if a:0 == 1
" Single argument, invoked by :BuildDir.
let l:dir = a:1
elseif a:0 == 2
" Two arguments, called back by popup_menu().
let l:dirs = s:dirs
unlet s:dirs
if a:2 == -1
" Selection in popup_menu() was cancelled.
return
endif
let l:dir = l:dirs[a:2 - 1]
else
echoerr 'build#dir called with too many arguments'
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
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['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
function! build#targets(ArgLead, CmdLine, CursorPos) abort
if !exists('$BUILD_DIR')
echoerr 'build directory not set'
return ''
endif
let l:targets = []
if filereadable($BUILD_DIR.'/build.ninja')
" Ask ninja for the list of targets and prepare for returning.
for l:target in split(system('ninja -C '.$BUILD_DIR.' -t targets'), '\n')
call add(l:targets, substitute(l:target, ':.*$', '', ''))
endfor
elseif filereadable($BUILD_DIR.'/Makefile')
" TODO: Support make, it's much less straight forwards than ninja.
endif
return join(l:targets, "\n")
endfunction
function! build#run(...) abort
if !exists('$BUILD_DIR')
call echo#error('build directory not set')
return
endif
let l:build_dir = $BUILD_DIR
if filereadable($BUILD_DIR.'/build.ninja')
" Execute ninja in a terminal window.
execute 'terminal ninja -C '.l:build_dir.' '.join(a:000, ' ')
elseif filereadable($BUILD_DIR.'/Makefile')
" Execute make in a terminal window.
execute 'terminal make -C '.l:build_dir.' '.join(a:000, ' ')
endif
endfunction

View File

@@ -69,7 +69,7 @@ function! do#rename_include_guard(old)
call setpos('.', l:pos)
endfunction
" Setup and start a debugging command.
" Setup and start a debugging command
function! do#debug(...)
packadd termdebug
let l:command = 'TermdebugCommand'
@@ -86,3 +86,28 @@ function! do#last_change()
norm!``
endif
endfunction
" Augment vim-signify update events
function! do#signify() abort
" Disable update on cursor hold
autocmd! signify CursorHold,CursorHoldI
" Enable updates on leaving insert mode
autocmd signify InsertLeave,TextChanged <buffer> call sy#start()
" Enable update on text change e.g. undo/redo
autocmd signify TextChanged <buffer> call sy#start()
endfunction
" A sink for mappings to do nothing
function! do#sink() abort
endfunction
" Used by normal mode K mapping to show documentation
function! do#show_documentation()
if index(['vim','help'], &filetype) >= 0
execute 'help '.expand('<cword>')
elseif coc#rpc#ready() " TODO: Check if the LS supports doHover
call CocActionAsync('doHover')
else
execute '!'.&keywordprg.' '.expand('<cword>')
endif
endfunction

11
autoload/echo.vim Normal file
View File

@@ -0,0 +1,11 @@
function! echo#warning(message) abort
echohl WarningMsg
echomsg a:message
echohl None
endfunction
function! echo#error(message) abort
echohl ErrorMsg
echomsg a:message
echohl None
endfunction

14
autoload/format.vim Normal file
View File

@@ -0,0 +1,14 @@
if !has('pythonx')
finish
endif
" set debug=msg,throw
pythonx import format
function! format#clang_format() abort
pythonx format.clang_format()
endfunction
function! format#yapf() abort
pythonx format.yapf()
endfunction

27
autoload/osc52.vim Normal file
View File

@@ -0,0 +1,27 @@
" Use the OSC 52 escape sequence to copy text to the local system clipboard
" when connected to a remote machine.
" Add an autocmd to run after text is yanked.
function! osc52#autocmd()
augroup osc52
autocmd!
autocmd TextYankPost * call osc52#copy()
augroup END
endfunction
function! osc52#copy()
" Only use OSC 52 when text is yanked with the z register.
if v:event['regname'] ==# 'z'
" Get the register contents and join the list into a string.
let l:content = join(v:event['regcontents'], "\n")
if v:event['regtype'] ==# 'V'
" Append a new line in linewise-visual mode to avoid surprises.
let l:content = l:content."\n"
endif
" Get the parent tty while being compatible with vim and neovim, originally
" from https://github.com/greymd/oscyank.vim
let l:tty = system('(tty || tty < /proc/$PPID/fd/0) 2> /dev/null | grep /dev/')
" Base 64 encode the content, and print OSC 52 escape sequence to the tty.
call system('base64 | xargs -0 printf "\\033]52;c;%s\\a" > '.l:tty, l:content)
endif
endfunction

View File

@@ -1,16 +0,0 @@
" 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

@@ -1,5 +1,9 @@
let s:tmux_option = '@vim'.substitute($TMUX_PANE, '%', '\\%', 'g')
function! tmux#inSession() abort
return $TMUX !=# ''
endfunction
function! tmux#setNavigationFlag() abort
call system('tmux set-window-option '.s:tmux_option.' 1')
endfunction
@@ -7,3 +11,11 @@ endfunction
function! tmux#unsetNavigationFlag() abort
call system('tmux set-window-option -u '.s:tmux_option)
endfunction
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
endfunction

3
autoload/wsl.vim Normal file
View File

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

81
coc-settings.json Normal file
View File

@@ -0,0 +1,81 @@
{
"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
}

View File

@@ -112,7 +112,7 @@ if has('gui_running') || &t_Co == 256
call s:hi('MatchParen', '', '', '')
call s:hi('ModeMsg', '', '', '')
call s:hi('MoreMsg', '12', '', '')
call s:hi('NonText', '', '', '')
call s:hi('NonText', '238', '', '')
call s:hi('Normal', '7', '232', '')
call s:hi('Pmenu', '', '235', '')
call s:hi('PmenuSel', '', '', 'reverse')
@@ -126,7 +126,9 @@ 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')
@@ -158,13 +160,13 @@ if has('gui_running') || &t_Co == 256
call s:hi('Repeat', '69', '', '')
call s:hi('Label', '69', '', '')
call s:hi('Operator', '166', '', '')
call s:hi('Keyword', '', '', '')
call s:hi('Keyword', '72', '', '')
call s:hi('Exception', '69', '', '')
call s:hi('PreProc', '102', '', '')
call s:hi('Include', '65', '', '')
call s:hi('Define', '', '', '')
call s:hi('Macro', '', '', '')
call s:hi('Define', '102', '', '')
call s:hi('Macro', '102', '', '')
call s:hi('PreCondit', '61', '', '')
call s:hi('Type', '75', '', '')
@@ -173,11 +175,11 @@ if has('gui_running') || &t_Co == 256
call s:hi('Typedef', '75', '', '')
call s:hi('Special', '179', '', '')
call s:hi('SpecialChar', '', '', '')
call s:hi('SpecialChar', '179', '', '')
call s:hi('Tag', '', '', '')
call s:hi('Delimiter', '179', '', '')
call s:hi('SpecialComment', '246', '', '')
call s:hi('Debug', '', '', '')
call s:hi('Debug', '179', '', '')
call s:hi('Underlined', '38', '', 'underline')
call s:hi('Ignore', '', '', '')
@@ -185,6 +187,10 @@ 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')
@@ -196,10 +202,15 @@ if has('gui_running') || &t_Co == 256
call s:hi('Important', '220', '', 'bold')
call s:hi('Research', '202', '', 'bold')
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('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('SyntasticErrorSign', '160', '233', 'bold')
call s:hi('SyntasticWarningSign', '129', '233', 'bold')
@@ -207,5 +218,9 @@ if has('gui_running') || &t_Co == 256
call s:hi('SyntasticWarningLine', '', '', '')
call s:hi('SyntasticError', '160', '', '')
call s:hi('SyntasticWarning', '129', '', '')
call s:hi('SignifySignAdd', '2', '233', '')
call s:hi('SignifySignChange', '3', '233', '')
call s:hi('SignifySignDelete', '1', '233', '')
"" }}}
endif

View File

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

3
ftplugin/c.vim Normal file
View File

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

6
ftplugin/cpp.vim Normal file
View File

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

3
ftplugin/java.vim Normal file
View File

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

3
ftplugin/javascript.vim Normal file
View File

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

3
ftplugin/objc.vim Normal file
View File

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

3
ftplugin/objcpp.vim Normal file
View File

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

3
ftplugin/proto.vim Normal file
View File

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

3
ftplugin/python.vim Normal file
View File

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

View File

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

8
ginit.vim Normal file
View File

@@ -0,0 +1,8 @@
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=Consolas:h10:cDEFAULT
set guifont=Source\ Code\ Pro:h10
else
" Set default font
set guifont=Source\ Code\ Pro\ Medium\ 9

1
init.vim Normal file
View File

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

28
nodejs-linux.yaml Normal file
View File

@@ -0,0 +1,28 @@
---
- 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

@@ -1,7 +1,7 @@
augroup benieAugroup
autocmd!
if $TMUX !=# ''
if tmux#inSession()
" [Un]set tmux window option to detect when to change pane.
call tmux#setNavigationFlag()
au FocusGained * silent call tmux#setNavigationFlag()
@@ -12,17 +12,31 @@ 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()
if has('nvim')
" Start in terminal-insert mode.
autocmd TermOpen term://* startinsert
" Don't show the line number column in terminal-insert mode.
autocmd TermEnter term://*
\ set nonumber | set norelativenumber | set signcolumn=no
" But do show the line number column in terminal-normal mode.
autocmd TermLeave term://*
\ set number | set relativenumber | set signcolumn=auto
" Automatically press enter when the terminal process exits.
autocmd TermClose term://*
\ if (expand('<afile>') !~ "fzf") &&
\ (expand('<afile>') !~ "ranger") &&
\ (expand('<afile>') !~ "coc") |
\ call nvim_input('<CR>') |
\ endif
endif
augroup END

View File

@@ -1,13 +1,12 @@
if !platform#is_windows() &&
\ !has("gui_running") &&
\ $TERM != 'xterm-256color' &&
\ $TERM != 'xterm-kitty' &&
\ $TERM != 'screen-256color' &&
\ $TERM != 'tmux-256color'
echo "This terminal does not report 256 color support but probaly supports it"
echo "Setup the shell to do something similar on load"
echo "env TERM=xterm-256color /usr/bin/zsh"
endif
if !platform#is_windows() || has("gui_running")
colorscheme fresh
endif
syntax sync minlines=1000

View File

@@ -1,11 +1,3 @@
" minpac
command! PackUpdate packadd minpac | source $MYVIMRC |
\ call minpac#update('', {'do': 'call minpac#status()'})
command! PackStatus packadd minpac | source $MYVIMRC |
\ call minpac#status()
command! PackClean packadd minpac | source $MYVIMRC |
\ call minpac#clean()
" Sort Python Imports
command! ISort call do#isort()
@@ -31,4 +23,5 @@ command! -nargs=+ -complete=file Debug call do#debug(<f-args>)
command! TodoFile lvimgrep /todo/ %
" Change build directory
command! -nargs=1 -complete=dir BuildDir call build#dir(<f-args>)
command! -nargs=? -complete=dir BuildDir call build#dir(<f-args>)
command! -nargs=* -complete=custom,build#targets Build call build#run(<f-args>)

8
plugin/format.vim Normal file
View File

@@ -0,0 +1,8 @@
if !has('pythonx')
finish
endif
let g:clang_format_path = get(g:, 'clang_format_path', 'clang-format')
let g:clang_format_style = get(g:, 'clang_format_style', 'google')
let g:yapf_path = get(g:, 'yapf_path', 'yapf')
let g:yapf_style = get(g:, 'yapf_style', 'pep8')

View File

@@ -1,9 +1,19 @@
" YouCompleteMe
nnoremap <leader>fi :YcmCompleter FixIt<CR>
nnoremap <leader>gd :YcmCompleter GoTo<CR>
nnoremap <leader>gt :YcmCompleter GetType<CR>
nnoremap <leader>sd :YcmShowDetailedDiagnostic<CR>
nnoremap <leader>D <plug>(YCMHover)
" 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
tnoremap <C-w>N <C-\><C-n>
endif
" termdebug
" TODO: Detecet if termdebug is loaded, if not do the default action.
@@ -14,10 +24,6 @@ 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>
@@ -59,14 +65,33 @@ nnoremap k gk
" Quick write
nnoremap <leader>w :w!<CR>
" Switch panes
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Redraw window
nnoremap <C-w>l <C-l>
" 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
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
endif
" Quick tabs
nnoremap <leader>tn :tabnew<Space>
@@ -77,8 +102,14 @@ nnoremap <leader>tm :tabmove<Space>
" Clear search highlights
nnoremap <leader><Space> :nohlsearch<CR>
if g:use_osc52
noremap <leader>y :Oscyank<CR>
if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# ''
" When connected to a remote session the + selection register is not
" available and the unnamed register is used instead. Add mappings using the
" z register instead.
noremap <leader>y "zy
noremap <leader>Y "zY
" Enable OSC 52 copy on yank.
call osc52#autocmd()
else
" System clipboard yank/put
noremap <leader>y "+y
@@ -86,6 +117,10 @@ 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
@@ -93,8 +128,6 @@ nnoremap <C-s> i<C-g>u<C-X>s
" Disable 'Q' from opening Ex mode
nnoremap Q <nop>
" Disable 'K' from loading man pages
noremap K <nop>
" Split line at the cursor
nnoremap [j i<CR><Esc>

View File

@@ -1,6 +1,3 @@
" TODO: Move these settings to vimrc when after switching to vim8 packages
scriptencoding 'utf-8'
" Copy indent from current line
set autoindent
@@ -16,12 +13,6 @@ if !has('nvim') && &ttimeoutlen == -1
set ttimeoutlen=100
endif
" TODO: These might be irrelevant with vim-airline
" Show 2 line status
set laststatus=2
" Show the line and colum number of a cursor position
set ruler
" Enhanced command line completion
set wildmenu
" Command line history
@@ -68,8 +59,6 @@ if has('linebreak')
set linebreak
" Downwards Arrow With Tip Rightwards (U+21B3, utf-8: E2 86 B3)
let &showbreak='↳ '
" Use same highlight group as listchars for showbreak
set highlight+=@:SpecialKey
endif
" TODO: spellcapcheck
@@ -96,7 +85,6 @@ if exists('+relativenumber')
endif
" Keep cursor from buffer edges
set scrolloff=8
set sidescrolloff=5
" Turn backup off
@@ -124,6 +112,8 @@ 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
@@ -162,6 +152,11 @@ set mouse=a
" q - allow formatting with 'gq'
set formatoptions+=rq
" Always show the signcolum
if exists('&signcolumn')
set signcolumn=yes
endif
" Enable modeline
set modeline
@@ -179,7 +174,7 @@ if &t_Co == 8 && $TERM !~# '^linux\|^Eterm'
endif
" Change cursor dependant on current mode
if has('cursorshape') && has('unix') && !has('gui_running')
if !has('nvim') && 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"

174
plugin/statusline.vim Normal file
View File

@@ -0,0 +1,174 @@
" 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#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]
endfunction
" StatusLineLight is shows the mode and cursor information, it is dynamically
" changed by statusline#mode(), give it a default.
call s:hi('StatusLineLight', g:statusline#light_grey)
" StatusLineDusk is shows additional information which is not always present,
" give it a muted color.
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
" 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)
" Display current mode with dynamic highlights.
let l:mode = '%#'.a:group.'# '.a:name.' '
" Display filename with dark highlights.
let l:file = '%#StatusLineDark# '.a:title
" 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:file.'%='.l:line
endfunction
" Construct a statusline for generic buffer types.
function! statusline#generic(group, mode, coc)
" 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
" the spaces when empty.
let l:edit = '%#StatusLineDusk#%( '
\.'%{&spell ? "Spell " : ""}'
\.'%{&paste ? "Paste " : ""}'
\.'%)'
" Display filename with dark or changed highlights.
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
" highlights in a group to swallow spaces when empty.
let l:format = '%#StatusLineDusk#%( '
\.'%{&fileencoding ==# "utf-8" ? "" : &fileencoding}'
\.'%{&fileformat ==# "unix" ? "" : "[".&fileformat."]"}'
\.' %)'
" 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
endfunction
" Define active statusline, this statusline is dynamic with StatusLineLight
" being updated based on the current mode and only used for current buffer.
function! statusline#active()
let l:mode = statusline#mode()
if &buftype ==# 'help'
if l:mode ==# 'Normal'
let l:mode = 'Help'
endif
return statusline#special('StatusLineLight', l:mode, '%F')
elseif &buftype ==# 'quickfix'
" Quickfix list and location list have the same buftype, the window has a
" loclist flag, query the window info.
let l:info = getwininfo(win_getid())[0]
if l:mode ==# 'Normal'
let l:mode = l:info['loclist'] ? 'Location' : 'Quickfix'
endif
return statusline#special('StatusLineLight', l:mode,
\ get(l:info['variables'], 'quickfix_title', ''))
elseif &buftype ==# 'terminal'
return statusline#special('StatusLineLight', 'Terminal', '%f')
elseif &previewwindow
if l:mode ==# 'Normal'
let l:mode = 'Preview'
endif
return statusline#generic('StatusLineLight', l:mode, v:false)
elseif &filetype ==# 'man'
return statusline#special('StatusLineDusk', 'Manual', '%f')
endif
return statusline#generic('StatusLineLight', l:mode, v:true)
endfunction
" Define inactive statusline, this remains static until the buffer gains
" focus again.
function! statusline#inactive()
if &buftype ==# 'help'
let l:statusline = statusline#special('StatusLineDusk', 'Help', '%F')
elseif &buftype ==# 'quickfix'
" Quickfix list and location list have the same buftype, the window has a
" loclist flag, query the window info.
let l:info = getwininfo(win_getid())[0]
let l:statusline = statusline#special('StatusLineDusk',
\ l:info['loclist'] ? 'Location' : 'Quickfix',
\ get(l:info['variables'], 'quickfix_title', ''))
elseif &buftype ==# 'terminal'
let l:statusline = statusline#special('StatusLineDusk', 'Terminal', '%f')
elseif &previewwindow
let l:statusline = statusline#generic('StatusLineDusk', 'Preview', v:false)
elseif &filetype ==# 'man'
let l:statusline = statusline#special('StatusLineDusk', 'Manual', '%f')
else
let l:statusline = statusline#generic('StatusLineDusk', 'Idle', v:false)
endif
" Escape spaces and double quotes for use in setlocal.
let l:statusline = substitute(l:statusline, '\([ "]\)', '\\\0', 'g')
execute 'setlocal statusline='.l:statusline
endfunction
" Get statusline mode and update StatusLineLight.
function! statusline#mode()
" Map modes to a human readable name and a color.
let l:mode = {
\ 'n': ['Normal', g:statusline#light_green],
\ 'i': ['Insert', g:statusline#light_blue],
\ 'c': ['Command', g:statusline#light_green],
\ 'v': ['Visual', g:statusline#light_orange],
\ 'V': ['V-Line', g:statusline#light_orange],
\ '': ['V-Block', g:statusline#light_orange],
\ 'R': ['Replace', g:statusline#light_red],
\ 's': ['Select', g:statusline#light_violet],
\ 'S': ['S-Line', g:statusline#light_violet],
\ '': ['S-Block', g:statusline#light_violet],
\ 't': ['Terminal', g:statusline#light_blue],
\ '!': ['Shell', g:statusline#light_grey],
\}[mode()]
" Update the StatusLineLight color.
call s:hi('StatusLineLight', l:mode[1])
return l:mode[0]
endfunction
" Setup autocmds to set the statusline per buffer.
augroup benieStatusLine
autocmd!
" Dynamically update the current buffer mode and color changes using %! to
" call a function which is always evaluated on statusline update.
autocmd BufEnter,WinEnter,BufWinEnter * setlocal statusline=%!statusline#active()
" Statically set the statusline when leaving the buffer.
autocmd BufLeave,WinLeave * call statusline#inactive()
augroup END

117
pythonx/format.py Normal file
View File

@@ -0,0 +1,117 @@
"""Python formatexpr for clang-format & yapf"""
import json
import sys
import subprocess
import difflib
import vim
class FormatError(Exception):
"""A formatting error."""
def clang_format():
"""Call clang-format on the current text object."""
clang_format = vim.vars['clang_format_path']
# TODO: The cursor position before gq is invoked is not preserved in the
# jump list, this expression will return the cursor position at the
# beginning of the motion or text object.
# Is there a way to get the cursor position immediately before gq is
# invoked? So that we can pass the position to clang-format in order for
# it to return the updated position to continue editing.
# Query the current absolute cursor positon.
cursor = int(vim.eval('line2byte(".") + col(".")')) - 2
if cursor < 0:
return
# Determine the lines to format.
startline = int(vim.eval('v:lnum'))
endline = startline + int(vim.eval('v:count')) - 1
lines = f'{startline}:{endline}'
fallback_style = vim.vars['clang_format_style']
# Construct the clang-format command to call.
command = [
clang_format, '-style', 'file', '-cursor',
str(cursor), '-lines', lines, '-fallback-style', fallback_style
]
if vim.current.buffer.name:
command += ['-assume-filename', vim.current.buffer.name]
# Call the clang-format command.
output = call(command)
if not output:
return
# Read the clang-format json header.
header = json.loads(output[0])
if header.get('IncompleteFormat'):
raise FormatError('clang-format: incomplete (syntax errors).')
# Replace the formatted regions.
replace_regions(output[1:])
# Set the updated cursor position.
vim.command('goto %d' % (header['Cursor'] + 1))
def yapf():
"""Call yapf on the current text object."""
yapf = vim.vars['yapf_path']
# Determine the lines to format.
start = int(vim.eval('v:lnum'))
end = start + int(vim.eval('v:count'))
lines = '{0}-{1}'.format(start, end)
style = vim.vars['yapf_style']
# Construct the clang-format command to call.
command = [yapf, '--style', style, '--lines', lines]
# TODO: Since yapf is a Python package, we could import the module and
# call it directly instead. It would then be possible to output better
# error messages and act on the buffer directly.
# Call the yapf command.
output = call(command)
if not output:
return
# Replace the formatted regions.
replace_regions(output[:-1])
def call(command):
"""Call the command to format the text.
Arguments:
command (list): Formatting command to call.
text (str): Text to be passed to stdin of command.
Returns:
list: The output of the formatter split on new lines.
None: If the subprocess failed.
"""
# Don't open a cmd prompt window on Windows.
startupinfo = None
if sys.platform.startswith('win32'):
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
# Call the formatting command.
process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
startupinfo=startupinfo)
stdout, stderr = process.communicate(
input='\n'.join(vim.current.buffer).encode('utf-8'))
if stderr:
raise FormatError(stderr)
if not stdout:
raise FormatError('No output from {0}.'.format(command[0]))
# Split the lines into a list of elements.
return stdout.decode('utf-8').split('\n')
def replace_regions(lines):
"""Replace formatted regions in the current buffer.
Arguments:
lines (list): The formatted buffer lines.
"""
matcher = difflib.SequenceMatcher(None, vim.current.buffer, lines)
for tag, i1, i2, j1, j2 in reversed(matcher.get_opcodes()):
if tag != 'equal':
vim.current.buffer[i1:i2] = lines[j1:j2]

View File

@@ -109,6 +109,7 @@ endif
if !exists('cpp_no_function')
" Match function expressions: expr<T>()
" ^^^^
" TODO: change .* to a not be greedy
syn match cppFunction '\h\w*\ze<.*>\s*(' display
hi default link cppFunction Function

11
syntax/requirements.vim Normal file
View File

@@ -0,0 +1,11 @@
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 '=='

121
tasks.yaml Normal file
View File

@@ -0,0 +1,121 @@
---
- 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

257
vimrc
View File

@@ -11,158 +11,21 @@ if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
if exists('*minpac#init')
" When minpac is loaded initialize and define the Pack command.
call minpac#init()
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
" vim-airline - improved status bar
Pack 'vim-airline/vim-airline'
let g:airline#extensions#branch#enabled = 0
let g:airline#extensions#hunks#enabled = 0
let g:airline#extensions#wordcount#enabled = 0
for s:setting in ['left_sep', 'right_sep', 'section_error', 'section_warning']
exec 'let g:airline_'.s:setting.' = ""'
endfor
" tabline.vim - sanely numbered tabs
Pack 'mkitt/tabline.vim'
" Disable unused providers
let g:loaded_node_provider = 0
let g:loaded_perl_provider = 0
let g:loaded_ruby_provider = 0
" YouCompleteMe
Pack 'ycm-core/YouCompleteMe', {'type': 'opt'}
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:ycm_min_num_of_chars_for_completion = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_always_populate_location_list = 1
let g:ycm_error_symbol = '▸'
let g:ycm_warning_symbol = '▸'
let g:ycm_goto_buffer_command = 'horizontal-split'
let g:ycm_use_clangd = 0
let g:ycm_auto_hover = 0
" ultisnips - snippet engine
Pack 'SirVer/ultisnips'
Pack 'honza/vim-snippets'
" vim-cmake-completion - completion & help
Pack 'kbenzie/vim-cmake-completion', {'type': 'opt'}
" 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': []}
" git diff in the sign column
Pack 'airblade/vim-gitgutter'
if exists('&signcolumn')
set signcolumn=yes
else
let g:gitgutter_sign_column_always = 1
endif
" format.vim - format with text objects
Pack 'git@bitbucket.org:infektor/format.vim.git'
" 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'
" 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
" 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'],
@@ -173,41 +36,81 @@ 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
" xterm-color-table.vim - view term and hex colors
Pack 'guns/xterm-color-table.vim'
if wsl#isDetected()
" Make gx work in WSL
let g:netrw_browsex_viewer='cmd.exe /C start'
endif
" Syntax plugins
Pack 'kbenzie/vim-spirv'
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
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'
" Plugins for remote integrations
Pack 'greymd/oscyank.vim', {'type': 'opt'}
let g:use_osc52 = $TMUX !=# '' &&
\ trim(system('tmux show-options -g set-clipboard')) ==# 'set-clipboard on'
if g:use_osc52
packadd oscyank.vim
endif
" Load YouComplteMe if termdebug plugin is not loaded.
if !exists(':Termdebug')
packadd YouCompleteMe
endif