Full Code of PegasusWang/vim-config for AI

master fc905dcee4e7 cached
58 files
256.9 KB
89.0k tokens
1 requests
Download .txt
Showing preview only (275K chars total). Download the full file or copy to clipboard to get everything.
Repository: PegasusWang/vim-config
Branch: master
Commit: fc905dcee4e7
Files: 58
Total size: 256.9 KB

Directory structure:
gitextract_ap_uenq3/

├── .gitignore
├── Makefile
├── README.md
├── after/
│   └── ftplugin/
│       ├── go.vim
│       ├── help.vim
│       ├── json.vim
│       ├── man.vim
│       ├── markdown.vim
│       ├── qf.vim
│       └── vim.vim
├── autoload/
│   ├── actionmenu.vim
│   ├── badge.vim
│   └── preview.vim
├── coc-settings.json
├── config/
│   ├── filetype.vim
│   ├── general.vim
│   ├── init.vim
│   ├── local.plugins.yaml
│   ├── local.vim
│   ├── mappings.vim
│   ├── plugins/
│   │   ├── all.vim
│   │   ├── asyncomplete.vim
│   │   ├── coc.vim
│   │   ├── colorizer.lua
│   │   ├── dashboard.lua
│   │   ├── defx.vim
│   │   ├── denite.vim
│   │   ├── gina.vim
│   │   ├── goyo.vim
│   │   ├── iron.lua
│   │   ├── lsp.vim
│   │   └── whichkey.vim
│   ├── plugins.yaml
│   ├── statusline.vim
│   ├── tabline.vim
│   ├── terminal.vim
│   ├── theme.vim
│   └── vimrc
├── filetype.vim
├── init.vim
├── plugin/
│   ├── actionmenu.vim
│   ├── devhelp.vim
│   ├── difftools.vim
│   ├── filesystem.vim
│   ├── jumpfile.vim
│   ├── sessions.vim
│   ├── unixhelp.vim
│   └── whitespace.vim
├── snippets/
│   ├── .gitignore
│   ├── go.snip
│   ├── javascript.snip
│   └── python.snip
├── themes/
│   ├── hybrid.vim
│   ├── rafi-2015.vim
│   ├── rafi-2016.vim
│   └── rafi-2017.vim
├── venv.sh
└── vimrc

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*~
/benchmarks/
/spell/
/.vault.vim
/.local.vimrc
/.stignore
/.stfolder
/.stversions
.vim


================================================
FILE: Makefile
================================================
SHELL = /bin/bash
vim := $(if $(shell which nvim),nvim,$(shell which vim))
vim_version := '${shell $(vim) --version}'
XDG_CACHE_HOME ?= $(HOME)/.cache

default: install

install: create-dirs update-plugins

update: update-repo update-plugins

upgrade: update

create-dirs:
	@mkdir -vp "$(XDG_CACHE_HOME)/vim/"{backup,session,swap,tags,undo}

update-repo:
	git pull --ff --ff-only

update-plugins:
	$(vim) -V1 -es -i NONE -N --noplugin -u config/init.vim \
		-c "try | call dein#clear_state() | call dein#update() | finally | messages | qall! | endtry"

uninstall:
	rm -rf "$(XDG_CACHE_HOME)/vim"

test:
ifeq ('$(vim)','nvim')
	$(info Testing NVIM 0.5+...)
	$(if $(shell echo "$(vim_version)" | egrep "NVIM v0\.[5-9]"),\
		$(info OK),\
		$(error   .. You need Neovim 0.5.x or newer))
else
	$(info Testing VIM 8.x...)
	$(if $(shell echo "$(vim_version)" | egrep "VIM .* 8\."),\
		$(info OK),\
		$(error   .. You need Vim 8.x))

	$(info Testing +python3... )
	$(if $(findstring +python3,$(vim_version)),\
		$(info OK),\
		$(error .. MISSING! Install Vim 8.x with "+python3" enabled))
endif
	@echo All tests passed, hooray!

.PHONY: install create-dirs update-repo update-plugins uninstall test


================================================
FILE: README.md
================================================
# Rafael Bodill's Neo/vim Config

Lean mean Neo/vim machine, 30-45ms startup time.

Best with [Neovim] 0.5.x or [Vim] 8.x and `python3` enabled.

> I encourage you to fork this repo and create your own experience.
> Learn how to tweak and change Neo/vim to the way YOU like it.
> This is my cultivation of years of tweaking, use it as a git remote
> and stay in-touch with upstream for reference or cherry-picking.

<details>
  <summary>
    <strong>Table of Contents</strong>
    <small><i>(🔎 Click to expand/collapse)</i></small>
  </summary>

<!-- vim-markdown-toc GFM -->

* [Features](#features)
* [Screenshot](#screenshot)
* [Prerequisites](#prerequisites)
* [Install](#install)
* [Language-Server Protocol (LSP)](#language-server-protocol-lsp)
* [Upgrade](#upgrade)
  * [Recommended Fonts](#recommended-fonts)
  * [Recommended Linters](#recommended-linters)
  * [Recommended Tools](#recommended-tools)
* [User Custom Config](#user-custom-config)
* [Structure](#structure)
* [Plugin Highlights](#plugin-highlights)
* [Plugins Included](#plugins-included)
  * [Non Lazy-Loaded Plugins](#non-lazy-loaded-plugins)
  * [Lazy-Loaded Plugins](#lazy-loaded-plugins)
    * [Language](#language)
    * [Commands](#commands)
    * [Interface](#interface)
    * [Completion & Code-Analysis](#completion--code-analysis)
    * [Denite & Clap](#denite--clap)
    * [Operators & Text Objects](#operators--text-objects)
* [Custom Key-mappings](#custom-key-mappings)
  * [Navigation](#navigation)
  * [File Operations](#file-operations)
  * [Edit](#edit)
  * [Search & Replace](#search--replace)
  * [Clipboard](#clipboard)
  * [Command & History](#command--history)
  * [Editor UI](#editor-ui)
  * [Custom Tools & Plugins](#custom-tools--plugins)
  * [Window Management](#window-management)
  * [Git Version Control](#git-version-control)
  * [Plugin: Denite](#plugin-denite)
  * [Plugin: Defx](#plugin-defx)
  * [Plugin: Clap](#plugin-clap)
  * [Plugin: Asyncomplete and Emmet](#plugin-asyncomplete-and-emmet)
  * [Plugin: Any-Jump](#plugin-any-jump)
  * [Plugin: Signature](#plugin-signature)
* [Credits & Contribution](#credits--contribution)

<!-- vim-markdown-toc -->
</details>

## Features

* Fast startup time
* Robust, yet light-weight
* Lazy-load 95% of plugins with [Shougo/dein.vim]
* Custom side-menu (try it out! <kbd>Space</kbd>+<kbd>l</kbd>)
* Custom context-menu (try it! <kbd>;</kbd>+<kbd>c</kbd>)
* Modular configuration (see [structure](#structure))
* Auto-complete [prabirshrestha/asyncomplete.vim] extensive setup
* [Shougo/denite.nvim] centric work-flow (lists)
* Structure view with [liuchengxu/vista.vim]
* Open SCM detailed URL in OS browser
* Light-weight but informative status/tabline
* Easy customizable theme
* Premium color-schemes
* Central location for tags and sessions

## Screenshot

![Vim screenshot](http://rafi.io/static/img/project/vim-config/features.png)

## Prerequisites

* Python 3 (`brew install python`)
* Neovim or Vim (`brew install neovim` and/or `brew install vim`)

*Caveat*: You must have **one** of these tools installed:
[yj](https://github.com/sclevine/yj), [yq](https://github.com/mikefarah/yq),
[yaml2json](https://github.com/bronze1man/yaml2json), Ruby, or Python with
PyYAML in-order for the YAML configuration to be parsed.

## Install

**_1._** Let's clone this repo! Clone to `~/.config/nvim`,
we'll also symlink it for regular Vim:

```bash
mkdir ~/.config
git clone git://github.com/PegasusWang/vim-config.git ~/.config/nvim
cd ~/.config/nvim
ln -s ~/.config/nvim ~/.vim  # For "regular" Vim
```

* _**Note**:_ If you set a custom `$XDG_CONFIG_HOME`,
  use that instead of `~/.config` in the commands above.
  Neovim follows the XDG base-directories convention, Vim doesn't.

**_2._** Install the Python 3 `pynvim` library. This is also needed for Vim 8
if you want to use Denite and Defx.

> Neovim: `./venv.sh` or `pip3 install --user pynvim`

> Vim: `pip3 install --user pynvim`

**_3._** Run `make test` to test your nvim/vim version and capabilities.

**_4._** Run `make` to install all plugins.

**_5._** If you are experiencing problems, run and read `nvim -c checkhealth`

Test Python 3 availability with `:py3 print(sys.version_info)`

Enjoy! :smile:

## Language-Server Protocol (LSP)

To leverage LSP auto-completions and other functionalities, once you open a
file in Neo/vim, run `:LspInstallServer <name>` to use [mattn/vim-lsp-settings]
installation feature, use <kbd>Tab</kbd> to list available servers.

Here are a few useful commands:
* For example, open a `.go` file, and run: `:LspInstallServer gopls`
* In a `go` file, use action `:LspCodeAction source.organizeImports`
* See [config/plugins/lsp.vim] for special code intellisense mappings

## Upgrade

```bash
cd ~/.config/nvim
make update
```

This will run `git pull --ff --ff-only` and update all plugins using
[Shougo/dein.vim] package-manager (`:call dein#update()`).

### Recommended Fonts

* [Pragmata Pro] (€19 – €1,990): My preferred font
* Any of the [Nerd Fonts]

On macOS with Homebrew, choose one of the [Nerd Fonts],
for example, to install the [Hack](https://sourcefoundry.org/hack/) font:

```bash
brew tap homebrew/cask-fonts
brew search nerd-font
brew cask install font-hack-nerd-font
brew cask install font-iosevka-nerd-font-mono
brew cask install font-jetbrains-mono
brew cask install font-fira-code
```

[Pragmata Pro]: https://www.fsd.it/shop/fonts/pragmatapro/
[Nerd Fonts]: https://www.nerdfonts.com

### Recommended Linters

* macOS with Homebrew:

```sh
brew install shellcheck jsonlint yamllint tflint ansible-lint
brew install tidy-html5 proselint write-good
```

* Node.js based linters:

```sh
yarn global add eslint jshint jsxhint stylelint sass-lint
yarn global add markdownlint-cli raml-cop
```

* Python based linters:

```sh
pip3 install --user vim-vint pycodestyle pyflakes flake8
```

### Recommended Tools

* **ag** [ggreer/the_silver_searcher](https://github.com/ggreer/the_silver_searcher)
  (macOS: `brew install the_silver_searcher`)
  * and/or **ripgrep**: [BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep)
  (macOS: `brew install rg`)
* Jump around with **z**: [rupa/z](https://github.com/rupa/z)
  (macOS: `brew install z`)
  * or **z.lua**: [acme/zlua](https://github.com/skywind3000/z.lua)
* **[Universal ctags](https://ctags.io/)** for syntax tokenization
  (macOS: `brew install universal-ctags/universal-ctags/universal-ctags`)
* Fuzzy file finders:
  **[fzf](https://github.com/junegunn/fzf)**,
  **[fzy](https://github.com/jhawthorn/fzy)**, or
  **[peco](https://github.com/peco/peco)**
  (macOS: `brew install fzf`)

## User Custom Config

If you want to add your own configuration, create the `config/local.vim` file
and add your personal vimscript there. If you'd like to install plugins by
yourself, create a `config/local.plugins.yaml` file and manage your own plugin
collection.

If you want to disable some of the plugins I use, you can overwrite them, e.g.:

```yaml
- { repo: mattn/vim-lsp-settings, if: 0 }
```

### Disable built-in statusline & tabline

You can use your local `config/local.vim` to disable status and tab lines:

```vim
let g:tabline_plugin_enable = 0
let g:statusline_plugin_enable = 0
```

Now, using `config/local.plugins.yaml` you can install any line plugin you
want, _e.g._:

```yaml
# Use only one!
- repo: itchyny/lightline.vim
- repo: vim-airline/vim-airline
- repo: glepnir/galaxyline.nvim
- repo: glepnir/spaceline.vim
- repo: liuchengxu/eleline.vim
```

## Structure

* [config/](./config) - Configuration
  * [plugins/](./config/plugins) - Plugin configurations
    * [all.vim](./config/plugins/all.vim) - Plugin mappings
    * […](./config/plugins)
  * [filetype.vim](./config/filetype.vim) - Language behavior
  * [general.vim](./config/general.vim) - General configuration
  * **local.plugins.yaml** - Custom user plugins
  * **local.vim** - Custom user settings
  * [mappings.vim](./config/mappings.vim) - Key-mappings
  * [plugins.yaml](./config/plugins.yaml) - My favorite _**Plugins!**_
  * [terminal.vim](./config/terminal.vim) - Terminal configuration
  * [vimrc](./config/vimrc) - Initialization
* [ftplugin/](./ftplugin) - Language specific custom settings
* [plugin/](./plugin) - Customized small plugins
* [snippets/](./snippets) - Personal code snippets
* [themes/](./themes) - Colorscheme overrides
* [filetype.vim](./filetype.vim) - Custom filetype detection

## Plugin Highlights

* Plugin management with cache and lazy loading for speed
* Auto-completion with Language-Server Protocol (LSP)
* Project-aware tabs and labels
* Defx as file-manager + Git status icons
* Extensive language extensions library

_Note_ that 95% of the plugins are **[lazy-loaded]**.

## Plugins Included

<details open>
  <summary><strong>List</strong> <small><i>(🔎 Click to expand/collapse)</i></small></summary>

### Non Lazy-Loaded Plugins

| Name           | Description
| -------------- | ----------------------
| [Shougo/dein.vim] | Dark powered Vim/Neovim plugin manager
| [rafi/awesome-colorschemes] | Awesome color-schemes
| [thinca/vim-localrc] | Enable configuration file of each directory
| [romainl/vim-cool] | Simple plugin that makes hlsearch more useful
| [sgur/vim-editorconfig] | EditorConfig plugin written entirely in Vimscript
| [christoomey/tmux-navigator] | Seamless navigation between tmux panes and vim splits
| [tpope/vim-sleuth] | Heuristically set buffer indent options
| [antoinemadec/FixCursorHold.nvim] | Neovim CursorHold workaround
| [roxma/nvim-yarp] | Vim8 remote plugin framework for Neovim
| [roxma/vim-hug-neovim-rpc] | Vim8 compatibility layer for neovim rpc client

### Lazy-Loaded Plugins

#### Language

| Name           | Description
| -------------- | ----------------------
| [hail2u/vim-css3-syntax] | CSS3 syntax support to vim's built-in `syntax/css.vim`
| [othree/csscomplete.vim] | Updated built-in CSS complete with latest standards
| [cakebaker/scss-syntax.vim] | Syntax file for scss (Sassy CSS)
| [groenewege/vim-less] | Syntax for LESS
| [iloginow/vim-stylus] | Syntax, indentation and autocomplete for Stylus
| [mustache/vim-mustache-handlebars] | Mustache and handlebars syntax
| [digitaltoad/vim-pug] | Pug (formerly Jade) syntax and indentation
| [othree/html5.vim] | HTML5 omnicomplete and syntax
| [plasticboy/vim-markdown] | Markdown syntax highlighting
| [pangloss/vim-javascript] | Enhanced Javascript syntax
| [HerringtonDarkholme/yats.vim] | Advanced TypeScript Syntax Highlighting
| [MaxMEllon/vim-jsx-pretty] | React JSX syntax pretty highlighting
| [leafOfTree/vim-svelte-plugin] | Syntax and indent plugin for Svelte
| [heavenshell/vim-jsdoc] | Generate JSDoc to your JavaScript code
| [jparise/vim-graphql] | GraphQL file detection, syntax highlighting, and indentation
| [moll/vim-node] | Superb development with Node.js
| [kchmck/vim-coffee-script] | CoffeeScript support
| [elzr/vim-json] | Better JSON support
| [posva/vim-vue] | Syntax Highlight for Vue.js components
| [vim-python/python-syntax] | Enhanced version of the original Python syntax
| [Vimjas/vim-python-pep8-indent] | A nicer Python indentation style
| [vim-scripts/python_match.vim] | Extend the % motion for Python files
| [raimon49/requirements.txt.vim] | Python requirements file format
| [StanAngeloff/php.vim] | Up-to-date PHP syntax file (5.3 – 7.1 support)
| [tbastos/vim-lua] | Lua 5.3 syntax and indentation improved support
| [vim-ruby/vim-ruby] | Ruby support
| [keith/swift.vim] | Swift support
| [rust-lang/rust.vim] | Rust support
| [vim-jp/syntax-vim-ex] | Improved Vim syntax highlighting
| [chrisbra/csv.vim] | Handling column separated data
| [tpope/vim-git] | Git runtime files
| [ekalinin/Dockerfile.vim] | Syntax and snippets for Dockerfile
| [tmux-plugins/vim-tmux] | Plugin for tmux.conf
| [MTDL9/vim-log-highlighting] | Syntax highlighting for generic log files
| [cespare/vim-toml] | Syntax for TOML
| [mboughaba/i3config.vim] | i3 window manager config syntax
| [dag/vim-fish] | Fish shell edit support
| [jstrater/mpvim] | Macports portfile configuration files
| [robbles/logstash.vim] | Highlights logstash configuration files
| [lifepillar/pgsql.vim] | PostgreSQL syntax and indent
| [chr4/nginx.vim] | Improved nginx syntax and indent
| [towolf/vim-helm] | Syntax for Helm templates (yaml + gotmpl + sprig)
| [udalov/kotlin-vim] | Kotlin syntax and indent
| [reasonml-editor/vim-reason-plus] | Reason syntax and indent
| [pearofducks/ansible-vim] | Improved YAML support for Ansible
| [hashivim/vim-terraform] | Base Terraform integration

#### Commands

| Name           | Description
| -------------- | ----------------------
| [Shougo/defx.nvim] | Dark powered file explorer implementation
| [kristijanhusak/defx-git] | Git status implementation for Defx
| [kristijanhusak/defx-icons] | Filetype icons for Defx
| [tyru/caw.vim] | Robust comment plugin with operator support
| [Shougo/context_filetype.vim] | Context filetype detection for nested code
| [lambdalisue/fin.vim] | Filter the buffer content in-place
| [mbbill/undotree] | Ultimate undo history visualizer
| [jreybert/vimagit] | Ease your git work-flow within Vim
| [tweekmonster/helpful.vim] | Display vim version numbers in docs
| [lambdalisue/gina.vim] | Asynchronously control git repositories
| [mhinz/vim-grepper] | Helps you win at grep
| [kana/vim-altr] | Switch to the alternate file without interaction
| [Shougo/vinarise.vim] | Hex editor
| [guns/xterm-color-table.vim] | Display 256 xterm colors with their RGB equivalents
| [cocopon/colorswatch.vim] | Generate a beautiful color swatch for the current buffer
| [dstein64/vim-startuptime] | Visually profile Vim's startup time
| [lambdalisue/suda.vim] | An alternative sudo.vim for Vim and Neovim
| [liuchengxu/vim-which-key] | Shows key-bindings in pop-up
| [brooth/far.vim] | Fast find and replace plugin
| [pechorin/any-jump.vim] | Jump to any definition and references without overhead
| [jaawerth/nrun.vim] | "which" and "exec" functions targeted at local node project bin
| [Vigemus/iron.nvim] | Interactive REPL over Neovim
| [kana/vim-niceblock] | Make blockwise Visual mode more useful
| [t9md/vim-choosewin] | Choose window to use, like tmux's 'display-pane'
| [wfxr/minimap.vim] | Blazing fast minimap for vim, powered by code-minimap
| [mzlogin/vim-markdown-toc] | Generate table of contents for Markdown files
| [reedes/vim-wordy] | Uncover usage problems in your writing
| [liuchengxu/vista.vim] | Viewer & Finder for LSP symbols and tags in Vim
| [junegunn/fzf] | Powerful command-line fuzzy finder
| [junegunn/fzf.vim] | Fzf integration
| [Ron89/thesaurus_query.vim] | Multi-language thesaurus query and replacement

#### Interface

| Name           | Description
| -------------- | ----------------------
| [itchyny/vim-gitbranch] | Lightweight git branch detection
| [itchyny/vim-parenmatch] | Efficient alternative to the standard matchparen plugin
| [haya14busa/vim-asterisk] | Improved * motions
| [rhysd/accelerated-jk] | Up/down movement acceleration
| [haya14busa/vim-edgemotion] | Jump to the edge of block
| [t9md/vim-quickhl] | Highlight words quickly
| [rafi/vim-sidemenu] | Small side-menu useful for terminal users
| [machakann/vim-highlightedyank] | Make the yanked region apparent
| [itchyny/cursorword] | Underlines word under cursor
| [airblade/vim-gitgutter] | Show git changes at Vim gutter and un/stages hunks
| [kshenoy/vim-signature] | Display and toggle marks
| [nathanaelkane/vim-indent-guides] | Visually display indent levels in code
| [rhysd/committia.vim] | Pleasant editing on Git commit messages
| [junegunn/goyo] | Distraction-free writing
| [junegunn/limelight] | Hyperfocus-writing
| [itchyny/calendar.vim] | Calendar application
| [deris/vim-shot-f] | Highlight characters to move directly with f/t/F/T
| [vimwiki/vimwiki] | Personal Wiki for Vim
| [norcalli/nvim-colorizer.lua] | The fastest Neovim colorizer

#### Completion & Code-Analysis

| Name           | Description
| -------------- | ----------------------
| [prabirshrestha/async.vim] | Normalize async job control API for Vim and Neovim
| [prabirshrestha/asyncomplete.vim] | Async-completion in pure Vimscript for Vim8 and Neovim
| [prabirshrestha/asyncomplete-lsp.vim] | Provide Language Server Protocol autocompletion source
| [prabirshrestha/vim-lsp] | Async Language Server Protocol plugin for Vim and Neovim
| [mattn/vim-lsp-settings] | Auto LSP configurations for vim-lsp
| [Shougo/neco-vim] | Completion source for Vimscript
| [prabirshrestha/asyncomplete-necovim.vim] | Provides syntax autocomplete via neco-vim
| [prabirshrestha/asyncomplete-buffer.vim] | Provides buffer autocomplete
| [prabirshrestha/asyncomplete-tags.vim] | Provides tag autocomplete via vim tagfiles
| [prabirshrestha/asyncomplete-file.vim] | Provides file autocomplete
| [wellle/tmux-complete.vim] | Completion of words in adjacent tmux panes
| [prabirshrestha/asyncomplete-ultisnips.vim] | Provides UltiSnips autocomplete
| [SirVer/ultisnips] | Ultimate snippet solution
| [honza/vim-snippets] | Community-maintained snippets for programming languages
| [mattn/emmet-vim] | Provides support for expanding abbreviations alá emmet
| [ludovicchabant/vim-gutentags] | Manages your tag files
| [Raimondi/delimitMate] | Auto-completion for quotes, parens, brackets

#### Denite & Clap

| Name           | Description
| -------------- | ----------------------
| [Shougo/denite.nvim] | Dark powered asynchronous unite all interfaces
| [Shougo/neomru.vim] | Denite plugin for MRU
| [Shougo/neoyank.vim] | Denite plugin for yank history
| [Shougo/junkfile.vim] | Denite plugin for temporary files
| [chemzqm/unite-location] | Denite location & quickfix lists
| [rafi/vim-denite-session] | Browse and open sessions
| [rafi/vim-denite-z] | Filter and browse Z (jump around) data file
| [liuchengxu/vim-clap] | Modern performant generic finder and dispatcher

#### Operators & Text Objects

| Name           | Description
| -------------- | ----------------------
| [kana/vim-operator-user] | Define your own custom operators
| [kana/vim-operator-replace] | Operator to replace text with register content
| [machakann/vim-sandwich] | Search, select, and edit sandwich text objects
| [kana/vim-textobj-user] | Create your own text objects
| [terryma/vim-expand-region] | Visually select increasingly larger regions of text
| [AndrewRadev/sideways.vim] | Match function arguments
| [AndrewRadev/splitjoin.vim] | Transition code between multi-line and single-line
| [AndrewRadev/linediff.vim] | Perform diffs on blocks of code
| [AndrewRadev/dsf.vim] | Delete surrounding function call
| [kana/vim-textobj-function] | Text objects for functions

[Shougo/dein.vim]: https://github.com/Shougo/dein.vim
[rafi/awesome-colorschemes]: https://github.com/rafi/awesome-vim-colorschemes
[thinca/vim-localrc]: https://github.com/thinca/vim-localrc
[romainl/vim-cool]: https://github.com/romainl/vim-cool
[sgur/vim-editorconfig]: https://github.com/sgur/vim-editorconfig
[christoomey/tmux-navigator]: https://github.com/christoomey/vim-tmux-navigator
[tpope/vim-sleuth]: https://github.com/tpope/vim-sleuth
[antoinemadec/FixCursorHold.nvim]: https://github.com/antoinemadec/FixCursorHold.nvim
[roxma/nvim-yarp]: https://github.com/roxma/nvim-yarp
[roxma/vim-hug-neovim-rpc]: https://github.com/roxma/vim-hug-neovim-rpc

[hail2u/vim-css3-syntax]: https://github.com/hail2u/vim-css3-syntax
[othree/csscomplete.vim]: https://github.com/othree/csscomplete.vim
[cakebaker/scss-syntax.vim]: https://github.com/cakebaker/scss-syntax.vim
[groenewege/vim-less]: https://github.com/groenewege/vim-less
[iloginow/vim-stylus]: https://github.com/iloginow/vim-stylus
[mustache/vim-mustache-handlebars]: https://github.com/mustache/vim-mustache-handlebars
[digitaltoad/vim-pug]: https://github.com/digitaltoad/vim-pug
[othree/html5.vim]: https://github.com/othree/html5.vim
[plasticboy/vim-markdown]: https://github.com/plasticboy/vim-markdown
[pangloss/vim-javascript]: https://github.com/pangloss/vim-javascript
[HerringtonDarkholme/yats.vim]: https://github.com/HerringtonDarkholme/yats.vim
[MaxMEllon/vim-jsx-pretty]: https://github.com/MaxMEllon/vim-jsx-pretty
[leafOfTree/vim-svelte-plugin]: https://github.com/leafOfTree/vim-svelte-plugin
[heavenshell/vim-jsdoc]: https://github.com/heavenshell/vim-jsdoc
[jparise/vim-graphql]: https://github.com/jparise/vim-graphql
[moll/vim-node]: https://github.com/moll/vim-node
[kchmck/vim-coffee-script]: https://github.com/kchmck/vim-coffee-script
[elzr/vim-json]: https://github.com/elzr/vim-json
[posva/vim-vue]: https://github.com/posva/vim-vue
[vim-python/python-syntax]: https://github.com/vim-python/python-syntax
[Vimjas/vim-python-pep8-indent]: https://github.com/Vimjas/vim-python-pep8-indent
[vim-scripts/python_match.vim]: https://github.com/vim-scripts/python_match.vim
[raimon49/requirements.txt.vim]: https://github.com/raimon49/requirements.txt.vim
[StanAngeloff/php.vim]: https://github.com/StanAngeloff/php.vim
[tbastos/vim-lua]: https://github.com/tbastos/vim-lua
[vim-ruby/vim-ruby]: https://github.com/vim-ruby/vim-ruby
[keith/swift.vim]: https://github.com/keith/swift.vim
[rust-lang/rust.vim]: https://github.com/rust-lang/rust.vim
[vim-jp/syntax-vim-ex]: https://github.com/vim-jp/syntax-vim-ex
[chrisbra/csv.vim]: https://github.com/chrisbra/csv.vim
[tpope/vim-git]: https://github.com/tpope/vim-git
[ekalinin/Dockerfile.vim]: https://github.com/ekalinin/Dockerfile.vim
[tmux-plugins/vim-tmux]: https://github.com/tmux-plugins/vim-tmux
[MTDL9/vim-log-highlighting]: https://github.com/MTDL9/vim-log-highlighting
[cespare/vim-toml]: https://github.com/cespare/vim-toml
[mboughaba/i3config.vim]: https://github.com/mboughaba/i3config.vim
[dag/vim-fish]: https://github.com/dag/vim-fish
[jstrater/mpvim]: https://github.com/jstrater/mpvim
[robbles/logstash.vim]: https://github.com/robbles/logstash.vim
[lifepillar/pgsql.vim]: https://github.com/lifepillar/pgsql.vim
[chr4/nginx.vim]: https://github.com/chr4/nginx.vim
[towolf/vim-helm]: https://github.com/towolf/vim-helm
[udalov/kotlin-vim]: https://github.com/udalov/kotlin-vim
[reasonml-editor/vim-reason-plus]: https://github.com/reasonml-editor/vim-reason-plus
[pearofducks/ansible-vim]: https://github.com/pearofducks/ansible-vim
[hashivim/vim-terraform]: https://github.com/hashivim/vim-terraform

[Shougo/defx.nvim]: https://github.com/Shougo/defx.nvim
[kristijanhusak/defx-git]: https://github.com/kristijanhusak/defx-git
[kristijanhusak/defx-icons]: https://github.com/kristijanhusak/defx-icons
[tyru/caw.vim]: https://github.com/tyru/caw.vim
[Shougo/context_filetype.vim]: https://github.com/Shougo/context_filetype.vim
[lambdalisue/fin.vim]: https://github.com/lambdalisue/fin.vim
[mbbill/undotree]: https://github.com/mbbill/undotree
[jreybert/vimagit]: https://github.com/jreybert/vimagit
[tweekmonster/helpful.vim]: https://github.com/tweekmonster/helpful.vim
[lambdalisue/gina.vim]: https://github.com/lambdalisue/gina.vim
[mhinz/vim-grepper]: https://github.com/mhinz/vim-grepper
[kana/vim-altr]: https://github.com/kana/vim-altr
[Shougo/vinarise.vim]: https://github.com/Shougo/vinarise.vim
[guns/xterm-color-table.vim]: https://github.com/guns/xterm-color-table.vim
[cocopon/colorswatch.vim]: https://github.com/cocopon/colorswatch.vim
[dstein64/vim-startuptime]: https://github.com/dstein64/vim-startuptime
[lambdalisue/suda.vim]: https://github.com/lambdalisue/suda.vim
[liuchengxu/vim-which-key]: https://github.com/liuchengxu/vim-which-key
[brooth/far.vim]: https://github.com/brooth/far.vim
[pechorin/any-jump.vim]: https://github.com/pechorin/any-jump.vim
[jaawerth/nrun.vim]: https://github.com/jaawerth/nrun.vim
[Vigemus/iron.nvim]: https://github.com/Vigemus/iron.nvim
[kana/vim-niceblock]: https://github.com/kana/vim-niceblock
[t9md/vim-choosewin]: https://github.com/t9md/vim-choosewin
[wfxr/minimap.vim]: https://github.com/wfxr/minimap.vim
[mzlogin/vim-markdown-toc]: https://github.com/mzlogin/vim-markdown-toc
[reedes/vim-wordy]: https://github.com/reedes/vim-wordy
[liuchengxu/vista.vim]: https://github.com/liuchengxu/vista.vim
[junegunn/fzf]: https://github.com/junegunn/fzf
[junegunn/fzf.vim]: https://github.com/junegunn/fzf.vim
[Ron89/thesaurus_query.vim]: https://github.com/Ron89/thesaurus_query.vim

[itchyny/vim-gitbranch]: https://github.com/itchyny/vim-gitbranch
[itchyny/vim-parenmatch]: https://github.com/itchyny/vim-parenmatch
[haya14busa/vim-asterisk]: https://github.com/haya14busa/vim-asterisk
[rhysd/accelerated-jk]: https://github.com/rhysd/accelerated-jk
[haya14busa/vim-edgemotion]: https://github.com/haya14busa/vim-edgemotion
[t9md/vim-quickhl]: https://github.com/t9md/vim-quickhl
[rafi/vim-sidemenu]: https://github.com/rafi/vim-sidemenu
[machakann/vim-highlightedyank]: https://github.com/machakann/vim-highlightedyank
[itchyny/cursorword]: https://github.com/itchyny/vim-cursorword
[airblade/vim-gitgutter]: https://github.com/airblade/vim-gitgutter
[kshenoy/vim-signature]: https://github.com/kshenoy/vim-signature
[nathanaelkane/vim-indent-guides]: https://github.com/nathanaelkane/vim-indent-guides
[rhysd/committia.vim]: https://github.com/rhysd/committia.vim
[junegunn/goyo]: https://github.com/junegunn/goyo.vim
[junegunn/limelight]: https://github.com/junegunn/limelight.vim
[itchyny/calendar.vim]: https://github.com/itchyny/calendar.vim
[deris/vim-shot-f]: https://github.com/deris/vim-shot-f
[vimwiki/vimwiki]: https://github.com/vimwiki/vimwiki
[norcalli/nvim-colorizer.lua]: https://github.com/norcalli/nvim-colorizer.lua

[prabirshrestha/async.vim]: https://github.com/prabirshrestha/async.vim
[prabirshrestha/asyncomplete.vim]: https://github.com/prabirshrestha/asyncomplete.vim
[prabirshrestha/asyncomplete-lsp.vim]: https://github.com/prabirshrestha/asyncomplete-lsp.vim
[prabirshrestha/vim-lsp]: https://github.com/prabirshrestha/vim-lsp
[mattn/vim-lsp-settings]: https://github.com/mattn/vim-lsp-settings
[Shougo/neco-vim]: https://github.com/Shougo/neco-vim
[prabirshrestha/asyncomplete-necovim.vim]: https://github.com/prabirshrestha/asyncomplete-necovim.vim
[prabirshrestha/asyncomplete-buffer.vim]: https://github.com/prabirshrestha/asyncomplete-buffer.vim
[prabirshrestha/asyncomplete-tags.vim]: https://github.com/prabirshrestha/asyncomplete-tags.vim
[prabirshrestha/asyncomplete-file.vim]: https://github.com/prabirshrestha/asyncomplete-file.vim
[wellle/tmux-complete.vim]: https://github.com/wellle/tmux-complete.vim
[prabirshrestha/asyncomplete-ultisnips.vim]: https://github.com/prabirshrestha/asyncomplete-ultisnips.vim
[SirVer/ultisnips]: https://github.com/SirVer/ultisnips
[honza/vim-snippets]: https://github.com/honza/vim-snippets
[mattn/emmet-vim]: https://github.com/mattn/emmet-vim
[ludovicchabant/vim-gutentags]: https://github.com/ludovicchabant/vim-gutentags
[Raimondi/delimitMate]: https://github.com/Raimondi/delimitMate

[Shougo/denite.nvim]: https://github.com/Shougo/denite.nvim
[Shougo/neomru.vim]: https://github.com/Shougo/neomru.vim
[Shougo/neoyank.vim]: https://github.com/Shougo/neoyank.vim
[Shougo/junkfile.vim]: https://github.com/Shougo/junkfile.vim
[chemzqm/unite-location]: https://github.com/chemzqm/unite-location
[rafi/vim-denite-session]: https://github.com/rafi/vim-denite-session
[rafi/vim-denite-z]: https://github.com/rafi/vim-denite-z
[liuchengxu/vim-clap]: https://github.com/liuchengxu/vim-clap

[kana/vim-operator-user]: https://github.com/kana/vim-operator-user
[kana/vim-operator-replace]: https://github.com/kana/vim-operator-replace
[machakann/vim-sandwich]: https://github.com/machakann/vim-sandwich
[kana/vim-textobj-user]: https://github.com/kana/vim-textobj-user
[terryma/vim-expand-region]: https://github.com/terryma/vim-expand-region
[AndrewRadev/sideways.vim]: https://github.com/AndrewRadev/sideways.vim
[AndrewRadev/splitjoin.vim]: https://github.com/AndrewRadev/splitjoin.vim
[AndrewRadev/linediff.vim]: https://github.com/AndrewRadev/linediff.vim
[AndrewRadev/dsf.vim]: https://github.com/AndrewRadev/dsf.vim
[kana/vim-textobj-function]: https://github.com/kana/vim-textobj-function

</details>

## Custom Key-mappings

Note that,

* **Leader** key set as <kbd>,</kbd>
* **Local-Leader** key set as <kbd>;</kbd> and used for navigation and search
  (Denite and Defx)
* Disable <kbd>←</kbd> <kbd>↑</kbd> <kbd>→</kbd> <kbd>↓</kbd> in normal mode by enabling `g:elite_mode` in `.vault.vim`

<details open>
  <summary>
    <strong>Key-mappings</strong>
    <small><i>(🔎 Click to expand/collapse)</i></small>
  </summary>

<center>Modes: 𝐍=normal 𝐕=visual 𝐒=select 𝐈=insert 𝐂=command</center>

### Navigation

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>j</kbd> / <kbd>k</kbd> | 𝐍 𝐕 | Cursor moves through display-lines | `g` `j/k`
| <kbd>g</kbd>+<kbd>j</kbd> / <kbd>k</kbd> | 𝐍 𝐕 𝐒 | Jump to edge upward/downward | <small>[haya14busa/vim-edgemotion]</small>
| <kbd>gh</kbd> / <kbd>gl</kbd> | 𝐍 𝐕 | Easier line-wise movement | `g` `^/$`
| <kbd>Space</kbd>+<kbd>Space</kbd> | 𝐍 𝐕 | Toggle visual-line mode | `V` / <kbd>Escape</kbd>
| <kbd>v</kbd> / <kbd>V</kbd> | 𝐕 | Expand/reduce selection | <small>[terryma/vim-expand-region]</small>
| <kbd>zl</kbd> / <kbd>zh</kbd> | 𝐍 | Scroll horizontally and vertically wider | `z4` `l/h`
| <kbd>Ctrl</kbd>+<kbd>j</kbd> | 𝐍 | Move to split below | <small>[christoomey/tmux-navigator]</small>
| <kbd>Ctrl</kbd>+<kbd>k</kbd> | 𝐍 | Move to upper split | <small>[christoomey/tmux-navigator]</small>
| <kbd>Ctrl</kbd>+<kbd>h</kbd> | 𝐍 | Move to left split | <small>[christoomey/tmux-navigator]</small>
| <kbd>Ctrl</kbd>+<kbd>l</kbd> | 𝐍 | Move to right split | <small>[christoomey/tmux-navigator]</small>
| <kbd>Return</kbd> | 𝐍 | Toggle fold | `za`
| <kbd>Shift</kbd>+<kbd>Return</kbd> | 𝐍 | Focus the current fold by closing all others | `zMzvzt`
| <kbd>]q</kbd> or <kbd>]q</kbd> | 𝐍 | Next/previous on quickfix list | `:cnext` / `:cprev`
| <kbd>]l</kbd> or <kbd>]l</kbd> | 𝐍 | Next/previous on location-list | `:lnext` / `:lprev`
| <kbd>]w</kbd> or <kbd>]w</kbd> | 𝐍 | Next/previous whitespace error | <small>[plugin/whitespace.vim]</small>
| <kbd>]g</kbd> or <kbd>]g</kbd> | 𝐍 | Next/previous Git hunk | <small>[airblade/vim-gitgutter]</small>
| <kbd>]d</kbd> or <kbd>]d</kbd> | 𝐍 | Next/previous LSP diagnostic | <small>[mattn/vim-lsp-settings]</small>
| <kbd>Ctrl</kbd>+<kbd>f</kbd> | 𝐂 | Move cursor forwards in command | <kbd>Right</kbd>
| <kbd>Ctrl</kbd>+<kbd>b</kbd> | 𝐂 | Move cursor backwards in command | <kbd>Left</kbd>
| <kbd>Ctrl</kbd>+<kbd>h</kbd> | 𝐂 | Move cursor to the beginning in command | <kbd>Home</kbd>
| <kbd>Ctrl</kbd>+<kbd>l</kbd> | 𝐂 | Move cursor to the end in command | <kbd>End</kbd>

### File Operations

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>Space</kbd>+<kbd>cd</kbd> | 𝐍 | Switch to the directory of opened buffer | `:lcd %:p:h`
| <kbd>gf</kbd> | 𝐍 𝐕 | Open file under the cursor in a vsplit | `:rightbelow wincmd f`
| <kbd>Space</kbd>+<kbd>w</kbd> | 𝐍 𝐕 𝐒 | Write buffer to file | `:write`
| <kbd>Ctrl</kbd>+<kbd>s</kbd> | 𝐍 𝐕 𝐒 𝐂 | Write buffer to file | `:write`

### Edit

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>Ctrl</kbd>+<kbd>Return</kbd> | 𝐈 | Expand emmet abbreviation | <small>[mattn/emmet-vim]</small>
| <kbd>Q</kbd> | 𝐍 | Start/stop macro recording | `q`
| <kbd>gQ</kbd> | 𝐍 | Play macro 'q' | `@q`
| <kbd>Shift</kbd>+<kbd>Return</kbd> | 𝐈 | Start new line from any cursor position | `<C-o>o`
| <kbd><</kbd> | 𝐕 𝐒 | Indent to left and re-select | `<gv`
| <kbd>></kbd> | 𝐕 𝐒 | Indent to right and re-select | `>gv|`
| <kbd>Tab</kbd> | 𝐕 𝐒 | Indent to right and re-select | `>gv|`
| <kbd>Shift</kbd>+<kbd>Tab</kbd> | 𝐕 𝐒 | Indent to left and re-select | `<gv`
| <kbd>gc</kbd> | 𝐍 𝐕 𝐒 | Caw (comments plugin) prefix | <small>[tyru/caw.vim]</small>
| <kbd>gcc</kbd> | 𝐍 𝐕 𝐒 | Toggle comments | <small>[tyru/caw.vim]</small>
| <kbd>Space</kbd>+<kbd>v</kbd> | 𝐍 𝐕 𝐒 | Toggle single-line comments | <small>[tyru/caw.vim]</small>
| <kbd>Space</kbd>+<kbd>V</kbd> | 𝐍 𝐕 𝐒 | Toggle comment block | <small>[tyru/caw.vim]</small>
| <kbd>Space</kbd>+<kbd>j</kbd> or <kbd>k</kbd> | 𝐍 𝐕 | Move lines down/up | `:m` …
| <kbd>Space</kbd>+<kbd>d</kbd> | 𝐍 𝐕 | Duplicate line or selection |
| <kbd>Space</kbd>+<kbd>cn</kbd> / <kbd>cN</kbd> | 𝐍 𝐕 | Change current word in a repeatable manner |
| <kbd>Space</kbd>+<kbd>cp</kbd> | 𝐍 | Duplicate paragraph | `yap<S-}>p`
| <kbd>Space</kbd>+<kbd>cw</kbd> | 𝐍 | Remove all spaces at EOL | `:%s/\s\+$//e`
| <kbd>Ctrl</kbd>+<kbd>g</kbd> <kbd>g</kbd> | 𝐈 | Jump outside of pair | <small>[Raimondi/delimitMate]</small>
| <kbd>sj</kbd> / <kbd>sk</kbd> | 𝐍 | Join/split arguments | <small>[AndrewRadev/splitjoin.vim]</small>
| <kbd>dsf</kbd> / <kbd>csf</kbd> | 𝐍 | Delete/change surrounding function call | <small>[AndrewRadev/dsf.vim]</small>

### Search & Replace

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>Space</kbd>+<kbd>f</kbd> | 𝐍 | Filter lines in-place | <small>[lambdalisue/fin.vim]</small>
| <kbd>\*</kbd> / <kbd>#</kbd> | 𝐍 𝐕 | Search selection forward/backward | <small>[haya14busa/vim-asterisk]</small>
| <kbd>g\*</kbd> / <kbd>g#</kbd> | 𝐍 𝐕 | Search whole-word forward/backward | <small>[haya14busa/vim-asterisk]</small>
| <kbd>Backspace</kbd> | 𝐍 | Match bracket | `%`
| <kbd>gp</kbd> | 𝐍 | Select last paste |
| <kbd>sg</kbd> | 𝐕 | Replace within selected area | `:s/⌴/gc`
| <kbd>Ctrl</kbd>+<kbd>r</kbd> | 𝐕 | Replace selection with step-by-step confirmation | `:%s/\V/⌴/gc`

### Clipboard

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>p</kbd> | 𝐕 𝐒 | Paste without yank | <small>[kana/vim-operator-replace]</small>
| <kbd>Y</kbd> | 𝐍 | Yank to the end of line | `y$`
| <kbd>Space</kbd>+<kbd>y</kbd> | 𝐍 | Copy relative file-path to clipboard |
| <kbd>Space</kbd>+<kbd>Y</kbd> | 𝐍 | Copy absolute file-path to clipboard |

### Command & History

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>!</kbd> | 𝐍 | Shortcut for shell command | `:!`
| <kbd>g!</kbd> | 𝐍 | Read vim command into buffer | `:put=execute('⌴')`
| <kbd>Ctrl</kbd>+<kbd>n</kbd> / <kbd>p</kbd> | 𝐂 | Switch history search pairs | <kbd>↓</kbd> / <kbd>↑</kbd>
| <kbd>↓</kbd> / <kbd>↑</kbd> | 𝐂 | Switch history search pairs | `Ctrl` `n`/`p`

### Editor UI

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>Space</kbd>+<kbd>ts</kbd> | 𝐍 | Toggle spell-checker | <small>`:setlocal spell!`</small>
| <kbd>Space</kbd>+<kbd>tn</kbd> | 𝐍 | Toggle line numbers | <small>`:setlocal nonumber!`</small>
| <kbd>Space</kbd>+<kbd>tl</kbd> | 𝐍 | Toggle hidden characters | <small>`:setlocal nolist!`</small>
| <kbd>Space</kbd>+<kbd>th</kbd> | 𝐍 | Toggle highlighted search | <small>`:set hlsearch!`</small>
| <kbd>Space</kbd>+<kbd>tw</kbd> | 𝐍 | Toggle wrap | <small>`:setlocal wrap!`</small> …
| <kbd>Space</kbd>+<kbd>ti</kbd> | 𝐍 | Toggle indentation lines | <small>[nathanaelkane/vim-indent-guides]</small>
| <kbd>g1</kbd> | 𝐍 | Go to first tab | `:tabfirst`
| <kbd>g9</kbd> | 𝐍 | Go to last tab | `:tablast`
| <kbd>g5</kbd> | 𝐍 | Go to previous tab | `:tabprevious`
| <kbd>Ctrl</kbd>+<kbd>Tab</kbd> | 𝐍 | Go to next tab | `:tabnext`
| <kbd>Ctrl</kbd>+<kbd>Shift</kbd><kbd>Tab</kbd> | 𝐍 | Go to previous tab | `:tabprevious`
| <kbd>Alt</kbd>+<kbd>j</kbd> | 𝐍 | Go to next tab | `:tabnext`
| <kbd>Alt</kbd>+<kbd>k</kbd> | 𝐍 | Go to previous tab | `:tabprevious`
| <kbd>Alt</kbd>+<kbd>{</kbd> | 𝐍 | Move tab backward | `:-tabmove`
| <kbd>Alt</kbd>+<kbd>}</kbd> | 𝐍 | Move tab forward | `:+tabmove`
| <kbd>Space</kbd>+<kbd>h</kbd> | 𝐍 | Show highlight groups for word |

### Custom Tools & Plugins

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>-</kbd> | 𝐍 | Choose a window to edit | <small>[t9md/vim-choosewin]</small>
| <kbd>;</kbd>+<kbd>c</kbd> | 𝐍 | Open context-menu | <small>[plugin/actionmenu.vim]</small>
| <kbd>gK</kbd> | 𝐍 | Open Zeal or Dash on some file-types | <small>[plugin/devhelp.vim]</small>
| <kbd>g</kbd><kbd>Ctrl</kbd>+<kbd>o</kbd> | 𝐍 | Navigate to previous file on jumplist | <small>[plugin/jumpfile.vim]</small>
| <kbd>g</kbd><kbd>Ctrl</kbd>+<kbd>i</kbd> | 𝐍 | Navigate to next file on jumplist | <small>[plugin/jumpfile.vim]</small>
| <kbd>Space</kbd>+<kbd>l</kbd> | 𝐍 | Open side-menu helper | <small>[rafi/vim-sidemenu]</small>
| <kbd>Space</kbd>+<kbd>b</kbd> | 𝐍 | Open structure window | <small>[liuchengxu/vista.vim]</small>
| <kbd>Space</kbd>+<kbd>a</kbd> | 𝐍 | Show nearby tag in structure window | <small>[liuchengxu/vista.vim]</small>
| <kbd>Space</kbd>+<kbd>se</kbd> | 𝐍 | Save current workspace session | <small>[plugin/sessions.vim]</small>
| <kbd>Space</kbd>+<kbd>sl</kbd> | 𝐍 | Load workspace session | <small>[plugin/sessions.vim]</small>
| <kbd>Space</kbd>+<kbd>n</kbd>/<kbd>N</kbd> | 𝐍 | Open alternative file | <small>[kana/vim-altr]</small>
| <kbd>Space</kbd>+<kbd>tc</kbd> | 𝐍 | Enable scroll-context window | <small>[wellle/context.vim]</small>
| <kbd>Space</kbd>+<kbd>tp</kbd> | 𝐍 | Peek scroll-context window | <small>[wellle/context.vim]</small>
| <kbd>Space</kbd>+<kbd>S</kbd> | 𝐍 𝐕 | Source selection | `y:execute @@`
| <kbd>Space</kbd>+<kbd>?</kbd> | 𝐍 | Open the macOS dictionary on current word | `:!open dict://`
| <kbd>Space</kbd>+<kbd>P</kbd> | 𝐍 | Use Marked 2 for real-time Markdown preview | <small>[Marked 2]</small>
| <kbd>Space</kbd>+<kbd>ml</kbd> | 𝐍 | Append modeline to end of buffer | <small>[config/mappings.vim]</small>
| <kbd>Space</kbd>+<kbd>mda</kbd> | 𝐕 | Sequentially mark region for diff | <small>[AndrewRadev/linediff.vim]</small>
| <kbd>Space</kbd>+<kbd>mdf</kbd> | 𝐕 | Mark region for diff and compare if more than one | <small>[AndrewRadev/linediff.vim]</small>
| <kbd>Space</kbd>+<kbd>mds</kbd> | 𝐍 | Shows the comparison for all marked regions | <small>[AndrewRadev/linediff.vim]</small>
| <kbd>Space</kbd>+<kbd>mdr</kbd> | 𝐍 | Removes the signs denoting the diff regions | <small>[AndrewRadev/linediff.vim]</small>
| <kbd>Space</kbd>+<kbd>mg</kbd> | 𝐍 | Open Magit | <small>[jreybert/vimagit]</small>
| <kbd>Space</kbd>+<kbd>mt</kbd> | 𝐍 𝐕 | Toggle highlighted word | <small>[t9md/vim-quickhl]</small>
| <kbd>Space</kbd>+<kbd>-</kbd> | 𝐍 | Switch editing window with selected | <small>[t9md/vim-choosewin]</small>
| <kbd>Space</kbd>+<kbd>G</kbd> | 𝐍 | Toggle distraction-free writing | <small>[junegunn/goyo]</small>
| <kbd>Space</kbd>+<kbd>gu</kbd> | 𝐍 | Open undo-tree | <small>[mbbill/undotree]</small>
| <kbd>Space</kbd>+<kbd>K</kbd> | 𝐍 | Thesaurus | <small>[Ron89/thesaurus_query.vim]</small>
| <kbd>Space</kbd>+<kbd>W</kbd> | 𝐍 | VimWiki | <small>[vimwiki/vimwiki]</small>

### Window Management

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>q</kbd> | 𝐍 | Quit window (and Vim, if last window) | `:quit`
| <kbd>Ctrl</kbd>+<kbd>q</kbd> | 𝐍 | Remap to C-w | <kbd>Ctrl</kbd>+<kbd>w</kbd>
| <kbd>Ctrl</kbd>+<kbd>x</kbd> | 𝐍 | Rotate window placement | `C-w` `x`
| <kbd>sv</kbd> | 𝐍 | Horizontal split | `:split`
| <kbd>sg</kbd> | 𝐍 | Vertical split | `:vsplit`
| <kbd>st</kbd> | 𝐍 | Open new tab | `:tabnew`
| <kbd>so</kbd> | 𝐍 | Close other windows | `:only`
| <kbd>sb</kbd> | 𝐍 | Previous buffer | `:b#`
| <kbd>sc</kbd> | 𝐍 | Close current buffer | `:close`
| <kbd>sx</kbd> | 𝐍 | Delete buffer, leave blank window | `:enew │ bdelete`
| <kbd>sz</kbd> | 𝐍 | Toggle window zoom | `:vertical resize │ resize`
| <kbd>ssv</kbd> | 𝐍 | Split with previous buffer | `:split │ wincmd p │ e#`
| <kbd>ssg</kbd> | 𝐍 | Vertical split with previous buffer | `:vsplit │ wincmd p │ e#`
| <kbd>sh</kbd> | 𝐍 | Toggle colorscheme background=dark/light | `:set background` …
| <kbd>s-</kbd> | 𝐍 | Lower solarized8 colorscheme contrast | `:colorscheme ` …
| <kbd>s=</kbd> | 𝐍 | Raise solarized8 colorscheme contrast | `:colorscheme ` …

### Git Version Control

| Key   | Mode | Action             | Plugin or Mapping
| ----- |:----:| ------------------ | ------
| <kbd>gs</kbd> | 𝐍 | Preview hunk | <small>[airblade/vim-gitgutter]</small>
| <kbd>gS</kbd> | 𝐍 𝐕 𝐒 | Stage hunk | <small>[airblade/vim-gitgutter]</small>
| <kbd>Space</kbd>+<kbd>gr</kbd> | 𝐍 | Revert hunk | <small>[airblade/vim-gitgutter]</small>
| <kbd>Space</kbd>+<kbd>ga</kbd> | 𝐍 | Git add current file | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gd</kbd> | 𝐍 | Git diff | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gc</kbd> | 𝐍 | Git branches | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gc</kbd> | 𝐍 | Git commit | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gb</kbd> | 𝐍 | Git blame | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gs</kbd> | 𝐍 | Git status -s | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gl</kbd> | 𝐍 | Git log --all | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gF</kbd> | 𝐍 | Git fetch | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>gp</kbd> | 𝐍 | Git push | <small>[lambdalisue/gina.vim]</small>
| <kbd>Space</kbd>+<kbd>go</kbd> | 𝐍 𝐕 | Open SCM detailed URL in browser | <small>[lambdalisue/gina.vim]</small>

### Plugin: Denite

| Key   | Mode | Action
| ----- |:----:| ------------------
| <kbd>;r</kbd> | 𝐍 | Resumes last Denite window
| <kbd>;f</kbd> | 𝐍 | File search
| <kbd>;g</kbd> | 𝐍 | Grep search
| <kbd>;b</kbd> | 𝐍 | Buffers
| <kbd>;i</kbd> | 𝐍 | Old files
| <kbd>;x</kbd> | 𝐍 | Most recently used files (MRU)
| <kbd>;d</kbd> | 𝐍 | Directories and MRU
| <kbd>;v</kbd> | 𝐍 𝐕 | Yank history
| <kbd>;l</kbd> | 𝐍 | Location list
| <kbd>;q</kbd> | 𝐍 | Quick fix
| <kbd>;m</kbd> | 𝐍 | Marks
| <kbd>;n</kbd> | 𝐍 | Dein plugin list
| <kbd>;j</kbd> | 𝐍 | Jump points and change stack
| <kbd>;u</kbd> | 𝐍 | Junk files
| <kbd>;o</kbd> | 𝐍 | Outline tags
| <kbd>;s</kbd> | 𝐍 | Sessions
| <kbd>;t</kbd> | 𝐍 | Tag list
| <kbd>;p</kbd> | 𝐍 | Jumps
| <kbd>;h</kbd> | 𝐍 | Help
| <kbd>;w</kbd> | 𝐍 | Memo list
| <kbd>;z</kbd> | 𝐍 | Z (jump around)
| <kbd>;;</kbd> | 𝐍 | Command history
| <kbd>;/</kbd> | 𝐍 | Buffer lines
| <kbd>;\*</kbd> | 𝐍 | Search word under cursor with lines
| <kbd>Space</kbd>+<kbd>gt</kbd> | 𝐍 | Find tags matching word under cursor
| <kbd>Space</kbd>+<kbd>gf</kbd> | 𝐍 | Find files matching word under cursor
| <kbd>Space</kbd>+<kbd>gg</kbd> | 𝐍 𝐕 | Grep word under cursor
| **Within _Denite_ window** ||
| <kbd>jj</kbd> or <kbd>Escape</kbd> | 𝐈 | Leave Insert mode
| <kbd>i</kbd> or <kbd>/</kbd> | 𝐍 | Enter Insert mode (filter input)
| <kbd>q</kbd> or <kbd>Escape</kbd> | 𝐍 | Exit denite window
| <kbd>Tab</kbd> or <kbd>Shift</kbd>+<kbd>Tab</kbd> | 𝐈 | Next/previous candidate
| <kbd>Space</kbd> | 𝐍 | Select candidate entry
| <kbd>dd</kbd> | 𝐍 | Delete entry
| <kbd>p</kbd> | 𝐍 | Preview entry
| <kbd>st</kbd> | 𝐍 | Open in a new tab
| <kbd>sg</kbd> | 𝐍 | Open in a vertical split
| <kbd>sv</kbd> | 𝐍 | Open in a split
| <kbd>'</kbd> | 𝐍 | Quick-move
| <kbd>r</kbd> | 𝐍 | Redraw
| <kbd>yy</kbd> | 𝐍 | Yank
| <kbd>Tab</kbd> | 𝐍 | List and choose action

### Plugin: Defx

| Key   | Mode | Action
| ----- |:----:| ------------------
| <kbd>;e</kbd> | 𝐍 | Open file-explorer (toggle)
| <kbd>;a</kbd> | 𝐍 | Focus current file in file-explorer
| **Within _Defx_ window** ||
| <kbd>j</kbd> or <kbd>k</kbd> | 𝐍 | Move up and down the tree
| <kbd>l</kbd> or <kbd>Return</kbd> | 𝐍 | Toggle collapse/expand directory or open file
| <kbd>h</kbd> | 𝐍 | Collapse directory tree
| <kbd>t</kbd> | 𝐍 | Expand directory tree recursively
| <kbd>.</kbd> | 𝐍 | Toggle hidden files
| <kbd>Space</kbd> | 𝐍 | Select entry
| <kbd>\*</kbd> | 𝐍 | Invert selection (select all)
| <kbd>&</kbd> or <kbd>\</kbd> | 𝐍 | Change into current working directory
| <kbd>~</kbd> | 𝐍 | Change to user home directory
| <kbd>u</kbd> or <kbd>Backspace</kbd> | 𝐍 | Change into parent directory
| <kbd>u</kbd> <kbd>2</kbd>/<kbd>3</kbd>/<kbd>4</kbd> | 𝐍 | Change into parent directory count
| <kbd>st</kbd> | 𝐍 | Open file in new tab
| <kbd>sv</kbd> | 𝐍 | Open file in a horizontal split
| <kbd>sg</kbd> | 𝐍 | Open file in a vertical split
| <kbd>N</kbd> | 𝐍 | Create new directories and/or files
| <kbd>K</kbd> | 𝐍 | Create new directory
| <kbd>c</kbd> / <kbd>m</kbd> / <kbd>p</kbd> | 𝐍 | Copy, move, and paste
| <kbd>r</kbd> | 𝐍 | Rename file or directory
| <kbd>dd</kbd> | 𝐍 | Trash selected files and directories
| <kbd>y</kbd> | 𝐍 | Yank path to clipboard
| <kbd>w</kbd> | 𝐍 | Toggle window size
| <kbd>]g</kbd> | 𝐍 | Next dirty git item
| <kbd>[g</kbd> | 𝐍 | Previous dirty git item
| <kbd>x</kbd> or <kbd>gx</kbd> | 𝐍 | Execute associated system application
| <kbd>gd</kbd> | 𝐍 | Open git diff on selected file
| <kbd>gl</kbd> | 𝐍 | Open terminal file explorer with tmux
| <kbd>gr</kbd> | 𝐍 | Grep in current position
| <kbd>gf</kbd> | 𝐍 | Find files in current position

### Plugin: Clap

| Key   | Mode | Action
| ----- |:----:| ------------------
| **Within _Clap_ window** ||
| <kbd>jj</kbd> or <kbd>Escape</kbd> | 𝐈 | Leave Insert mode
| <kbd>i</kbd> | 𝐍 | Enter Insert mode (filter input)
| <kbd>q</kbd> or <kbd>Escape</kbd> | 𝐍 | Exit clap window
| <kbd>Tab</kbd> or <kbd>Shift</kbd>+<kbd>Tab</kbd> | 𝐈 | Next/previous candidate
| <kbd>Space</kbd> or <kbd>\'</kbd> | 𝐍 | Select candidate entry
| <kbd>st</kbd> | 𝐍 | Open in a new tab
| <kbd>sg</kbd> | 𝐍 | Open in a vertical split
| <kbd>sv</kbd> | 𝐍 | Open in a split

### Plugin: Asyncomplete and Emmet

| Key   | Mode | Action
| ----- |:----:| ------------------
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 | Navigate completion-menu
| <kbd>Enter</kbd> | 𝐈 | Select completion or expand snippet
| <kbd>Ctrl</kbd>+<kbd>j</kbd>/<kbd>k</kbd>/<kbd>d</kbd>/<kbd>u</kbd> | 𝐈 | Movement in completion pop-up
| <kbd>Ctrl</kbd>+<kbd>Return</kbd> | 𝐈 | Expand Emmet sequence
| <kbd>Ctrl</kbd>+<kbd>Space</kbd> | 𝐈 | Refresh and show candidates
| <kbd>Ctrl</kbd>+<kbd>y</kbd> | 𝐈 | Close pop-up
| <kbd>Ctrl</kbd>+<kbd>e</kbd> | 𝐈 | Cancel selection and close pop-up
| <kbd>Ctrl</kbd>+<kbd>l</kbd> | 𝐈 | Expand snippet at cursor
| <kbd>Tab</kbd> / <kbd>Shift-Tab</kbd> | 𝐈 𝐒 | Navigate snippet placeholders

### Plugin: Any-Jump

| Key   | Mode | Action
| ----- |:----:| ------------------
| <kbd>Space</kbd>+<kbd>ii</kbd> | 𝐍 | Jump to definition under cursor
| <kbd>Space</kbd>+<kbd>ii</kbd> | 𝐕 | Jump to selected text in visual mode
| <kbd>Space</kbd>+<kbd>ib</kbd> | 𝐍 | Open previous opened file (after jump)
| <kbd>Space</kbd>+<kbd>il</kbd> | 𝐍 | Open last closed search window again

### Plugin: Signature

| Key   | Mode | Action
| ----- |:----:| ------------------
| <kbd>m/</kbd> or <kbd>m?</kbd> | 𝐍 | Show list of buffer marks/markers
| <kbd>mm</kbd> | 𝐍 | Toggle mark on current line
| <kbd>m,</kbd> | 𝐍 | Place next mark
| <kbd>m</kbd> <kbd>a-z</kbd> | 𝐍 | Place specific mark (Won't work for: <kbd>mm</kbd>, <kbd>mn</kbd>, <kbd>mp</kbd>)
| <kbd>dm</kbd> <kbd>a-z</kbd> | 𝐍 | Remove specific mark (Won't work for: <kbd>mm</kbd>, <kbd>mn</kbd>, <kbd>mp</kbd>)
| <kbd>mn</kbd> | 𝐍 | Jump to next mark
| <kbd>mp</kbd> | 𝐍 | Jump to previous mark
| <kbd>]=</kbd> | 𝐍 | Jump to next marker
| <kbd>[=</kbd> | 𝐍 | Jump to previous marker
| <kbd>m-</kbd> | 𝐍 | Purge all on current line
| <kbd>m</kbd> <kbd>Space</kbd> | 𝐍 | Purge marks
| <kbd>m</kbd> <kbd>Backspace</kbd> | 𝐍 | Purge markers

</details>

## Credits & Contribution

Big thanks to the dark knight [Shougo](https://github.com/Shougo).

[config/mappings.vim]: ./config/mappings.vim
[plugin/whitespace.vim]: ./plugin/whitespace.vim
[plugin/sessions.vim]: ./plugin/sessions.vim
[plugin/devhelp.vim]: ./plugin/devhelp.vim
[plugin/jumpfile.vim]: ./plugin/jumpfile.vim
[plugin/actionmenu.vim]: ./plugin/actionmenu.vim
[config/plugins/lsp.vim]: ./config/plugins/lsp.vim
[Marked 2]: https://marked2app.com
[Neovim]: https://github.com/neovim/neovim
[Vim]: https://github.com/vim/vim
[lazy-loaded]: ./config/plugins.yaml#L47

### 解决 mac tmux 下 neovim 无法复制到剪贴板的问题
```
# https://github.com/tmux/tmux/issues/543
brew install reattach-to-user-namespace
# then edit your .tmux.conf
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# In .vimrc or ~/.config/nvim/init.vim (I use Neovim):
set clipboard=unnamed
# reload tmux config
tmux source-file ~/.tmux.conf
```

### 解决 vim gutter 使用 emoji 文本渲染问题

See this [Vim text rendering off by one issue](https://www.reddit.com/r/vim/comments/6vkoii/vim_text_rendering_off_by_one_issue/)

如果你使用了 Iterm2 + neovim,并且在 gutter 栏使用了 emoji 表情,比如 vim-gitgutter, vim-ale 等插件的提示是 emoji。
请勾选 Iterm2->Profiles->Text->Use Unicode versoin 9 widths

See this issue https://stackoverflow.com/questions/43107435/emoji-display-issue-in-vim-with-tmux/52142277#52142277

### ag (The Silver Searcher) ignore file 搜索忽略文件

最好在你的根目录或者项目目录加上 ag 搜索需要忽略的文件,防止 denite 搜索占用太大内存,并且加速筛选内容

add `~/.agignore` file:

```
node_modules
.git
.ropeproject

gen-py/
gen-go/
eggs/
.tmp/
vendor/

*.swp
*.pyc
```

### fzf.vim :Ag 搜索结果发送到 quickfix 窗口

使用 fzf.vim 有个 :Ag 命令搜索的时候可以把结果发送到 quickfix 窗口。通常搜索结果可以使用 ctrl+n/p 来选择

使用方式:

- :Ag 搜索需要的单词。`:Ag word`
- alt-a 全选 (注意 MacOS iterm2: Settings -> Profiles -> Keys Left Option choose Esc+)
- alt-d 可以取消选择
- Enter 即可,这时候就可以把搜索结果发送到 quickfix 窗口

ref: https://github.com/junegunn/fzf.vim/issues/586

### [Coc.Nvim](https://github.com/neoclide/coc.nvim)

If you want to use [coc.nvim](https://github.com/neoclide/coc.nvim) for Golang completion,
please see this article [《vim as a go ide》](https://octetz.com/docs/2019/2019-04-24-vim-as-a-go-ide/).
Now you can use `coc` branch for go completion(use gopls). If you use python, type `CocInstall coc-python` install
python coc plugin.

(注意笔者基于开源配置代码修改,笔者的 leader 是 "," 而不是文档中的 Space)


================================================
FILE: after/ftplugin/go.vim
================================================
setlocal tabstop=4

" autocorrect wrong key word spell
iabbrev mian() main()
iabbrev fucn func
iabbrev Pirntln Println
iabbrev errror error
iabbrev itnerface interface
iabbrev cosnt const
iabbrev retunr return
iabbrev imoprt import
iabbrev contineu continue
iabbrev dfer defer
iabbrev defalut default
iabbrev caes case
iabbrev rnage range


================================================
FILE: after/ftplugin/help.vim
================================================
" Snippets from vim-help
" Credits: https://github.com/dahu/vim-help

let s:save_cpo = &cpoptions
set cpoptions&vim

function! s:setup_buffer()
	let b:undo_ftplugin .= ' | setlocal spell< list< hidden< iskeyword<'
		\ . " | execute 'nunmap <buffer> <CR>'"
		\ . " | execute 'nunmap <buffer> <BS>'"
		\ . " | execute 'nunmap <buffer> o'"
		\ . " | execute 'nunmap <buffer> O'"
		\ . " | execute 'nunmap <buffer> f'"
		\ . " | execute 'nunmap <buffer> F'"
		\ . " | execute 'nunmap <buffer> t'"
		\ . " | execute 'nunmap <buffer> T'"
		\ . " | execute 'nunmap <buffer> <leader>j'"
		\ . " | execute 'nunmap <buffer> <leader>k'"
		\ . " | execute 'nunmap <buffer> q'"

	setlocal nospell
	setlocal nolist
	setlocal nohidden
	setlocal iskeyword+=:
	setlocal iskeyword+=#
	setlocal iskeyword+=-

	" unsilent echomsg 'help edit' &ft bufname() 'type:' &buftype

	if s:count_windows() - 1 > 1
		wincmd K
	else
		wincmd L
	endif

	" Exit help window with 'q'
	nnoremap <silent><buffer> q :quit<CR>

	" Jump to links with enter
	nmap <buffer> <CR> <C-]>

	" Jump back with backspace
	nmap <buffer> <BS> <C-T>

	" Skip to next option link
	nmap <buffer> o /'[a-z]\{2,\}'<CR>

	" Skip to previous option link
	nmap <buffer> O ?'[a-z]\{2,\}'<CR>

	" Skip to next subject link
	nmap <buffer><nowait> f /\|\S\+\|<CR>l

	" Skip to previous subject link
	nmap <buffer> F h?\|\S\+\|<CR>l

	" Skip to next tag (subject anchor)
	nmap <buffer> t /\*\S\+\*<CR>l

	" Skip to previous tag (subject anchor)
	nmap <buffer> T h?\*\S\+\*<CR>l

	" Skip to next/prev quickfix list entry (from a helpgrep)
	nmap <buffer> <leader>j :cnext<CR>
	nmap <buffer> <leader>k :cprev<CR>
endfunction

" Count tab page windows
function! s:count_windows()
	let l:count = 0
	let l:tabnr = tabpagenr()
	let l:ignore = '^\(hover\|fern\|clap_\|defx\|denite\)'
	try
		let l:windows = gettabinfo(l:tabnr)[0].windows
		for l:win in l:windows
			if getwinvar(l:win, '&filetype') !~# l:ignore
				let l:count += 1
			endif
		endfor
	catch
		" Fallback
		let l:count = tabpagewinnr(l:tabnr, '$')
	endtry
	return l:count
endfunction

" Setup only when viewing help pages
if &buftype ==# 'help'
	call s:setup_buffer()
endif

let &cpoptions = s:save_cpo


================================================
FILE: after/ftplugin/json.vim
================================================
setlocal foldmethod=syntax


================================================
FILE: after/ftplugin/man.vim
================================================

let s:save_cpo = &cpoptions
set cpoptions&vim

silent! nunmap <buffer> q
nnoremap <silent><buffer> q :<C-u>quit<CR>

nnoremap <silent><buffer> <Leader>o  :<C-u>call man#show_toc()<CR>

if exists('b:undo_ftplugin')
	let b:undo_ftplugin .= ' | '
else
	let b:undo_ftplugin = ''
endif
let b:undo_ftplugin .= "execute 'nunmap <buffer> <leader>o'"

let &cpoptions = s:save_cpo


================================================
FILE: after/ftplugin/markdown.vim
================================================
set conceallevel=0


================================================
FILE: after/ftplugin/qf.vim
================================================
" Extend romainl/vim-qf
" ---
" See Also: https://github.com/romainl/vim-qf

let s:save_cpo = &cpoptions
set cpoptions&vim

" Local window settings
setlocal cursorline colorcolumn=

if exists('&signcolumn')
	setlocal signcolumn=yes
endif

if ! exists(':Lfilter')
	try
		packadd cfilter
	endtry
endif

if ! exists('b:qf_isLoc')
	" Are we in a location list or a quickfix list?
	let b:qf_isLoc = ! empty(getloclist(0))
endif

" Is this redundant?
" let &l:statusline="%t%{exists('w:quickfix_title') ? ' '.w:quickfix_title : ''} %=%-15(%l,%L%V%) %P"

silent! nunmap <buffer> <CR>
silent! nunmap <buffer> p
silent! nunmap <buffer> q
silent! nunmap <buffer> s

nnoremap <silent><buffer><expr> <CR> ":pclose!\<CR>\<CR>" .
	\ (b:qf_isLoc == 1 ? ':lclose' : ':cclose') . "\<CR>"

nnoremap <silent><buffer> <Esc>  :pclose!<CR>:quit<CR>
nnoremap <silent><buffer> o      :pclose!<CR><CR>:noautocmd wincmd b<CR>

if get(g:, 'enable_universal_quit_mapping', 1)
	nnoremap <silent><buffer> q      :pclose!<CR>:quit<CR>
endif
nnoremap <silent><buffer> p      :call <SID>preview_file()<CR>
nnoremap <silent><buffer> K      :echo getline(line('.'))<CR>
nnoremap <silent><buffer> dd     :<C-u>Reject<CR>
nnoremap <silent><buffer> <C-r>  :<C-u>Restore<CR>
nnoremap <silent><buffer> R      :<C-u>Restore<CR>

nnoremap <buffer> O      :<C-u>ListLists<CR>
nnoremap <buffer> <C-s>  :<C-u>SaveList<Space>
nnoremap <buffer> S      :<C-u>SaveList<Space>
nnoremap <buffer> <C-o>  :<C-u>LoadList<Space>

nnoremap <silent><buffer> sg :pclose!<CR><C-w><CR><C-w>L<C-w>=
nnoremap <silent><buffer> sv :pclose!<CR><C-w><CR><C-w>=
nnoremap <silent><buffer> st :pclose!<CR><C-w><CR><C-w>T

nmap <buffer> <Tab>    <Plug>(qf_newer)
nmap <buffer> <S-Tab>  <Plug>(qf_older)
nmap <buffer> gj       <Plug>(qf_next_file)
nmap <buffer> gk       <Plug>(qf_previous_file)

if exists(':Lfilter')
	nnoremap <buffer><expr> i
		\ (b:qf_isLoc == 1 ? ':L' : ':C') . "filter\<Space>//\<Left>"
	nnoremap <buffer><expr> r
		\ (b:qf_isLoc == 1 ? ':L' : ':C'). "filter!\<Space>//\<Left>"
else
	nnoremap <buffer> i :<C-u>Keep<Space>
endif

" let s:ns = nvim_create_namespace('hlgrep')

if exists('b:undo_ftplugin')
	let b:undo_ftplugin .= ' | '
else
	let b:undo_ftplugin = ''
endif
let b:undo_ftplugin .=
	\ 'setl cursorline< colorcolumn< signcolumn<'
	\ . " | execute 'nunmap <buffer> <CR>'"
	\ . " | execute 'nunmap <buffer> <Esc>'"
	\ . " | execute 'nunmap <buffer> q'"
	\ . " | execute 'nunmap <buffer> p'"
	\ . " | execute 'nunmap <buffer> K'"
	\ . " | execute 'nunmap <buffer> <C-r>'"
	\ . " | execute 'nunmap <buffer> R'"
	\ . " | execute 'nunmap <buffer> O'"
	\ . " | execute 'nunmap <buffer> <C-s>'"
	\ . " | execute 'nunmap <buffer> S'"
	\ . " | execute 'nunmap <buffer> <C-o>'"
	\ . " | execute 'nunmap <buffer> i'"
	\ . " | execute 'nunmap <buffer> o'"
	\ . " | execute 'nunmap <buffer> sg'"
	\ . " | execute 'nunmap <buffer> sv'"
	\ . " | execute 'nunmap <buffer> st'"
	\ . " | execute 'nunmap <buffer> <Tab>'"
	\ . " | execute 'nunmap <buffer> <S-Tab>'"
	\ . " | execute 'nunmap <buffer> gj'"
	\ . " | execute 'nunmap <buffer> gk'"

function! s:get_entry()
	" Find the file, line number and column of current entry
	let l:raw = getline(line('.'))
	let l:file = fnameescape(substitute(l:raw, '|.*$', '', ''))
	let l:pos = substitute(l:raw, '^.\{-}|\(.\{-}|\).*$', '\1', '')
	let l:line = 1
	let l:column = 1
	if l:pos =~# '^\d\+'
		let l:line  = substitute(l:pos, '^\(\d\+\).*$', '\1', '')
		if l:pos =~# ' col \d\+|'
			let l:column = substitute(l:pos, '^\d\+ col \(\d\+\).*$', '\1', '')
		endif
	endif

	return [ l:file, l:line, l:column ]
endfunction

function! s:preview_file()
	let [ l:file, l:line, l:column ] = s:get_entry()
	call preview#open(l:file, l:line, l:column)
endfunction

let &cpoptions = s:save_cpo


================================================
FILE: after/ftplugin/vim.vim
================================================
let s:save_cpo = &cpoptions
set cpoptions&vim

if exists('b:undo_ftplugin')
	let b:undo_ftplugin .= ' | '
else
	let b:undo_ftplugin = ''
endif
let b:undo_ftplugin .= 'setl modeline< iskeyword< keywordprg< suffixesadd< includeexpr< path<'

setlocal iskeyword+=:
setlocal iskeyword+=#
setlocal keywordprg=:help
" setlocal foldmethod=indent
" setlocal conceallevel=0

" For gf
let &l:path = join(map(split(&runtimepath, ','), 'v:val."/autoload"'), ',')
setlocal suffixesadd=.vim
setlocal includeexpr=fnamemodify(substitute(v:fname,'#','/','g'),':h')

let &cpoptions = s:save_cpo


================================================
FILE: autoload/actionmenu.vim
================================================
" actionmenu
" ---
" Context-aware menu at your cursor
" Forked from: https://github.com/kizza/actionmenu.nvim

" Menu items
let g:actionmenu#items = []

" Current menu selection
let g:actionmenu#selected = 0

" Private variables
let s:buffer = 0
let s:window = 0

function! actionmenu#open(items, callback, ...) abort
	" Open the context-menu with a:items and a:callback for selected item action.

	if empty(a:items)
		return
	endif

	" Close the old window if opened
	call actionmenu#close()

	" Create the buffer
	if ! s:buffer
		let s:buffer = nvim_create_buf(0, 1)
		call nvim_buf_set_option(s:buffer, 'syntax', 'OFF')
	endif
	call nvim_buf_set_option(s:buffer, 'modifiable', v:true)
	call nvim_buf_set_option(s:buffer, 'completefunc', 'actionmenu#complete')
	" call nvim_buf_set_lines(s:buffer, 0, -1, v:true, [ '' ])

	" Persist menu items and callback function
	let g:actionmenu#items = a:items
	let s:callback = a:callback

	" Process user hooks
	doautocmd <nomodeline> User action_menu_open_pre

	" Open the window
	let l:opts = {
		\ 'relative': 'cursor',
		\ 'focusable': v:false,
		\ 'width': 1,
		\ 'height': 1,
		\ 'row': 0,
		\ 'col': 0,
		\ 'style': 'minimal',
		\}

	let s:window = nvim_open_win(s:buffer, 1, l:opts)
	call nvim_win_set_option(s:window, 'foldenable', v:false)
	call nvim_win_set_option(s:window, 'wrap', v:false)
	call nvim_win_set_option(s:window, 'statusline', '')
	call nvim_win_set_option(s:window, 'sidescrolloff', 0)
	call nvim_win_set_option(s:window, 'listchars', '')
	if exists('&winblend')
		call nvim_win_set_option(s:window, 'winblend', 100)
	endif

	" Setup the window
	call nvim_buf_set_option(s:buffer, 'filetype', 'actionmenu')

	" Menu mappings and events
	call s:attach_events()

	" startinsert  TODO: nvim cursor relative is off
	call nvim_input("i\<C-x>\<C-u>")
endfunction

function! s:attach_events() abort
	mapclear <buffer>
	imapclear <buffer>
	inoremap <silent><nowait><buffer><expr> <CR> <SID>select_item()
	" imap     <nowait><buffer> <C-y> <CR>
	" imap     <nowait><buffer> <C-e> <Esc>

	" Navigate in menu
	inoremap <nowait><buffer> <Up>    <C-p>
	inoremap <nowait><buffer> <Down>  <C-n>
	inoremap <nowait><buffer> k       <C-p>
	inoremap <nowait><buffer> j       <C-n>
	inoremap <nowait><buffer> h       <C-p>
	inoremap <nowait><buffer> l       <C-n>
	inoremap <nowait><buffer> <Space> <C-n>
	inoremap <nowait><buffer> <C-k>   <C-p>
	inoremap <nowait><buffer> <C-j>   <C-n>
	inoremap <nowait><buffer> <S-Tab> <C-p>
	inoremap <nowait><buffer> <Tab>   <C-n>

	" Scroll pages in menu
	inoremap <nowait><buffer> <C-b>  <PageUp>
	inoremap <nowait><buffer> <C-f>  <PageDown>
	imap     <nowait><buffer> <C-u>  <PageUp>
	imap     <nowait><buffer> <C-d>  <PageDown>

	" Events
	augroup actionmenu
		autocmd!
		autocmd InsertLeave <buffer> call <SID>on_insert_leave()
	augroup END
endfunction

function! s:select_item() abort
	if pumvisible()
		if ! empty(v:completed_item)
			let g:actionmenu#selected = copy(v:completed_item)
		endif
		" Close pum and leave insert
		return "\<C-y>\<Esc>"
	endif
	" Leave insert mode
	return "\<Esc>"
endfunction

function! s:on_insert_leave() abort
	call actionmenu#close()
	let l:index = -1
	if type(g:actionmenu#selected) == type({})
		let l:index = get(g:actionmenu#selected, 'user_data', -1)
	endif
	let l:data = l:index > -1 ? g:actionmenu#items[l:index] : {}
	let g:actionmenu#items = []
	let g:actionmenu#selected = 0
	call actionmenu#callback(l:index, l:data)
	unlet! s:callback
	doautocmd <nomodeline> User action_menu_open_post
endfunction

" Pum completion function
function! actionmenu#complete(findstart, base) abort
	if a:findstart
		return 1
	else
		return map(copy(g:actionmenu#items), {
			\ index, item -> s:pum_parse_item(item, index) })
	endif
endfunction

function! s:pum_parse_item(item, index) abort
	if type(a:item) == type('')
		return { 'word': a:item, 'user_data': a:index }
	else
		return { 'word': a:item['word'], 'user_data': a:index }
	endif
endfunction

function! actionmenu#callback(index, item) abort
	" doautocmd <nomodeline> BufWinEnter
	if empty(s:callback)
		return
	endif
	if a:index >= 0 && ! empty(a:item) && type(a:item) != type('')
		call s:callback(a:item)
	endif
endfunction

function! actionmenu#close() abort
	if s:window
		call nvim_win_close(s:window, v:false)
		let s:window = 0
		let s:buffer = 0
	endif
endfunction

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: autoload/badge.vim
================================================
" vim-badge - Bite-size badges for tab & status lines
" Maintainer: Rafael Bodill <justrafi at gmail dot com>
"-------------------------------------------------

" Configuration

" Maximum number of directories in filepath
let g:badge_status_filename_max_dirs =
	\ get(g:, 'badge_status_filename_max_dirs', 3)

" Maximum number of characters in each directory
let g:badge_status_dir_max_chars =
	\ get(g:, 'badge_status_dir_max_chars', 5)

" Less verbosity on specific filetypes (regexp)
let g:badge_filetype_blacklist =
	\ get(g:, 'badge_filetype_blacklist',
	\ 'vimfiler\|gundo\|diff\|fugitive\|gitv')

let g:badge_loading_charset =
	\ get(g:, 'badge_loading_charset',
	\ ['⠃', '⠁', '⠉', '⠈', '⠐', '⠠', '⢠', '⣠', '⠄', '⠂'])

let g:badge_nofile = get(g:, 'badge_nofile', 'N/A')

let g:badge_project_separator = get(g:, 'badge_project_separator', '')

" Private variables
let s:caches = []

" Clear cache on save
augroup statusline_cache
	autocmd!
	autocmd BufWritePre,FileChangedShellPost,TextChanged,InsertLeave *
		\ unlet! b:badge_cache_trails
	autocmd BufReadPost,BufFilePost,BufNewFile,BufWritePost *
		\ for cache_name in s:caches | execute 'unlet! b:' . cache_name | endfor
augroup END

function! badge#project() abort
	" Try to guess the project's name

	let dir = badge#root()
	return fnamemodify(dir ? dir : getcwd(), ':t')
endfunction

function! badge#gitstatus(...) abort
	" Display git status indicators

	let l:icons = ['₊', '∗', '₋']  " added, modified, removed
	let l:out = ''
	" if &filetype ==# 'magit'
	"	let l:map = {}
	"	for l:file in magit#git#get_status()
	"		let l:map[l:file['unstaged']] = get(l:map, l:file['unstaged'], 0) + 1
	"	endfor
	"	for l:status in l:map
	"		let l:out = values(l:map)
	"	endfor
	" else
		if exists('*gitgutter#hunk#summary')
			let l:summary = gitgutter#hunk#summary(bufnr('%'))
			for l:idx in range(0, len(l:summary) - 1)
				if l:summary[l:idx] > 0
					let l:out .= ' ' . l:icons[l:idx] . l:summary[l:idx]
				endif
			endfor
		endif
	" endif
	return trim(l:out)
endfunction

function! badge#filename(...) abort
	" Provides relative path with limited characters in each directory name, and
	" limits number of total directories. Caches the result for current buffer.
	" Parameters:
	"   1: Buffer number, ignored if tab number supplied
	"   2: Maximum characters displayed in base filename
	"   3: Maximum characters displayed in each directory
	"   4: Cache key

	" Compute buffer id
	let l:bufnr = '%'
	if a:0 > 0
		let l:bufnr = a:1
	endif

	" Use buffer's cached filepath
	let l:cache_var_name = a:0 > 3 ? a:4 : 'filename'
	let l:cache_var_name = 'badge_cache_' . l:cache_var_name
	let l:fn = getbufvar(l:bufnr, l:cache_var_name, '')
	if len(l:fn) > 0
		return l:fn
	endif

	let l:bufname = bufname(l:bufnr)
	let l:filetype = getbufvar(l:bufnr, '&filetype')

	if l:filetype =~? g:badge_filetype_blacklist
		" Empty if owned by certain plugins
		let l:fn = ''
	elseif l:filetype ==# 'denite.*\|quickpick-filter'
		let l:fn = '⌖ '
	elseif l:filetype ==# 'qf'
		let l:fn = '⌗ list'
	elseif l:filetype ==# 'TelescopePrompt'
		let l:fn = '⌖ '
	elseif l:filetype ==# 'defx'
		let l:fn = ' '
	elseif l:filetype ==# 'magit'
		let l:fn = magit#git#top_dir()
	elseif l:filetype ==# 'vimfiler'
		let l:fn = vimfiler#get_status_string()
	elseif empty(l:bufname)
		" Placeholder for empty buffer
		let l:fn = g:badge_nofile
	" elseif ! &buflisted
	" 	let l:fn = ''
	else
		" Shorten dir names
		let l:max = a:0 > 2 ? a:3 : g:badge_status_dir_max_chars
		let short = substitute(l:bufname,
			\ "[^/]\\{" . l:max . "}\\zs[^/]\*\\ze/", '', 'g')

		" Decrease dir count
		let l:max = a:0 > 1 ? a:2 : g:badge_status_filename_max_dirs
		let parts = split(short, '/')
		if len(parts) > l:max
			let parts = parts[-l:max-1 : ]
		endif

		" Set icon
		let l:icon = ''
		if exists('*nerdfont#find')
			let l:icon = nerdfont#find(l:bufname)
		elseif exists('*defx_icons#get')
			let l:icon = get(defx_icons#get().icons.extensions, expand('%:e'), {})
			let l:icon = get(l:icon, 'icon', '')
		endif
		if ! empty(l:icon)
			let l:fn .= l:icon . '  '
		endif

		let l:fn .= join(parts, '/')
	endif

	" Append fugitive blob type
	let l:fugitive = getbufvar(l:bufnr, 'fugitive_type')
	if l:fugitive ==# 'blob'
		let l:fn .= ' (blob)'
	endif

	" Cache and return the final result
	call setbufvar(l:bufnr, l:cache_var_name, l:fn)
	if index(s:caches, l:cache_var_name) == -1
		call add(s:caches, l:cache_var_name)
	endif
	return l:fn
endfunction

function! badge#root() abort
	" Find the root directory by searching for the version-control dir

	let dir = getbufvar('%', 'project_dir')
	let curr_dir = getcwd()
	if empty(dir) || getbufvar('%', 'project_dir_last_cwd') != curr_dir
		let patterns = ['.git', '.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']
		for pattern in patterns
			let is_dir = stridx(pattern, '/') != -1
			let match = is_dir ? finddir(pattern, curr_dir . ';')
				\ : findfile(pattern, curr_dir . ';')
			if ! empty(match)
				let dir = fnamemodify(match, is_dir ? ':p:h:h' : ':p:h')
				call setbufvar('%', 'project_dir', dir)
				call setbufvar('%', 'project_dir_last_cwd', curr_dir)
				break
			endif
		endfor
	endif
	return dir
endfunction

function! badge#branch() abort
	" Returns git branch name, using different plugins.

	if &filetype !~? g:badge_filetype_blacklist
		if exists('*gitbranch#name')
			return gitbranch#name()
		elseif exists('*vcs#info')
			return vcs#info('%b')
		elseif exists('fugitive#head')
			return fugitive#head(8)
		endif
	endif
	return ''
endfunction

function! badge#syntax() abort
	" Returns syntax warnings from several plugins
	" Supports vim-lsp, ALE, Neomake, and Syntastic
	if &filetype =~? g:badge_filetype_blacklist
		return ''
	endif

	let l:msg = ''
	let l:errors = 0
	let l:warnings = 0
	let l:hints = 0
	let l:information = 0
	if exists('*lsp#get_buffer_diagnostics_counts')
			\ && get(g:, 'lsp_diagnostics_enabled', 1)
		let l:counts = lsp#get_buffer_diagnostics_counts()
		let l:errors = get(l:counts, 'error', '')
		let l:warnings = get(l:counts, 'warning', '')
		let l:hints = get(l:counts, 'hint', '')
		let l:information = get(l:counts, 'information', '')
	elseif exists('*neomake#Make')
		let l:counts = neomake#statusline#get_counts(bufnr('%'))
		let l:errors = get(l:counts, 'E', '')
		let l:warnings = get(l:counts, 'W', '')
	elseif exists('g:loaded_ale')
		let l:counts = ale#statusline#Count(bufnr('%'))
		let l:errors = l:counts.error + l:counts.style_error
		let l:warnings = l:counts.total - l:errors
	elseif exists('*SyntasticStatuslineFlag')
		let l:msg = SyntasticStatuslineFlag()
	endif
	if l:errors > 0
		let l:msg .= printf(' %d ', l:errors)
	endif
	if l:warnings > 0
		let l:msg .= printf(' %d ', l:warnings)
	endif
	if l:hints > 0
		let l:msg .= printf(' %d ', l:hints)
	endif
	if l:information > 0
		let l:msg .= printf(' %d ', l:information)
	endif
	return substitute(l:msg, '\s*$', '', '')
endfunction

function! badge#trails(...) abort
	" Detect trailing whitespace and cache result per buffer
	" Parameters:
	"   Whitespace warning message, use %s for line number, default: WS:%s

	if ! exists('b:badge_cache_trails')
		let b:badge_cache_trails = ''
		if ! &readonly && &modifiable && line('$') < 9000
			let trailing = search('\s$', 'nw')
			if trailing != 0
				let label = a:0 == 1 ? a:1 : 'WS:%s'
				let b:badge_cache_trails .= printf(label, trailing)
			endif
		endif
	endif
	return b:badge_cache_trails
endfunction

function! badge#modified(...) abort
	" Make sure we ignore &modified when choosewin is active
	" Parameters:
	"   Modified symbol, default: +

	let label = a:0 == 1 ? a:1 : '+'
	let choosewin = exists('g:choosewin_active') && g:choosewin_active
	return &modified && ! choosewin ? label : ''
endfunction

function! badge#mode(...) abort
	" Returns file's mode: read-only and/or zoomed
	" Parameters:
	"   Read-only symbol, default: R
	"   Zoomed buffer symbol, default: Z

	let s:modes = ''
	if &filetype !~? g:badge_filetype_blacklist && &readonly
		let s:modes .= a:0 > 0 ? a:1 : 'R'
	endif
	if exists('t:zoomed') && bufnr('%') == t:zoomed.nr
		let s:modes .= a:0 > 1 ? a:2 : 'Z'
	endif

	return s:modes
endfunction

function! badge#format() abort
	" Returns file format

	return &filetype =~? g:badge_filetype_blacklist ? '' : &fileformat
endfunction

function! badge#session(...) abort
	" Returns an indicator for active session
	" Parameters:
	"   Active session symbol, default: [S]

	return empty(v:this_session) ? '' : a:0 == 1 ? a:1 : '[S]'
endfunction

function! badge#indexing() abort
	let l:out = ''

	if exists('*lsp#get_progress')
		let s:lsp_progress = lsp#get_progress()
		if len(s:lsp_progress) > 0 && has_key(s:lsp_progress[0], 'message')
			" Show only last progress message
			let s:lsp_progress = s:lsp_progress[0]
			let l:percent = get(s:lsp_progress, 'percentage')
			if s:lsp_progress['message'] != '' && l:percent != 100
				let l:out .= s:lsp_progress['server'] . ':'
					\ . s:lsp_progress['title'] . ' '
					\ . s:lsp_progress['message']
					\ . l:percent
				if l:percent >= 0
					let l:out .= ' ' . string(l:percent) . '%'
				endif
			endif
		endif
	endif
	if exists('*gutentags#statusline')
		let l:tags = gutentags#statusline('[', ']')
		if ! empty(l:tags)
			if exists('*reltime')
				let s:wait = split(reltimestr(reltime()), '\.')[1] / 100000
			else
				let s:wait = get(s:, 'wait', 9) == 9 ? 0 : s:wait + 1
			endif
			let l:out .= get(g:badge_loading_charset, s:wait, '') . ' ' . l:tags
		endif
	endif
	if exists('*coc#status')
		let l:out .= coc#status()
	endif
	if exists('g:SessionLoad') && g:SessionLoad == 1
		let l:out .= '[s]'
	endif
	return l:out
endfunction

function! s:numtr(number, charset) abort
	let l:result = ''
	for l:char in split(a:number, '\zs')
		let l:result .= a:charset[l:char]
	endfor
	return l:result
endfunction

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: autoload/preview.vim
================================================
" Improved preview for lists
" ---

function! preview#open(file, line, column) abort
	" Create or close preview window
	silent! wincmd P
	if &previewwindow && expand('%') == a:file
		let cur_pos = getcurpos()
		" If the exact same file and numbers are used, close preview window
		if a:line == cur_pos[1] && (a:column == 0 || a:column == cur_pos[2])
			pclose!
			silent! wincmd p
			return
		endif
	else

		" Create read-only preview
		silent doautocmd User preview_open_pre
		execute 'silent! vertical pedit! +set\ nofoldenable ' . a:file
		noautocmd wincmd P
		let b:asyncomplete_enable = 0
		let b:sleuth_automatic = 0
		let b:cursorword = 0
		" local buffer settings
		setlocal bufhidden=delete
		" setlocal nomodifiable nobuflisted buftype=nofile
		" local window settings
		setlocal statusline= number conceallevel=0 nospell
		if exists('&signcolumn')
			setlocal signcolumn=no
		endif
		setlocal cursorline cursorcolumn colorcolumn=
		noautocmd execute 'vertical resize ' . (&columns / 2)
		silent doautocmd User preview_open_post
	endif

	if a:line > 1 || a:column > 1
		call cursor(a:line, a:column)

		" Align match be centered
		normal! zz
		if a:column > &sidescrolloff * 2
			normal! zs
			normal! zH
		endif
	endif

	" Move back to previous window, maintaining cursorline
	silent noautocmd wincmd p
endfunction

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: coc-settings.json
================================================
{
  "languageserver": {
    "golang": {
      "command": "gopls",
      "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
      "filetypes": ["go"],
      "initializationOptions": {
        "usePlaceholders": true
      }
    },
    "ccls": {
        "command": "ccls",
        "args": ["--log-file=/tmp/ccls.log"],
        "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
        "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
        "initializationOptions": {
            "cache": {
                "directory": ".ccls-cache"
            },
            "clang": {
                "resourceDir": "$CODE_COMPLETE_CLANG_LIB_PATH"
            },
            "index": {
        "trackDependency": 1 ,
        "initialBlacklist": ["."]
            }
        }
    }
  },
  "python.pythonPath": "/usr/local/bin/python3",
  "suggest.noselect": false,
  "colors.enable": true,
  "highlight.disableLanguages": ["go"],
  "inlayHint.enable": false
}


================================================
FILE: config/filetype.vim
================================================
" File Types
" ---

augroup user_plugin_filetype " {{{
	autocmd!

	" Reload vim configuration automatically on-save
	autocmd BufWritePost $VIM_PATH/{*.vim,*.yaml,vimrc} nested
		\ source $MYVIMRC | redraw

	" Highlight current line only on focused window, unless:
	" 1. Cursor-line is already set to wanted value
	" 2. Denite or Clap buffers
	" 3. Preview window
	" 4. Completion popup menu is visible
	autocmd WinEnter,BufEnter,InsertLeave *
		\ if ! &cursorline && &filetype !~# '^\(denite\|clap_\|.*quickpick\)'
		\      && ! &previewwindow && ! pumvisible()
		\ | setlocal cursorline
		\ | endif
	autocmd WinLeave,BufLeave,InsertEnter *
		\ if &cursorline && &filetype !~# '^\(denite\|clap_\|.*quickpick\)'
		\      && ! &previewwindow && ! pumvisible()
		\ | setlocal nocursorline
		\ | endif

	" Automatically set read-only for files being edited elsewhere
	autocmd SwapExists * nested let v:swapchoice = 'o'

	" Update diff comparison once leaving insert mode
	autocmd InsertLeave * if &l:diff | diffupdate | endif

	" Equalize window dimensions when resizing vim window
	autocmd VimResized * wincmd =

	" Force write shada on leaving nvim
	autocmd VimLeave * if has('nvim') | wshada! | else | wviminfo! | endif

	" Check if file changed when its window is focus, more eager than 'autoread'
	autocmd FocusGained * checktime

	autocmd Syntax * if line('$') > 5000 | syntax sync minlines=200 | endif

	" Neovim terminal settings
	if has('nvim-0.5')
		autocmd TermOpen * setlocal modifiable
		try
			autocmd TextYankPost *
				\ silent! lua vim.highlight.on_yank {higroup="IncSearch", timeout=150}
		endtry
	endif

	" Update filetype on save if empty
	autocmd BufWritePost * nested
		\ if &l:filetype ==# '' || exists('b:ftdetect')
		\ |   unlet! b:ftdetect
		\ |   filetype detect
		\ | endif

	" Reload Vim script automatically if setlocal autoread
	autocmd BufWritePost,FileWritePost *.vim nested
		\ if &l:autoread > 0 | source <afile> |
		\   echo 'source ' . bufname('%') |
		\ endif

	" When editing a file, always jump to the last known cursor position.
	" Credits: https://github.com/farmergreg/vim-lastplace
	autocmd BufReadPost *
		\ if index(['gitcommit', 'gitrebase', 'svn', 'hgcommit'], &buftype) == -1 &&
		\      index(['quickfix', 'nofile', 'help'], &buftype) == -1 &&
		\      ! &diff && ! &previewwindow &&
		\      line("'\"") > 0 && line("'\"") <= line("$")
		\|   if line("w$") == line("$")
		\|     execute "normal! g`\""
		\|   elseif line("$") - line("'\"") > ((line("w$") - line("w0")) / 2) - 1
		\|     execute "normal! g`\"zz"
		\|   else
		\|     execute "normal! \G'\"\<c-e>"
		\|   endif
		\|   if foldclosed('.') != -1
		\|     execute 'normal! zvzz'
		\|   endif
		\| endif

	autocmd FileType apache setlocal path+=./;/

	autocmd FileType html setlocal path+=./;/

	autocmd FileType crontab setlocal nobackup nowritebackup

	autocmd FileType yaml.docker-compose setlocal expandtab

	autocmd FileType gitcommit setlocal spell

	autocmd FileType gitcommit,qfreplace setlocal nofoldenable

	autocmd FileType php setlocal matchpairs-=<:> iskeyword+=\\

	autocmd FileType python
		\ setlocal expandtab smarttab nosmartindent
		\ | setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=120

	autocmd FileType markdown
		\ setlocal expandtab nospell conceallevel=0
		\ | setlocal autoindent formatoptions=tcroqn2 comments=n:>

	" https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write
	autocmd FileType css,javascript,javascriptreact setlocal backupcopy=yes

augroup END " }}}

" Internal Plugin Settings  {{{
" ------------------------

" PHP {{{
let g:PHP_removeCRwhenUnix = 0

" }}}
" Python {{{
let g:python_recommended_style = 0
let g:pydoc_executable = 0
let g:python_highlight_all = 1
" let g:python_highlight_builtins = 1
" let g:python_highlight_exceptions = 1
" let g:python_highlight_string_format = 1
" let g:python_highlight_doctests = 1
" let g:python_highlight_class_vars = 1
" let g:python_highlight_operators = 1

" }}}
" Vim {{{
let g:vimsyntax_noerror = 1
let g:vim_indent_cont = &shiftwidth

" }}}
" Bash {{{
let g:is_bash = 1
let g:sh_no_error = 1

" }}}
" Java {{{
let g:java_highlight_functions = 'style'
let g:java_highlight_all = 1
let g:java_highlight_debug = 1
let g:java_allow_cpp_keywords = 1
let g:java_space_errors = 1
let g:java_highlight_functions = 1

" }}}
" JavaScript {{{
let g:SimpleJsIndenter_BriefMode = 1
let g:SimpleJsIndenter_CaseIndentLevel = -1

" }}}
" Ruby {{{
let g:ruby_no_expensive = 1

" }}}
" Folding {{{
" augroup: a
" function: f
let g:vimsyn_folding = 'af'
let g:tex_fold_enabled = 1
let g:xml_syntax_folding = 1
let g:php_folding = 2
let g:php_phpdoc_folding = 1
let g:perl_fold = 1
" }}}
" }}}

" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :


================================================
FILE: config/general.vim
================================================
" Neo/vim Settings
" ===

" General {{{
set mouse=nv                 " Disable mouse in command-line mode
set modeline                 " automatically setting options from modelines
set report=2                 " Report on line changes
set errorbells               " Trigger bell on error
set visualbell               " Use visual bell instead of beeping
set hidden                   " hide buffers when abandoned instead of unload
set fileformats=unix,dos,mac " Use Unix as the standard file type
set magic                    " For regular expressions turn magic on
set path+=**                 " Directories to search when using gf and friends
set isfname-==               " Remove =, detects filename in var=/foo/bar
set virtualedit=block        " Position cursor anywhere in visual block
set synmaxcol=2500           " Don't syntax highlight long lines
set formatoptions+=1         " Don't break lines after a one-letter word
set formatoptions-=t         " Don't auto-wrap text
set formatoptions-=o         " Disable comment-continuation (normal 'o'/'O')
if has('patch-7.3.541')
	set formatoptions+=j       " Remove comment leader when joining lines
endif

if has('vim_starting')
	set encoding=utf-8
	scriptencoding utf-8
endif

" What to save for views and sessions:
set viewoptions=folds,cursor,curdir,slash,unix
set sessionoptions=curdir,help,tabpages,winsize

if has('mac') && has('vim_starting')
	let g:clipboard = {
		\   'name': 'macOS-clipboard',
		\   'copy': {
		\      '+': 'pbcopy',
		\      '*': 'pbcopy',
		\    },
		\   'paste': {
		\      '+': 'pbpaste',
		\      '*': 'pbpaste',
		\   },
		\   'cache_enabled': 0,
		\ }
endif

if has('clipboard') && has('vim_starting')
	" set clipboard& clipboard+=unnamedplus
	set clipboard& clipboard^=unnamed,unnamedplus
endif

" }}}
" Wildmenu {{{
" --------
if has('wildmenu')
	if ! has('nvim')
		set nowildmenu
		set wildmode=list:longest,full
	endif
	set wildignorecase
	set wildignore+=.git,.hg,.svn,.stversions,*.pyc,*.spl,*.o,*.out,*~,%*
	set wildignore+=*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store
	set wildignore+=**/node_modules/**,**/bower_modules/**,*/.sass-cache/*
	set wildignore+=__pycache__,*.egg-info,.pytest_cache,.mypy_cache/**
endif

" }}}
" Vim Directories {{{
" ---------------
set undofile swapfile nobackup
set directory=$DATA_PATH/swap//,$DATA_PATH,~/tmp,/var/tmp,/tmp
set undodir=$DATA_PATH/undo//,$DATA_PATH,~/tmp,/var/tmp,/tmp
set backupdir=$DATA_PATH/backup/,$DATA_PATH,~/tmp,/var/tmp,/tmp
set viewdir=$DATA_PATH/view/
set spellfile=$VIM_PATH/spell/en.utf-8.add

" History saving
set history=2000

if has('nvim') && ! has('win32') && ! has('win64')
	set shada=!,'100,<20,@100,s10,h,r/tmp,r/private/var
else
	set viminfo='100,<20,@50,h,n$DATA_PATH/viminfo
endif

augroup user_persistent_undo
	autocmd!
	au BufWritePre /tmp/*          setlocal noundofile
	au BufWritePre COMMIT_EDITMSG  setlocal noundofile
	au BufWritePre MERGE_MSG       setlocal noundofile
	au BufWritePre *.tmp           setlocal noundofile
	au BufWritePre *.bak           setlocal noundofile
augroup END

" If sudo, disable vim swap/backup/undo/shada/viminfo writing
if $SUDO_USER !=# '' && $USER !=# $SUDO_USER
		\ && $HOME !=# expand('~'.$USER, 1)
		\ && $HOME ==# expand('~'.$SUDO_USER, 1)

	set noswapfile
	set nobackup
	set nowritebackup
	set noundofile
	if has('nvim')
		set shada="NONE"
	else
		set viminfo="NONE"
	endif
endif

" Secure sensitive information, disable backup files in temp directories
if exists('&backupskip')
	set backupskip+=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*
	set backupskip+=.vault.vim
endif

" Disable swap/undo/viminfo files in temp directories or shm
augroup user_secure
	autocmd!
	silent! autocmd BufNewFile,BufReadPre
		\ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/*,/private/var/*,.vault.vim
		\ setlocal noswapfile noundofile
		\ | set nobackup nowritebackup
		\ | if has('nvim') | set shada= | else | set viminfo= | endif
augroup END

" }}}
" Tabs and Indents {{{
" ----------------
set textwidth=120    " Text width maximum chars before wrapping
set noexpandtab     " Don't expand tabs to spaces
set tabstop=4       " The number of spaces a tab is
set shiftwidth=4    " Number of spaces to use in auto(indent)
set softtabstop=-1  " Automatically keeps in sync with shiftwidth
set smarttab        " Tab insert blanks according to 'shiftwidth'
set autoindent      " Use same indenting on new lines
" set smartindent     " Smart autoindenting on new lines
set shiftround      " Round indent to multiple of 'shiftwidth'

if exists('&breakindent')
	set breakindentopt=shift:2,min:20
endif

" }}}
" Timing {{{
" ------
set timeout ttimeout
set timeoutlen=500   " Time out on mappings
set ttimeoutlen=10   " Time out on key codes
set updatetime=400   " Idle time to write swap and trigger CursorHold
set redrawtime=2000  " Time in milliseconds for stopping display redraw

" }}}
" Searching {{{
" ---------
set ignorecase    " Search ignoring case
set smartcase     " Keep case when searching with *
set infercase     " Adjust case in insert completion mode
set incsearch     " Incremental search
set wrapscan      " Searches wrap around the end of the file

set complete=.,w,b,k  " C-n completion: Scan buffers, windows and dictionary

if exists('+inccommand')
	set inccommand=nosplit
endif

if executable('rg')
	set grepformat=%f:%l:%c:%m
	let &grepprg =
		\ 'rg --vimgrep --no-heading' . (&smartcase ? ' --smart-case' : '') . ' --'
elseif executable('ag')
	set grepformat=%f:%l:%c:%m
	let &grepprg =
		\ 'ag --vimgrep' . (&smartcase ? ' --smart-case' : '') . ' --'
endif

" }}}
" Behavior {{{
" --------
set nowrap                      " No wrap by default
set linebreak                   " Break long lines at 'breakat'
set breakat=\ \	;:,!?           " Long lines break chars
set nostartofline               " Cursor in same column for few commands
set whichwrap+=h,l,<,>,[,],~    " Move to following line on certain keys
set splitbelow splitright       " Splits open bottom right
" set switchbuf=useopen           " Look for matching window buffers first
set backspace=indent,eol,start  " Intuitive backspacing in insert mode
set diffopt=filler,iwhite       " Diff mode: show fillers, ignore whitespace
set completeopt=menuone         " Always show menu, even for one item

if has('patch-7.4.775')
	" Do not select a match in the menu.
	" Do not insert any text for a match until the user selects from menu.
	set completeopt+=noselect,noinsert
endif

if has('patch-8.1.0360') || has('nvim-0.5')
	set diffopt=internal,algorithm:patience
	" set diffopt=indent-heuristic,algorithm:patience
endif

" Use the new Neovim :h jumplist-stack
if has('nvim-0.5')
	set jumpoptions=stack
endif

" }}}
" Editor UI {{{
" --------------------
set noshowmode          " Don't show mode in cmd window
set shortmess=aoOTI     " Shorten messages and don't show intro
set scrolloff=2         " Keep at least 2 lines above/below
set sidescrolloff=5     " Keep at least 5 lines left/right
set number            " Don't show line numbers
set noruler             " Disable default status ruler
set list                " Show hidden characters

set showtabline=2       " Always show the tabs line
set winwidth=30         " Minimum width for active window
set winminwidth=10      " Minimum width for inactive windows
" set winheight=4         " Minimum height for active window
" set winminheight=4      " Minimum height for inactive window
set pumheight=15        " Pop-up menu's line height
set helpheight=12       " Minimum help window height
set previewheight=12    " Completion preview height

set showcmd             " Show command in status line
set cmdheight=2         " Height of the command line
set cmdwinheight=5      " Command-line lines
" set noequalalways       " Don't resize windows on split or close
set laststatus=2        " Always show a status line
set colorcolumn=+0      " Column highlight at textwidth's max character-limit
set display=lastline

if has('folding') && has('vim_starting')
	set foldenable
	set foldmethod=indent
	set foldlevelstart=99
endif

if has('nvim-0.4')
	set signcolumn=auto:1
elseif exists('&signcolumn')
	set signcolumn=auto
endif

" UI Symbols
" icons:  ▏│ ¦ ╎ ┆ ⋮ ⦙ ┊ 
let &showbreak='↳  '
set listchars=tab:\▏\ ,extends:⟫,precedes:⟪,nbsp:␣,trail:·
" set fillchars=foldopen:O,foldclose:x
" set fillchars=vert:▉,fold:─

if has('patch-7.4.314')
	" Do not display completion messages
	set shortmess+=c
endif

if has('patch-7.4.1570')
	" Do not display message when editing files
	set shortmess+=F
endif

" if exists('+previewpopup')
" 	set previewpopup=height:10,width:60
" endif

" Pseudo-transparency for completion menu and floating windows
if has('termguicolors') && &termguicolors
	if exists('&pumblend')
		set pumblend=10
	endif
	if exists('&winblend')
		set winblend=10
	endif
endif

" solve wrong encoding
if has("multi_byte")
    set encoding=utf-8
    " set termencoding=utf-8
    set formatoptions+=mM
    set fencs=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
endif

" }}}

" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :


================================================
FILE: config/init.vim
================================================
" Configuration and plugin-manager manager :)
" ---
" Maintainer: Rafael Bodill
" See: github.com/rafi/vim-config
"
" Plugin-manager agnostic initialization and user configuration parsing

" Set custom augroup
augroup user_events
	autocmd!
augroup END

" Initializes options
let s:package_manager = get(g:, 'etc_package_manager', 'dein')
if empty(s:package_manager) || s:package_manager ==# 'none'
	finish
endif

" Enables 24-bit RGB color in the terminal
if has('termguicolors')
	if empty($COLORTERM) || $COLORTERM =~# 'truecolor\|24bit'
		set termguicolors
	endif
endif

if ! has('nvim')
	set t_Co=256
	" Set Vim-specific sequences for RGB colors
	" Fixes 'termguicolors' usage in vim+tmux
	" :h xterm-true-color
	let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
	let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif

" Disable vim distribution plugins

" let g:loaded_gzip = 1
" let g:loaded_tar = 1
" let g:loaded_tarPlugin = 1
" let g:loaded_zip = 1
" let g:loaded_zipPlugin = 1

let g:loaded_getscript = 1
let g:loaded_getscriptPlugin = 1
let g:loaded_vimball = 1
let g:loaded_vimballPlugin = 1

let g:loaded_matchit = 1
let g:loaded_matchparen = 1
let g:loaded_2html_plugin = 1
let g:loaded_logiPat = 1
let g:loaded_rrhelper = 1
let g:no_gitrebase_maps = 1

let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
let g:loaded_netrwSettings = 1
let g:loaded_netrwFileHandlers = 1

" Set main configuration directory as parent directory
let $VIM_PATH =
	\ get(g:, 'etc_vim_path',
	\   exists('*stdpath') ? stdpath('config') :
	\   ! empty($MYVIMRC) ? fnamemodify(expand($MYVIMRC, 1), ':h') :
	\   ! empty($VIMCONFIG) ? expand($VIMCONFIG, 1) :
	\   ! empty($VIM_PATH) ? expand($VIM_PATH, 1) :
	\   fnamemodify(resolve(expand('<sfile>:p')), ':h:h')
	\ )

" Set data/cache directory as $XDG_CACHE_HOME/vim
let $DATA_PATH =
	\ expand(($XDG_CACHE_HOME ? $XDG_CACHE_HOME : '~/.cache') . '/vim', 1)

" Collection of user plugin list config file-paths
let s:config_paths = get(g:, 'etc_config_paths', [
	\ $VIM_PATH . '/config/plugins.yaml',
	\ $VIM_PATH . '/config/local.plugins.yaml',
	\ $VIM_PATH . '/usr/vimrc.yaml',
	\ $VIM_PATH . '/usr/vimrc.json',
	\ $VIM_PATH . '/vimrc.yaml',
	\ $VIM_PATH . '/vimrc.json',
	\ ])

" Filter non-existent config paths
call filter(s:config_paths, 'filereadable(v:val)')

function! s:main()
	if has('vim_starting')
		" When using VIMINIT trick for exotic MYVIMRC locations, add path now.
		if &runtimepath !~# $VIM_PATH
			set runtimepath^=$VIM_PATH
			set runtimepath+=$VIM_PATH/after
		endif

		" Ensure data directories
		for s:path in [
				\ $DATA_PATH,
				\ $DATA_PATH . '/undo',
				\ $DATA_PATH . '/backup',
				\ $DATA_PATH . '/session',
				\ $DATA_PATH . '/swap',
				\ $VIM_PATH . '/spell' ]
			if ! isdirectory(s:path)
				call mkdir(s:path, 'p', 0770)
			endif
		endfor

		" Python interpreter settings
		if has('nvim')
			" Try the virtualenv created by venv.sh
			let l:virtualenv = $DATA_PATH . '/venv/bin/python'
			if empty(l:virtualenv) || ! filereadable(l:virtualenv)
				" Fallback to old virtualenv location
				let l:virtualenv = $DATA_PATH . '/venv/neovim3/bin/python'
			endif
			if filereadable(l:virtualenv)
				let g:python3_host_prog = l:virtualenv
			endif

		elseif has('pythonx')
			if has('python3')
				set pyxversion=3
			elseif has('python')
				set pyxversion=2
			endif
		endif
	endif

	" Initializes chosen package manager
	call s:use_{s:package_manager}()
endfunction

" Use dein as a plugin manager
function! s:use_dein()
	let l:cache_path = $DATA_PATH . '/dein'

	if has('vim_starting')
		" Use dein as a plugin manager
		let g:dein#auto_recache = 1
		let g:dein#install_max_processes = 12

		" Add dein to vim's runtimepath
		if &runtimepath !~# '/dein.vim'
			let s:dein_dir = l:cache_path . '/repos/github.com/Shougo/dein.vim'
			" Clone dein if first-time setup
			if ! isdirectory(s:dein_dir)
				execute '!git clone https://github.com/Shougo/dein.vim' s:dein_dir
				if v:shell_error
					call s:error('dein installation has failed! is git installed?')
					finish
				endif
			endif

			execute 'set runtimepath+='.substitute(
				\ fnamemodify(s:dein_dir, ':p') , '/$', '', '')
		endif
	endif

	" Initialize dein.vim (package manager)
	if dein#load_state(l:cache_path)
		let l:rc = s:parse_config_files()
		if empty(l:rc)
			call s:error('Empty plugin list')
			return
		endif

		" Start propagating file paths and plugin presets
		call dein#begin(l:cache_path, extend([expand('<sfile>')], s:config_paths))

		for plugin in l:rc
			" If vim already started, don't re-add existing ones
			if has('vim_starting')
					\ || ! has_key(g:dein#_plugins, fnamemodify(plugin['repo'], ':t'))
				call dein#add(plugin['repo'], extend(plugin, {}, 'keep'))
			endif
		endfor

		" Add any local ./dev plugins
		if isdirectory($VIM_PATH . '/dev')
			call dein#local($VIM_PATH . '/dev', { 'frozen': 1, 'merged': 0 })
		endif
		call dein#end()

		" Save cached state for faster startups
		if ! g:dein#_is_sudo
			call dein#save_state()
		endif

		" Update or install plugins if a change detected
		if dein#check_install()
			if ! has('nvim')
				set nomore
			endif
			call dein#install()
		endif
	endif

	if has('vim_starting') && ! has('nvim')
		filetype plugin indent on
		syntax enable
	endif
endfunction

function! s:use_plug() abort
	" vim-plug package-manager initialization
	let l:cache_root = $DATA_PATH . '/plug'
	let l:cache_init = l:cache_root . '/init.vimplug'
	let l:cache_repos = l:cache_root . '/repos'

	augroup user_plugin_vimplug
		autocmd!
	augroup END

	if &runtimepath !~# '/init.vimplug'

		if ! isdirectory(l:cache_init)
			silent !curl -fLo $DATA_PATH/plug/init.vimplug/autoload/plug.vim
				\ --create-dirs
				\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

			autocmd user_plugin_vimplug VimEnter * PlugInstall --sync | source $MYVIMRC
		endif

		execute 'set runtimepath+='.substitute(
			\ fnamemodify(l:cache_init, ':p') , '/$', '', '')
	endif

	let l:rc = s:parse_config_files()
	if empty(l:rc)
		call s:error('Empty plugin list')
		return
	endif

	call plug#begin(l:cache_repos)
	for plugin in l:rc
		call plug#(plugin['repo'], extend(plugin, {}, 'keep'))
	endfor
	call plug#end()
endfunction

function! s:parse_config_files()
	let l:merged = []
	try
		" Merge all lists of plugins together
		for l:cfg_file in s:config_paths
			let l:merged = extend(l:merged, s:load_config(l:cfg_file))
		endfor
	catch /.*/
		call s:error(
			\ 'Unable to read configuration files at ' . string(s:config_paths))
		echoerr v:exception
	endtry

	" If there's more than one config file source,
	" de-duplicate plugins by repo key.
	if len(s:config_paths) > 1
		call s:dedupe_plugins(l:merged)
	endif
	return l:merged
endfunction

function! s:dedupe_plugins(list)
	let l:list = reverse(a:list)
	let l:i = 0
	let l:seen = {}
	while i < len(l:list)
		let l:key = list[i]['repo']
		if l:key !=# '' && has_key(l:seen, l:key)
			call remove(l:list, i)
		else
			if l:key !=# ''
				let l:seen[l:key] = 1
			endif
			let l:i += 1
		endif
	endwhile
	return reverse(l:list)
endfunction

" General utilities, mainly for dealing with user configuration parsing
" ---

function! s:error(msg)
	for l:mes in s:str2list(a:msg)
		echohl WarningMsg | echomsg '[config/init] ' . l:mes | echohl None
	endfor
endfunction

function! s:debug(msg)
	for l:mes in s:str2list(a:msg)
		echohl WarningMsg | echomsg '[config/init] ' . l:mes | echohl None
	endfor
endfunction

function! s:load_config(filename)
	" Parse YAML/JSON config file
	if a:filename =~# '\.json$'
		" Parse JSON with built-in json_decode
		let l:json = readfile(a:filename)
		return has('nvim') ? json_decode(l:json) : json_decode(join(l:json))
	elseif a:filename =~# '\.ya\?ml$'
		" Parse YAML with common command-line utilities
		return s:load_yaml(a:filename)
	endif
	call s:error('Unknown config file format ' . a:filename)
	return ''
endfunction

function! s:str2list(expr)
	" Convert string to list
	return type(a:expr) ==# v:t_list ? a:expr : split(a:expr, '\n')
endfunction

" YAML related
" ---

let s:convert_tool = ''

function! s:load_yaml(filename)
	if empty(s:convert_tool)
		let s:convert_tool = s:find_yaml2json_method()
	endif

	if s:convert_tool ==# 'ruby'
		let l:cmd = "ruby -e 'require \"json\"; require \"yaml\"; ".
			\ "print JSON.generate YAML.load \$stdin.read'"
	elseif s:convert_tool ==# 'python'
		let l:cmd = "python -c 'import sys,yaml,json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))'"
	elseif s:convert_tool ==# 'yq'
		let l:cmd = 'yq e -j -I 0'
	else
		let l:cmd = s:convert_tool
	endif

	try
		let l:raw = readfile(a:filename)
		return json_decode(system(l:cmd, l:raw))
	catch /.*/
		call s:error([
			\ string(v:exception),
			\ 'Error loading ' . a:filename,
			\ 'Caught: ' . string(v:exception),
			\ ])
	endtry
endfunction

function! s:find_yaml2json_method()
	if exists('*json_decode')
		" Try different tools to convert YAML into JSON:
		if executable('yj')
			" See https://github.com/sclevine/yj
			return 'yj'
		elseif executable('yq')
			" See https://github.com/mikefarah/yq
			return 'yq'
		elseif executable('yaml2json') && s:test_yaml2json()
			" See https://github.com/bronze1man/yaml2json
			return 'yaml2json'
		" Or, try ruby. Which is installed on every macOS by default
		" and has yaml built-in.
		elseif executable('ruby') && s:test_ruby_yaml()
			return 'ruby'
		" Or, fallback to use python3 and PyYAML
		elseif executable('python') && s:test_python_yaml()
			return 'python'
		endif
		call s:error([
			\ 'Unable to find a proper YAML parsing utility.',
			\ 'Please run: pip3 install --user PyYAML',
			\ ])
	else
		call s:error('"json_decode" unsupported. Upgrade to latest Neovim or Vim')
	endif
endfunction

function! s:test_yaml2json()
	" Test yaml2json capabilities
	try
		let result = system('yaml2json', "---\na: 1.5")
		if v:shell_error != 0
			return 0
		endif
		let result = json_decode(result)
		return result.a == 1.5
	catch
	endtry
	return 0
endfunction

function! s:test_ruby_yaml()
	" Test Ruby YAML capabilities
	call system("ruby -e 'require \"json\"; require \"yaml\"'")
	return v:shell_error == 0
endfunction

function! s:test_python_yaml()
	" Test Python YAML capabilities
	call system("python -c 'import sys,yaml,json'")
	return v:shell_error == 0
endfunction

call s:main()

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/local.plugins.yaml
================================================
- repo: ntpeters/vim-better-whitespace
  hook_add: |
    let g:better_whitespace_filetypes_blacklist=['diff', 'git', 'gitcommit', 'unite', 'qf', 'help', 'markdown', 'fugitive', 'defx', 'dashboard']

- repo: terryma/vim-multiple-cursors
- repo: tpope/vim-repeat
- repo: jszakmeister/vim-togglecursor
- repo: mhinz/vim-startify
# - repo: glepnir/dashboard-nvim
#   on_event: VimEnter
#   hook_source: luafile $VIM_PATH/config/plugins/dashboard.lua
# - repo: nvim-tree/nvim-web-devicons
- repo: tpope/vim-abolish
- repo: tpope/vim-projectionist
- repo: vim-scripts/BufOnly.vim
- repo: godlygeek/tabular
# - repo: kien/rainbow_parentheses.vim
- repo: haya14busa/incsearch.vim
- repo: haya14busa/incsearch-fuzzy.vim
- repo: vim-airline/vim-airline
- repo: vim-airline/vim-airline-themes
- repo: tpope/vim-surround
- repo: junegunn/vim-easy-align
- repo: voldikss/vim-translator
- repo: APZelos/blamer.nvim
- repo: solarnz/thrift.vim
- { repo: Valloric/MatchTagAlways, on_ft: [html, xhtml, xml, jinja]}

- repo: Yggdroot/indentLine
  hook_add: |
    let g:indentLine_bufNameExclude = ['NERD_tree.*', 'defx', 'startify', '__vista__', 'dashboard']
    let g:indentLine_fileTypeExclude = ['defx', '__vista__', 'help', 'clap_input', 'tagbar', 'vista_kind']

- repo: neoclide/coc.nvim
  merge: 0
  rev: release
  hook_add: source $VIM_PATH/config/plugins/coc.vim

# pip install https://github.com/Rykka/instant-rst.py/archive/master.zip
- { repo: gu-fan/riv.vim, on_ft: rst}
- { repo: gu-fan/InstantRst, on_ft: rst}
- { repo: PegasusWang/RST-Tables, on_ft: rst}
- { repo: iamcco/mathjax-support-for-mkdp, on_ft: markdown}

- repo: iamcco/markdown-preview.nvim
  on_ft: [ markdown, pandoc.markdown, rmd ]
  build: cd app & npm install
  hook_source: |
    let g:mkdp_auto_close = 0

# Python related, NOTE python-mode use submodule
# cd ~/.cache/vim/dein/repos/github.com; mkdir python-mode
# git clone --recurse-submodules https://github.com/python-mode/python-mode
- { repo: python-mode/python-mode, on_ft: python}

- repo: easymotion/vim-easymotion
  on_map: { n: <Plug> }
  hook_source: |
    let g:EasyMotion_do_mapping = 0
    let g:EasyMotion_prompt = 'Jump to → '
    let g:EasyMotion_keys = 'fjdksweoavn'
    let g:EasyMotion_smartcase = 1
    let g:EasyMotion_use_smartsign_us = 1

# enable ycm if you write cpp
# - repo: Valloric/YouCompleteMe
#   build: ./install.py --clang-completer

- repo: dense-analysis/ale
  on_event: FileType
  hook_add: |
    let g:ale_disable_lsp = 0
    let g:ale_echo_delay = 100
    let g:ale_lint_delay = 1000
    let g:ale_echo_msg_format = '%linter%: %code: %%s [%severity%]'
    let g:ale_history_enabled = 0
    let g:ale_sign_error = '✖'
    let g:ale_sign_warning = 'ⁱ'
    let g:ale_maximum_file_size = 500000
    let g:ale_linters = {'go': ['golangci-lint']}

# Golang related
# go get -u github.com/cweill/gotests/...
- repo: buoto/gotests-vim
  on_ft: [ go ]

- repo: fatih/vim-go
  if: has('nvim-0.4.0') || has('patch-8.0.1453')
  on_ft: [ go, gomod, gotexttmpl, gohtmltmpl ]
  hook_add: |-
    let g:go_gopls_enabled = 0
    let g:go_code_completion_enabled = 0
    let g:go_doc_keywordprg_enabled = 0
    let g:go_def_mapping_enabled = 0
    let g:go_jump_to_error = 0
    let g:go_fmt_autosave = 1
    let g:go_fmt_fail_silently = 1
    let g:go_imports_autosave = 1
    let g:go_mod_fmt_autosave = 0
    let g:go_snippet_engine = 'ultisnips'
    let g:go_textobj_enabled = 1
    let g:go_list_height = 10
    let g:go_list_autoclose = 0
    let g:go_fold_enable = []
    let g:go_highlight_array_whitespace_error = 0
    let g:go_highlight_chan_whitespace_error = 0
    let g:go_highlight_space_tab_error = 0
    let g:go_highlight_trailing_whitespace_error = 0
    let g:go_highlight_extra_types = 1
    let g:go_highlight_build_constraints = 1
    let g:go_highlight_fields = 1
    let g:go_highlight_format_strings = 1
    let g:go_highlight_functions = 1
    let g:go_highlight_function_calls = 1
    let g:go_highlight_function_parameters = 1
    let g:go_highlight_types = 1
    let g:go_highlight_generate_tags = 1
    let g:go_highlight_operators = 1
    let g:go_highlight_string_spellcheck = 0
    let g:go_highlight_variable_declarations = 0
    let g:go_highlight_variable_assignments = 0
    let g:go_fmt_command = "goimports"
    let g:go_def_reuse_buffer = 1
    let g:go_auto_type_info = 0
    if has('nvim') || exists(':terminal')
      let g:go_term_enabled = 1
      let g:go_term_close_on_exit = 0
    endif


================================================
FILE: config/local.vim
================================================
" Update file. :update is equlivalent to :write, but it only saves the file if the buffer has been modified
imap <Leader>w <esc>:update<CR>

" switch buffer
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> [n :bnext<CR>

" shortcuts to vimdiff, http://stackoverflow.com/questions/7309707/why-does-git-mergetool-opens-4-windows-in-vimdiff-id-expect-3
if &diff
    map <leader>1 :diffget LOCAL<CR>
    map <leader>2 :diffget BASE<CR>
    map <leader>3 :diffget REMOTE<CR>
endif

" change tab
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
" https://stackoverflow.com/questions/15583346/how-can-i-temporarily-make-the-window-im-working-on-to-be-fullscreen-in-vim
nnoremap tt :tab split<CR>

" Sudo to write
cnoremap w!! w !sudo tee % >/dev/null

" add :FormatJSON command, https://coderwall.com/p/faceag/format-json-in-vim
com! FormatJSON %!python3 -c "import json, sys, collections; print(json.dumps(json.load(sys.stdin, object_pairs_hook=collections.OrderedDict), ensure_ascii=False, indent=2))"
com! FormatJSONPy3 %!python3 -m json.tool
com! FormatJSONPy2 %!python -m json.tool
com! FormatJSONPy2Utf8 %!python -c "import json, sys, collections; print json.dumps(json.load(sys.stdin, object_pairs_hook=collections.OrderedDict), ensure_ascii=False, indent=2)"

map <F4> :%retab! <CR> :w <CR>

" use jj as esc
inoremap jj <Esc>`^
" move to next line (insert mode)
inoremap <C-j> <C-o>o
" move to end (insert mode)
inoremap <C-l> <C-o>A
noremap <leader>e :q<cr>
noremap <leader>E :qa!<cr>
" buffer delete
noremap <leader>q :bd<cr>
" jump last last edit position
noremap g<leader> 2g;a
" omni Completion
inoremap <C-Space> <C-x><C-o>

" disable autochdir
set noautochdir
set signcolumn=no
" fix E363: pattern uses more memory than 'maxmempattern'  see: https://github.com/vim/vim/issues/2049
set mmp=5000

" Disable built-in statusline & tabline
let g:tabline_plugin_enable = 0
let g:statusline_plugin_enable = 0

autocmd InsertLeave * :silent !/usr/local/bin/im-select com.apple.keylayout.ABC


================================================
FILE: config/mappings.vim
================================================
" Key-mappings
" ===

" Elite-mode {{{
" ----------
if get(g:, 'elite_mode')

	" Disable arrow movement, resize splits instead.
	nnoremap <silent><Up>    :resize +1<CR>
	nnoremap <silent><Down>  :resize -1<CR>
	nnoremap <silent><Left>  :vertical resize +1<CR>
	nnoremap <silent><Right> :vertical resize -1<CR>

endif

" }}}
" Navigation {{{
" ----------

" Fix keybind name for Ctrl+Space
map <Nul> <C-Space>
map! <Nul> <C-Space>

" Double leader key for toggling visual-line mode
nmap <Leader><Leader> V
vmap <Leader><Leader> <Esc>

" Toggle fold
nnoremap <CR> za

" Focus the current fold by closing all others
nnoremap <S-Return> zMzvzt

" The plugin rhysd/accelerated-jk moves through display-lines in normal mode,
" these mappings will move through display-lines in visual mode too.
vnoremap j gj
vnoremap k gk

" Easier line-wise movement
nnoremap gh g^
nnoremap gl g$

" Location/quickfix list movement
nmap ]l :lnext<CR>
nmap [l :lprev<CR>
nmap ]q :cnext<CR>
nmap [q :cprev<CR>

" Whitespace jump (see plugin/whitespace.vim)
nnoremap ]w :<C-u>WhitespaceNext<CR>
nnoremap [w :<C-u>WhitespacePrev<CR>

" Navigation in command line
cnoremap <C-h> <Home>
cnoremap <C-l> <End>
cnoremap <C-f> <Right>
cnoremap <C-b> <Left>

" }}}
" Scroll {{{
" ------

" Scroll step sideways
nnoremap zl z4l
nnoremap zh z4h

" Resize tab windows after top/bottom window movement
nnoremap <C-w>K <C-w>K<C-w>=
nnoremap <C-w>J <C-w>J<C-w>=

" Improve scroll, credits: https://github.com/Shougo
" noremap <expr> <C-f> max([winheight(0) - 2, 1])
"	\ ."\<C-d>".(line('w$') >= line('$') ? "L" : "M")
" noremap <expr> <C-b> max([winheight(0) - 2, 1])
"	\ ."\<C-u>".(line('w0') <= 1 ? "H" : "M")
" nnoremap <expr> zz (winline() == (winheight(0)+1) / 2) ?
"	\ 'zt' : (winline() == 1) ? 'zb' : 'zz'
" noremap <expr> <C-e> (line("w$") >= line('$') ? "j" : "3\<C-e>")
" noremap <expr> <C-y> (line("w0") <= 1         ? "k" : "3\<C-y>")

" }}}
" Clipboard {{{
" ---------

" Yank from cursor position to end-of-line
nnoremap Y y$

" Yank buffer's relative/absolute path to clipboard
nnoremap <Leader>y :let @+=expand("%:~:.")<CR>:echo 'Yanked relative path'<CR>
nnoremap <Leader>Y :let @+=expand("%:p")<CR>:echo 'Yanked absolute path'<CR>

" Cut & paste without pushing to register
" xnoremap p  "0p
" nnoremap x "_x

" }}}
" Edit {{{
" ----

" Macros
if get(g:, 'enable_universal_quit_mapping', 1)
	nnoremap Q q
	nnoremap gQ @q
endif

" Start new line from any cursor position in insert-mode
inoremap <S-Return> <C-o>o

" Deletes selection and start insert mode
" vnoremap <BS> "_xi

" Re-select blocks after indenting in visual/select mode
xnoremap < <gv
xnoremap > >gv|

" Use tab for indenting in visual/select mode
xnoremap <Tab> >gv|
xnoremap <S-Tab> <gv

" Indent and jump to first non-blank character linewise
nmap >>  >>_
nmap <<  <<_

" Drag current line/s vertically and auto-indent
nnoremap <Leader>k :m-2<CR>==
nnoremap <Leader>j :m+<CR>==
vnoremap <Leader>k :m'<-2<CR>gv=gv
vnoremap <Leader>j :m'>+<CR>gv=gv

" Duplicate lines
nnoremap <Leader>d m`YP``
vnoremap <Leader>d YPgv

" Change current word in a repeatable manner
nnoremap <Leader>cn *``cgn
nnoremap <Leader>cN *``cgN

" Change selected word in a repeatable manner
vnoremap <expr> <Leader>cn "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>" . "``cgn"
vnoremap <expr> <Leader>cN "y/\\V\<C-r>=escape(@\", '/')\<CR>\<CR>" . "``cgN"

" Duplicate paragraph
nnoremap <Leader>cp yap<S-}>p

" Remove spaces at the end of lines
nnoremap <Leader>cw :<C-u>silent! keeppatterns %substitute/\s\+$//e<CR>

" }}}
" Search & Replace {{{
" ----------------

" Use backspace key for matching parens
nmap <BS> %
xmap <BS> %

" Repeat latest f, t, F or T
nnoremap \ ;

" Select last paste
nnoremap <expr> gp '`['.strpart(getregtype(), 0, 1).'`]'

" Quick substitute within selected area
xnoremap sg :s//gc<Left><Left><Left>

" C-r: Easier search and replace visual/select mode
xnoremap <C-r> :<C-u>call <SID>get_selection('/')<CR>:%s/\V<C-R>=@/<CR>//gc<Left><Left><Left>

" Returns visually selected text
function! s:get_selection(cmdtype) "{{{
	let temp = @s
	normal! gv"sy
	let @/ = substitute(escape(@s, '\'.a:cmdtype), '\n', '\\n', 'g')
	let @s = temp
endfunction "}}}

" }}}
" Command & History {{{
" -----------------

" Start an external command with a single bang
nnoremap ! :!

" Put vim command output into buffer
nnoremap g! :<C-u>put=execute('')<Left><Left>

" Allow misspellings
cnoreabbrev qw wq
cnoreabbrev Wq wq
cnoreabbrev WQ wq
cnoreabbrev Qa qa
cnoreabbrev Bd bd
cnoreabbrev bD bd

" Switch history search pairs, matching my bash shell
cnoremap <expr> <C-p>  pumvisible() ? "\<C-p>" : "\<Up>"
cnoremap <expr> <C-n>  pumvisible() ? "\<C-n>" : "\<Down>"
cnoremap <Up>   <C-p>
cnoremap <Down> <C-n>

" }}}
" File operations {{{
" ---------------

" Switch (window) to the directory of the current opened buffer
map <Leader>cd :lcd %:p:h<CR>:pwd<CR>

" Open file under the cursor in a vsplit
nnoremap gf :vertical wincmd f<CR>

" Fast saving from all modes
" nnoremap <Leader>w :write<CR>
nnoremap <Leader>w :update<CR>
xnoremap <Leader>w <Esc>:write<CR>
nnoremap <C-s> :<C-u>write<CR>
xnoremap <C-s> :<C-u>write<CR>
cnoremap <C-s> <C-u>write<CR>

" }}}
" Editor UI {{{
" ---------

" Toggle editor's visual effects
nmap <Leader>ts :setlocal spell!<cr>
nmap <Leader>tn :setlocal nonumber!<CR>
nmap <Leader>tl :setlocal nolist!<CR>
nmap <Leader>th :nohlsearch<CR>

" Smart wrap toggle (breakindent and colorcolumn toggle as-well)
nmap <Leader>tw :execute('setlocal wrap! breakindent! colorcolumn=' .
	\ (&colorcolumn == '' ? &textwidth : ''))<CR>

" Tabs
nnoremap <silent> g1 :<C-u>tabfirst<CR>
nnoremap <silent> g5 :<C-u>tabprevious<CR>
nnoremap <silent> g9 :<C-u>tablast<CR>
nnoremap <silent> <C-Tab> :<C-U>tabnext<CR>
nnoremap <silent> <C-S-Tab> :<C-U>tabprevious<CR>
nnoremap <silent> <A-j> :<C-U>tabnext<CR>
nnoremap <silent> <A-k> :<C-U>tabprevious<CR>
nnoremap <silent> <A-{> :<C-u>-tabmove<CR>
nnoremap <silent> <A-}> :<C-u>+tabmove<CR>
" nnoremap <silent> <A-[> :<C-u>tabprevious<CR>
" nnoremap <silent> <A-]> :<C-u>tabnext<CR>

" Show vim syntax highlight groups for character under cursor
nmap <silent> <Leader>h
	\ :echo 'hi<'.synIDattr(synID(line('.'), col('.'), 1), 'name')
	\ . '> trans<'.synIDattr(synID(line('.'), col('.'), 0), 'name') . '> lo<'
	\ . synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') . '>'<CR>

" }}}
" Custom Tools {{{
" ------------

" Terminal
if exists(':tnoremap')
	if has('nvim')
		tnoremap   jj         <C-\><C-n>
	else
		tnoremap   <ESC><ESC>  <C-w>N
		tnoremap   jj          <C-w>N
	endif
endif

" Source line and selection in vim
vnoremap <Leader>S y:execute @@<CR>:echo 'Sourced selection.'<CR>
nnoremap <Leader>S ^vg_y:execute @@<CR>:echo 'Sourced line.'<CR>

" Context-aware action-menu, neovim only (see plugin/actionmenu.vim)
if has('nvim')
	nmap <silent> <LocalLeader>c :<C-u>ActionMenu<CR>
endif

" Session management shortcuts (see plugin/sessions.vim)
nmap <Leader>se :<C-u>SessionSave<CR>
nmap <Leader>sl :<C-u>SessionLoad<CR>

" Jump entire buffers in jumplist
nnoremap g<C-i> :<C-u>call JumpBuffer(-1)<CR>
nnoremap g<C-o> :<C-u>call JumpBuffer(1)<CR>

if has('mac')
	" Open the macOS dictionary on current word
	nmap <Leader>? :!open dict://<cword><CR>

	" Use Marked for real-time Markdown preview
	"
	if executable('/Applications/Marked 2.app/Contents/MacOS/Marked 2')
		autocmd user_events FileType markdown
			\ nmap <buffer><Leader>P :silent !open -a Marked\ 2.app '%:p'<CR>
	endif
endif

nnoremap <silent> <Leader>ml :call <SID>append_modeline()<CR>

" Append modeline after last line in buffer
" See: http://vim.wikia.com/wiki/Modeline_magic
function! s:append_modeline() "{{{
	let l:modeline = printf(' vim: set ts=%d sw=%d tw=%d %set :',
				\ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
	let l:modeline = substitute(&commentstring, '%s', l:modeline, '')
	call append(line('$'), l:modeline)
endfunction "}}}

" }}}
" Windows, buffers and tabs {{{
" -------------------------

" Ultimatus Quitos
if get(g:, 'enable_universal_quit_mapping', 1)
	autocmd user_events BufWinEnter,BufNew,BufNewFile *
		\ if &buftype == '' && ! mapcheck('q', 'n')
		\ |   nnoremap <silent><buffer> q :<C-u>quit<CR>
		\ | endif
endif

nnoremap <C-q> <C-w>
nnoremap <C-x> <C-w>x

" Window-control prefix
nnoremap  [Window]   <Nop>
nmap      s [Window]

nnoremap <silent> [Window]v  :<C-u>split<CR>
nnoremap <silent> [Window]g  :<C-u>vsplit<CR>
nnoremap <silent> [Window]t  :tabnew<CR>
nnoremap <silent> [Window]o  :<C-u>only<CR>
nnoremap <silent> [Window]b  :b#<CR>
nnoremap <silent> [Window]c  :close<CR>
nnoremap <silent> [Window]x  :<C-u>call <SID>window_empty_buffer()<CR>
nnoremap <silent> [Window]z  :<C-u>call <SID>zoom()<CR>

" Split current buffer, go to previous window and previous buffer
nnoremap <silent> [Window]sv :split<CR>:wincmd p<CR>:e#<CR>
nnoremap <silent> [Window]sg :vsplit<CR>:wincmd p<CR>:e#<CR>

" Background dark/light toggle and contrasts
nmap <silent> [Window]h :<C-u>call <SID>toggle_background()<CR>
nmap <silent> [Window]- :<c-u>call <SID>toggle_contrast(-v:count1)<cr>
nmap <silent> [Window]= :<c-u>call <SID>toggle_contrast(+v:count1)<cr>

function! s:toggle_background()
	if ! exists('g:colors_name')
		echomsg 'No colorscheme set'
		return
	endif
	let l:scheme = g:colors_name

	if l:scheme =~# 'dark' || l:scheme =~# 'light'
		" Rotate between different theme backgrounds
		execute 'colorscheme' (l:scheme =~# 'dark'
					\ ? substitute(l:scheme, 'dark', 'light', '')
					\ : substitute(l:scheme, 'light', 'dark', ''))
	else
		execute 'set background='.(&background ==# 'dark' ? 'light' : 'dark')
		if ! exists('g:colors_name')
			execute 'colorscheme' l:scheme
			echomsg 'The colorscheme `'.l:scheme
				\ .'` doesn''t have background variants!'
		else
			echo 'Set colorscheme to '.&background.' mode'
		endif
	endif
endfunction

function! s:toggle_contrast(delta)
	let l:scheme = ''
	if g:colors_name =~# 'solarized8'
		let l:schemes = map(['_low', '_flat', '', '_high'],
			\ '"solarized8_".(&background).v:val')
		let l:contrast = ((a:delta + index(l:schemes, g:colors_name)) % 4 + 4) % 4
		let l:scheme = l:schemes[l:contrast]
	endif
	if l:scheme !=# ''
		execute 'colorscheme' l:scheme
	endif
endfunction

function! s:window_empty_buffer()
	let l:current = bufnr('%')
	if ! getbufvar(l:current, '&modified')
		enew
		silent! execute 'bdelete '.l:current
	endif
endfunction

" Simple zoom toggle
function! s:zoom()
	if exists('t:zoomed')
		unlet t:zoomed
		wincmd =
	else
		let t:zoomed = { 'nr': bufnr('%') }
		vertical resize
		resize
		normal! ze
	endif
endfunction
" }}}

" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/all.vim
================================================
" Plugin Keyboard-Mappings
" ---

if dein#tap('denite.nvim')
	nnoremap <silent><LocalLeader>r :<C-u>Denite -resume -refresh -no-start-filter<CR>
	nnoremap <silent><LocalLeader>f :<C-u>Denite file/rec<CR>
	nnoremap <silent><LocalLeader>g :<C-u>Denite grep -start-filter<CR>
	nnoremap <silent><LocalLeader>b :<C-u>Denite buffer -default-action=switch<CR>
	nnoremap <silent><LocalLeader>i :<C-u>Denite file/old<CR>
	nnoremap <silent><LocalLeader>d :<C-u>Denite directory_rec directory_mru -default-action=cd<CR>
	nnoremap <silent><LocalLeader>v :<C-u>Denite neoyank -buffer-name=register<CR>
	xnoremap <silent><LocalLeader>v :<C-u>Denite neoyank -buffer-name=register -default-action=replace<CR>
	nnoremap <silent><LocalLeader>l :<C-u>Denite location_list -buffer-name=list -no-start-filter<CR>
	nnoremap <silent><LocalLeader>q :<C-u>Denite quickfix -buffer-name=list -no-start-filter<CR>
	nnoremap <silent><LocalLeader>m :<C-u>Denite mark<CR>
	nnoremap <silent><LocalLeader>n :<C-u>Denite dein<CR>
	nnoremap <silent><LocalLeader>j :<C-u>Denite jump change file/point -no-start-filter<CR>
	nnoremap <silent><LocalLeader>u :<C-u>Denite junkfile:new junkfile -buffer-name=list<CR>
	nnoremap <silent><LocalLeader>o :<C-u>Denite outline -no-start-filter<CR>
	nnoremap <silent><LocalLeader>s :<C-u>Denite session -buffer-name=list<CR>
	nnoremap <silent><LocalLeader>t :<C-u>Denite tag<CR>
	nnoremap <silent><LocalLeader>p :<C-u>Denite jump<CR>
	nnoremap <silent><LocalLeader>h :<C-u>Denite help<CR>
	nnoremap <silent><LocalLeader>w :<C-u>Denite file/rec -buffer-name=memo -path=~/docs/blog<CR>
	nnoremap <silent><LocalLeader>x :<C-u>Denite file_mru<CR>
	nnoremap <silent><LocalLeader>z :<C-u>Denite z -buffer-name=list<CR>
	nnoremap <silent><LocalLeader>; :<C-u>Denite command_history command<CR>
	nnoremap <silent><expr><LocalLeader>/ wordcount().chars > 10000 ?
		\ ":\<C-u>Denite -search line/external\<CR>"
		\ : ":\<C-u>Denite -search line\<CR>"
	nnoremap <silent><expr><LocalLeader>* wordcount().chars > 10000 ?
		\ ":\<C-u>DeniteCursorWord -no-start-filter -search line/external\<CR>"
		\ : ":\<C-u>DeniteCursorWord -no-start-filter -search line\<CR>"

	" Open Denite with word under cursor or selection
	nnoremap <silent> <Leader>gt :DeniteCursorWord tag:include -no-start-filter -immediately<CR>
	nnoremap <silent> <Leader>gf :DeniteCursorWord file/rec -no-start-filter<CR>
	nnoremap <silent> <Leader>gg :DeniteCursorWord grep -no-start-filter<CR>
	vnoremap <silent> <Leader>gg
		\ :<C-u>call <SID>get_selection('/')<CR>
		\ :execute 'Denite -no-start-filter grep:::'.escape(@/, ' :')<CR><CR>

	function! s:get_selection(cmdtype)
		let temp = @s
		normal! gv"sy
		let @/ = substitute(escape(@s, '\' . a:cmdtype), '\n', '\\n', 'g')
		let @s = temp
	endfunction
endif

if dein#tap('vim-clap')
	" nnoremap <silent><LocalLeader>f :<C-u>Clap! files<CR>
	" nnoremap <silent><LocalLeader>b :<C-u>Clap! buffers<CR>
	" nnoremap <silent><LocalLeader>g :<C-u>Clap! grep<CR>
	" nnoremap <silent><LocalLeader>j :<C-u>Clap! jumps<CR>
	" nnoremap <silent><LocalLeader>h :<C-u>Clap! help_tags<CR>
	" nnoremap <silent><LocalLeader>t :<C-u>Clap! tags<CR>
	" nnoremap <silent><LocalLeader>l :<C-u>Clap! loclist<CR>
	" nnoremap <silent><LocalLeader>q :<C-u>Clap! quickfix<CR>
	" nnoremap <silent><LocalLeader>m :<C-u>Clap! files ~/docs/books<CR>
	" nnoremap <silent><LocalLeader>y :<C-u>Clap! yanks<CR>
	" nnoremap <silent><LocalLeader>/ :<C-u>Clap! lines<CR>
	" nnoremap <silent><LocalLeader>* :<C-u>Clap! lines ++query=<cword><CR>
	" nnoremap <silent><LocalLeader>; :<C-u>Clap! command_history<CR>

	" nnoremap <silent><Leader>gl :<C-u>Clap! commits<CR>
	" nnoremap <silent><Leader>gt :<C-u>Clap! tags ++query=<cword><CR>
	" xnoremap <silent><Leader>gt :<C-u>Clap! tags ++query=@visual<CR><CR>
	" nnoremap <silent><Leader>gf :<C-u>Clap! files ++query=<cword><CR>
	" xnoremap <silent><Leader>gf :<C-u>Clap! files ++query=@visual<CR><CR>
	" nnoremap <silent><Leader>gg :<C-u>Clap! grep ++query=<cword><CR>
	" xnoremap <silent><Leader>gg :<C-u>Clap! grep ++query=@visual<CR><CR>

	autocmd user_events FileType clap_input call s:clap_mappings()

	function! s:clap_mappings()
		nnoremap <silent> <buffer> <nowait> <Space> :call clap#handler#tab_action()<CR>
		nnoremap <silent> <buffer> <nowait>' :call clap#handler#tab_action()<CR>
		inoremap <silent> <buffer> <Tab>   <C-R>=clap#navigation#linewise('down')<CR>
		inoremap <silent> <buffer> <S-Tab> <C-R>=clap#navigation#linewise('up')<CR>
		nnoremap <silent> <buffer> <C-j> :<C-u>call clap#navigation#linewise('down')<CR>
		nnoremap <silent> <buffer> <C-k> :<C-u>call clap#navigation#linewise('up')<CR>
		nnoremap <silent> <buffer> <C-n> :<C-u>call clap#navigation#linewise('down')<CR>
		nnoremap <silent> <buffer> <C-p> :<C-u>call clap#navigation#linewise('up')<CR>
		nnoremap <silent> <buffer> <C-f> :<c-u>call clap#navigation#scroll('down')<CR>
		nnoremap <silent> <buffer> <C-b> :<c-u>call clap#navigation#scroll('up')<CR>

		nnoremap <silent> <buffer> sg  :<c-u>call clap#handler#try_open('ctrl-v')<CR>
		nnoremap <silent> <buffer> sv  :<c-u>call clap#handler#try_open('ctrl-x')<CR>
		nnoremap <silent> <buffer> st  :<c-u>call clap#handler#try_open('ctrl-t')<CR>

		nnoremap <silent> <buffer> q     :<c-u>call clap#handler#exit()<CR>
		nnoremap <silent> <buffer> <Esc> :call clap#handler#exit()<CR>
		inoremap <silent> <buffer> <Esc> <C-R>=clap#navigation#linewise('down')<CR><C-R>=clap#navigation#linewise('up')<CR><Esc>
		inoremap <silent> <buffer> jj    <C-R>=clap#navigation#linewise('down')<CR><C-R>=clap#navigation#linewise('up')<CR><Esc>
	endfunction
endif

if dein#tap('vim-lsp')
	" Close preview window with Escape
	autocmd User lsp_float_opened
		\ nmap <buffer> <silent> <Esc> <Plug>(lsp-preview-close)
	autocmd User lsp_float_closed silent! nunmap <buffer> <Esc>
	autocmd user_events FileType markdown.lsp-hover
		\ nmap <silent><buffer>q :pclose<CR>| doautocmd <nomodeline> BufWinEnter
endif

if dein#tap('defx.nvim')
	nnoremap <silent> <LocalLeader>e
		\ :<C-u>Defx -toggle -buffer-name=explorer`tabpagenr()`<CR>
	nnoremap <silent> <LocalLeader>a
		\ :<C-u>Defx
		\   -search=`escape(expand('%:p'), ' :')`
		\   -buffer-name=explorer`tabpagenr()`<CR>
endif

if dein#tap('delimitMate')
	imap <buffer><expr> <C-Tab> delimitMate#JumpAny()
endif

if dein#tap('vista.vim')
	nnoremap <silent> <Leader>b :<C-u>Vista!!<CR>
	nnoremap <silent> <Leader>a :<C-u>Vista show<CR>
endif

if dein#tap('emmet-vim')
	autocmd user_events FileType html,css,javascript,javascriptreact,svelte
		\ EmmetInstall
		\ | imap <buffer> <C-Return> <Plug>(emmet-expand-abbr)
endif

if dein#tap('vim-gitgutter')
	nmap ]g <Plug>(GitGutterNextHunk)
	nmap [g <Plug>(GitGutterPrevHunk)
	nmap gS <Plug>(GitGutterStageHunk)
	xmap gS <Plug>(GitGutterStageHunk)
	nmap <Leader>gr <Plug>(GitGutterUndoHunk)
	nmap gs <Plug>(GitGutterPreviewHunk)
endif

if dein#tap('iron.nvim')
	nmap <silent> <Leader>rr :<C-u>IronRepl<CR><Esc>
	nmap <silent> <Leader>rq <Plug>(iron-exit)
	nmap <silent> <Leader>rl <Plug>(iron-send-line)
	vmap <silent> <Leader>rl <Plug>(iron-visual-send)
	nmap <silent> <Leader>rp <Plug>(iron-repeat-cmd)
	nmap <silent> <Leader>rc <Plug>(iron-clear)
	nmap <silent> <Leader>r<CR>  <Plug>(iron-cr)
	nmap <silent> <Leader>r<Esc> <Plug>(iron-interrupt)
endif

if dein#tap('vim-sandwich')
	nmap <silent> sa <Plug>(operator-sandwich-add)
	xmap <silent> sa <Plug>(operator-sandwich-add)
	omap <silent> sa <Plug>(operator-sandwich-g@)
	nmap <silent> sd <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
	xmap <silent> sd <Plug>(operator-sandwich-delete)
	nmap <silent> sr <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
	xmap <silent> sr <Plug>(operator-sandwich-replace)
	nmap <silent> sdb <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
	nmap <silent> srb <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
	omap ir <Plug>(textobj-sandwich-auto-i)
	xmap ir <Plug>(textobj-sandwich-auto-i)
	omap ab <Plug>(textobj-sandwich-auto-a)
	xmap ab <Plug>(textobj-sandwich-auto-a)
	omap is <Plug>(textobj-sandwich-query-i)
	xmap is <Plug>(textobj-sandwich-query-i)
	omap as <Plug>(textobj-sandwich-query-a)
	xmap as <Plug>(textobj-sandwich-query-a)
endif

if dein#tap('vim-operator-replace')
	xmap p <Plug>(operator-replace)
endif

if dein#tap('vim-niceblock')
	silent! xmap I  <Plug>(niceblock-I)
	silent! xmap gI <Plug>(niceblock-gI)
	silent! xmap A  <Plug>(niceblock-A)
endif

if dein#tap('accelerated-jk')
	nmap <silent> j <Plug>(accelerated_jk_gj)
	nmap <silent> k <Plug>(accelerated_jk_gk)
endif

if dein#tap('vim-edgemotion')
	map gj <Plug>(edgemotion-j)
	map gk <Plug>(edgemotion-k)
	xmap gj <Plug>(edgemotion-j)
	xmap gk <Plug>(edgemotion-k)
endif

if dein#tap('vim-quickhl')
	nmap mt <Plug>(quickhl-manual-this)
	nmap mT <Plug>(quickhl-manual-this-whole-word)
	xmap mt <Plug>(quickhl-manual-this)
	nmap mC <Plug>(quickhl-manual-reset)
endif

if dein#tap('vim-sidemenu')
	nmap <Leader>l <Plug>(sidemenu)
	xmap <Leader>l <Plug>(sidemenu-visual)
endif

if dein#tap('vim-indent-guides')
	nmap <silent><Leader>ti :<C-u>IndentGuidesToggle<CR>
endif

if dein#tap('vim-signature')
	let g:SignatureIncludeMarks = 'abcdefghijkloqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	let g:SignatureMap = {
		\ 'Leader':            'm',
		\ 'ListBufferMarks':   'm/',
		\ 'ListBufferMarkers': 'm?',
		\ 'PlaceNextMark':     'm,',
		\ 'ToggleMarkAtLine':  'mm',
		\ 'PurgeMarksAtLine':  'm-',
		\ 'DeleteMark':        'dm',
		\ 'PurgeMarks':        'm<Space>',
		\ 'PurgeMarkers':      'm<BS>',
		\ 'GotoNextLineAlpha': "']",
		\ 'GotoPrevLineAlpha': "'[",
		\ 'GotoNextSpotAlpha': '`]',
		\ 'GotoPrevSpotAlpha': '`[',
		\ 'GotoNextLineByPos': "]'",
		\ 'GotoPrevLineByPos': "['",
		\ 'GotoNextSpotByPos': 'mn',
		\ 'GotoPrevSpotByPos': 'mp',
		\ 'GotoNextMarker':    ']-',
		\ 'GotoPrevMarker':    '[-',
		\ 'GotoNextMarkerAny': ']=',
		\ 'GotoPrevMarkerAny': '[=',
		\ }
endif

if dein#tap('auto-git-diff')
	autocmd user_events FileType gitrebase
		\  nmap <buffer><CR>  <Plug>(auto_git_diff_scroll_manual_update)
		\| nmap <buffer><C-n> <Plug>(auto_git_diff_scroll_down_page)
		\| nmap <buffer><C-p> <Plug>(auto_git_diff_scroll_up_page)
		\| nmap <buffer><C-d> <Plug>(auto_git_diff_scroll_down_half)
		\| nmap <buffer><C-u> <Plug>(auto_git_diff_scroll_up_half)
endif

if dein#tap('committia.vim')
	let g:committia_hooks = {}
	function! g:committia_hooks.edit_open(info)
		setlocal winminheight=1 winheight=10
		resize 10
		imap <buffer><C-d> <Plug>(committia-scroll-diff-down-half)
		imap <buffer><C-u> <Plug>(committia-scroll-diff-up-half)
		imap <buffer><C-f> <Plug>(committia-scroll-diff-down-page)
		imap <buffer><C-b> <Plug>(committia-scroll-diff-up-page)
		imap <buffer><C-j> <Plug>(committia-scroll-diff-down)
		imap <buffer><C-k> <Plug>(committia-scroll-diff-up)
	endfunction
endif

if dein#tap('python_match.vim')
	autocmd user_events FileType python
		\ nmap <buffer> {{ [%
		\ | nmap <buffer> }} ]%
endif

if dein#tap('goyo.vim')
	nnoremap <Leader>G :Goyo<CR>
endif

if dein#tap('vim-shot-f')
	nmap f  <Plug>(shot-f-f)
	nmap F  <Plug>(shot-f-F)
	nmap t  <Plug>(shot-f-t)
	nmap T  <Plug>(shot-f-T)
	xmap f  <Plug>(shot-f-f)
	xmap F  <Plug>(shot-f-F)
	xmap t  <Plug>(shot-f-t)
	xmap T  <Plug>(shot-f-T)
	omap f  <Plug>(shot-f-f)
	omap F  <Plug>(shot-f-F)
	omap t  <Plug>(shot-f-t)
	omap T  <Plug>(shot-f-T)
endif

if dein#tap('vimwiki')
	nnoremap <silent> <Leader>W :<C-u>VimwikiIndex<CR>
endif

if dein#tap('vim-choosewin')
	nmap -         <Plug>(choosewin)
	nmap <Leader>- :<C-u>ChooseWinSwapStay<CR>
endif

if dein#tap('vimagit')
	nnoremap <silent> <Leader>mg :Magit<CR>
endif

if dein#tap('gina.vim')
	nnoremap <silent> <leader>ga :Gina add %:p<CR>
	nnoremap <silent> <leader>gd :Gina compare<CR>
	nnoremap <silent> <leader>gc :Gina commit<CR>
	nnoremap <silent> <leader>gb :Gina blame --width=40<CR>
	nnoremap <silent> <leader>gs :Gina status -s<CR>
	nnoremap <silent> <leader>gl :Gina log --graph --all<CR>
	nnoremap <silent> <leader>gF :Gina! fetch<CR>
	nnoremap <silent> <leader>gp :Gina! push<CR>
	nnoremap <silent> <leader>go :,Gina browse :<CR>
	vnoremap <silent> <leader>go :Gina browse :<CR>
endif

if dein#tap('vim-altr')
	nmap <leader>n  <Plug>(altr-forward)
	nmap <leader>N  <Plug>(altr-back)
endif

if dein#tap('any-jump.vim')
	" Normal mode: Jump to definition under cursor
	nnoremap <silent> <leader>ii :AnyJump<CR>

	" Visual mode: jump to selected text in visual mode
	xnoremap <silent> <leader>ii :AnyJumpVisual<CR>

	" Normal mode: open previous opened file (after jump)
	nnoremap <silent> <leader>ib :AnyJumpBack<CR>

	" Normal mode: open last closed search window again
	nnoremap <silent> <leader>il :AnyJumpLastResults<CR>
endif

if dein#tap('undotree')
	nnoremap <Leader>gu :UndotreeToggle<CR>
endif

if dein#tap('thesaurus_query.vim')
	nnoremap <silent> <Leader>K :<C-u>ThesaurusQueryReplaceCurrentWord<CR>
endif

if dein#tap('vim-asterisk')
	map *   <Plug>(asterisk-g*)
	map g*  <Plug>(asterisk-*)
	map #   <Plug>(asterisk-g#)
	map g#  <Plug>(asterisk-#)

	map z*  <Plug>(asterisk-z*)
	map gz* <Plug>(asterisk-gz*)
	map z#  <Plug>(asterisk-z#)
	map gz# <Plug>(asterisk-gz#)
endif

if dein#tap('vim-expand-region')
	xmap v <Plug>(expand_region_expand)
	xmap V <Plug>(expand_region_shrink)
endif

if dein#tap('sideways.vim')
	nnoremap <silent> <, :SidewaysLeft<CR>
	nnoremap <silent> >, :SidewaysRight<CR>
	nnoremap <silent> [, :SidewaysJumpLeft<CR>
	nnoremap <silent> ], :SidewaysJumpRight<CR>
	omap <silent> a, <Plug>SidewaysArgumentTextobjA
	xmap <silent> a, <Plug>SidewaysArgumentTextobjA
	omap <silent> i, <Plug>SidewaysArgumentTextobjI
	xmap <silent> i, <Plug>SidewaysArgumentTextobjI
endif

if dein#tap('splitjoin.vim')
	let g:splitjoin_join_mapping = ''
	let g:splitjoin_split_mapping = ''
	nmap sj :SplitjoinJoin<CR>
	nmap sk :SplitjoinSplit<CR>
endif

if dein#tap('linediff.vim')
	vnoremap <Leader>mdf :Linediff<CR>
	vnoremap <Leader>mda :LinediffAdd<CR>
	nnoremap <Leader>mds :<C-u>LinediffShow<CR>
	nnoremap <Leader>mdr :<C-u>LinediffReset<CR>
endif

if dein#tap('dsf.vim')
	nmap dsf <Plug>DsfDelete
	nmap csf <Plug>DsfChange
endif

if dein#tap('caw.vim')
	function! InitCaw() abort
		if &l:modifiable && &buftype ==# '' && &filetype != 'gitrebase'
			xmap <buffer> <Leader>V <Plug>(caw:wrap:toggle)
			nmap <buffer> <Leader>V <Plug>(caw:wrap:toggle)
			xmap <buffer> <Leader>v <Plug>(caw:hatpos:toggle)
			nmap <buffer> <Leader>v <Plug>(caw:hatpos:toggle)
			nmap <buffer> gc <Plug>(caw:prefix)
			xmap <buffer> gc <Plug>(caw:prefix)
			nmap <buffer> gcc <Plug>(caw:hatpos:toggle)
			xmap <buffer> gcc <Plug>(caw:hatpos:toggle)
		else
			silent! nunmap <buffer> <Leader>V
			silent! xunmap <buffer> <Leader>V
			silent! nunmap <buffer> <Leader>v
			silent! xunmap <buffer> <Leader>v
			silent! nunmap <buffer> gc
			silent! xunmap <buffer> gc
			silent! nunmap <buffer> gcc
			silent! xunmap <buffer> gcc
		endif
	endfunction
	autocmd user_events FileType * call InitCaw()
	call InitCaw()
endif

if dein#tap('fin.vim')
	nnoremap <Leader>f :<C-u>Fin<CR>

	function! InitFin() abort
		cmap <buffer><nowait> <Tab>   <Plug>(fin-line-next)
		cmap <buffer><nowait> <S-Tab> <Plug>(fin-line-prev)
		cmap <buffer><nowait> <C-j>   <Plug>(fin-line-next)
		cmap <buffer><nowait> <C-k>   <Plug>(fin-line-prev)
	endfunction
	autocmd user_events FileType fin call InitFin()
endif

if dein#tap('vim-textobj-function')
	omap <silent> af <Plug>(textobj-function-a)
	omap <silent> if <Plug>(textobj-function-i)
	xmap <silent> af <Plug>(textobj-function-a)
	xmap <silent> if <Plug>(textobj-function-i)
endif

if dein#tap('vim-easymotion')
	nmap ss <Plug>(easymotion-s2)
endif

if dein#tap('vim-airline')
	let g:airline_powerline_fonts=1
	let g:airline_theme = 'materialbox'
	let g:airline#extensions#tabline#enabled = 1
endif

if dein#tap('incsearch-fuzzy.vim')
	map z/ <Plug>(incsearch-fuzzy-/)
	map z? <Plug>(incsearch-fuzzy-?)
	map zg/ <Plug>(incsearch-fuzzy-stay)
endif

if dein#tap('python-mode')
	" 注意如果使用了 rope 一般是项目根目录打开文件,不要切到子目录
	" set noautochdir 注意这个自动切换目录会使rope找目录不正确,禁用,坑死我
	" 如果你发现找不到你的 package 或者系统的,编辑你的代码根目录下 .ropeproject/config.py 里的文件就可以了
	" 比如加上 prefs.add('python_path', '/usr/local/lib/python2.7/site-packages/') 就可以找到系统包了

	" when PYTHON_VERSION env variable is set, use python2. default Use python3
	" ch: 如果设置了 export PYTHON_VERSION=2 环境变量使用 python2 ,否则默认 python3
	if $PYTHON_VERSION == '2'
		let g:pymode_python = 'python'  " Values are `python`, `python3`, `disable`.
	else
		let g:pymode_python = 'python3'  " Values are `python`, `python3`, `disable`.
	endif
	let g:pymode_paths = reverse(split(globpath(getcwd().'/eggs', '*'), '\n'))    " support zc.buildout
	let g:pymode_trim_whitespaces = 1
	let g:pymode_quickfix_maxheight = 3
	let g:pymode_indent = 1
	let g:pymode_folding = 1
	let g:pymode_breakpoint = 1
	let g:pymode_breakpoint_bind = "<C-d>"  " NOTE: use ctrl+d insert ipdb
	let g:pymode_breakpoint_cmd = 'import ipdb; ipdb.set_trace()  # BREAKPOINT TODO REMOVE; from nose.tools import set_trace; set_trace()'

	let g:pymode_run = 1
	let g:pymode_run_bind = "<C-e>"
	let g:pymode_virtualenv = 1
	let g:pymode_virtualenv_path = $VIRTUAL_ENV

	" use coc.nvim, disalbe rope
	let g:pymode_rope = 0
	let g:pymode_rope_autoimport = 0
	let g:pymode_rope_complete_on_dot = 0
	let g:pymode_rope_lookup_project = 0
	let g:pymode_rope_goto_definition_bind = "<C-]>"
	let g:pymode_rope_goto_definition_cmd = 'vnew'
	let g:pymode_rope_regenerate_on_write = 0

	let g:pymode_lint = 1
	let g:pymode_lint_on_write = 1
	let g:pymode_lint_on_fly = 0
	let g:pymode_lint_message = 1
	let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe', 'pylint']
	let g:pymode_lint_ignore = ["C0103, C0111, C0301, C0304, C0325, E0702, E1120, R0201, R0903, R0911, R0912, R0913, R1705, W0105, W0108, W0110, W0201, W0221, W0223, W0235, W0403, W0511, W0622, W0703, W1202"]
	let g:pymode_lint_options_mccabe = { 'complexity': 15 }
	let g:pymode_lint_signs = 1
	" if you want use emoji you shoud set : Iterm2->Profiles->Text->Use Unicode versoin 9 widths
	let g:pymode_lint_todo_symbol = '😡'
	let g:pymode_lint_error_symbol = "\U2717"
	let g:pymode_lint_comment_symbol = "\u2757"
	let g:pymode_lint_visual_symbol = "\u0021"

	" 修改默认的红线为浅色,solorized黑色主题
	highlight ColorColumn ctermbg=233
	let g:pymode_lint_cwindow = 0
	let g:pymode_options_max_line_length = 120
	let g:pymode_options_colorcolumn = 1
	" 指定UltiSnips python的docstring风格, sphinx, google, numpy
	let g:ultisnips_python_style = 'sphinx'
	" use coc doc
	let g:pymode_doc = 0
endif

if dein#tap('vim-go')
	autocmd user_events FileType go
		\   nmap <C-]> <Plug>(go-def)
		\ | nmap <Leader>god  <Plug>(go-describe)
		\ | nmap <Leader>goc  <Plug>(go-callees)
		\ | nmap <Leader>goC  <Plug>(go-callers)
		\ | nmap <Leader>goi  <Plug>(go-info)
		\ | nmap <Leader>gom  <Plug>(go-implements)
		\ | nmap <Leader>gos  <Plug>(go-callstack)
		\ | nmap <Leader>goe  <Plug>(go-referrers)
		\ | nmap <Leader>gor  <Plug>(go-run)
		\ | nmap <Leader>gov  <Plug>(go-vet)
		\ | nmap <Leader>got  <Plug>(go-test)
		\ | nmap <Leader>ga  <Plug>(go-alternate-edit)
		\ | nmap <Leader>gf  <Plug>(go-test-func)
		\ | nmap fd  <Plug>(go-def-vertical)
	  \ | nnoremap <Leader>r :GoRun % <CR>
endif

if dein#tap('fzf.vim')
	nnoremap <silent> <Leader>ag :Ag <C-R><C-W><CR>
	nnoremap <silent> <Leader>s :Ag <CR>
	nnoremap <silent> <Leader>f :Buffers <CR>
	nnoremap <silent> <c-p> :Files <CR>
endif

if dein#tap('vim-json')
	let g:vim_json_syntax_conceal = 0
endif

if dein#tap('vim-translator')
	" Display translation in a window
	nmap <silent> <Leader>t <Plug>TranslateW
	vmap <silent> <Leader>t <Plug>TranslateWV
endif

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/asyncomplete.vim
================================================
" :h asyncomplete
" ---
" Problems? https://github.com/prabirshrestha/asyncomplete.vim/issues

" Debugging:
" let g:asyncomplete_log_file = expand('~/asyncomplete.log', 1)
" let g:lsp_log_file = expand('~/vim-lsp.log', 1)

" Smart completion-menu selection behavior:
" 1) Insert new-line if nothing selected
" 2) Otherwise, insert and expand selected snippet (via UltiSnips)
" 3) Otherwise, insert selected completion item
" 4) If completion-menu is closed, try to expand empty pairs (via DelimitMate)
function s:smart_carriage_return()
	if pumvisible()
		let l:info = complete_info()

		" Detect non-selection and insert new-line
		if get(l:info, 'selected', -1) == -1
			return "\<C-y>\<CR>"
		endif
		" Detect snippet and expand (via UltiSnips)
		if exists('g:UltiSnipsEditSplit')
			let l:menu = get(get(l:info['items'], l:info['selected'], {}), 'menu')
			if len(l:menu) > 0 && stridx(l:menu, 'Snips: ') == 0
				return "\<C-y>\<C-R>=UltiSnips#ExpandSnippet()\<CR>"
			endif
		endif
		" Otherwise, when pum is visible, insert selected completion
		return "\<C-y>"
	endif

	" Expand empty pairs (via delimitMate)
	if get(b:, 'delimitMate_enabled') && delimitMate#WithinEmptyPair()
		return "\<C-R>=delimitMate#ExpandReturn()\<CR>"
	endif

	" Propagate a carriage-return
	return "\<CR>"
endfunction

" Smart selection
inoremap <silent> <CR> <C-R>=<SID>smart_carriage_return()<CR>

" Force completion pop-up display
imap <C-Space> <Plug>(asyncomplete_force_refresh)

" Navigation
inoremap <expr><silent> <Tab>   pumvisible() ? "\<Down>" : (<SID>is_whitespace() ? "\<Tab>" : asyncomplete#force_refresh())
inoremap <expr><silent> <S-Tab> pumvisible() ? "\<Up>"   : (<SID>is_whitespace() ? "\<C-h>" : asyncomplete#force_refresh())

inoremap <expr> <C-j>   pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k>   pumvisible() ? "\<Up>"   : "\<C-k>"
inoremap <expr> <C-d>   pumvisible() ? "\<PageDown>" : "\<C-d>"
inoremap <expr> <C-u>   pumvisible() ? "\<PageUp>"   : "\<C-u>"

" Menu control
inoremap <expr> <C-y> pumvisible() ? asyncomplete#close_popup() : "\<C-y>"
inoremap <expr> <C-e> pumvisible() ? asyncomplete#cancel_popup() : "\<C-e>"

function! s:is_whitespace()
	let col = col('.') - 1
	return ! col || getline('.')[col - 1] =~# '\s'
endfunction

" Pre-processors
" ---

" DISABLED: Auto-complete popup doesn't show after dot e.g. "class."
" function! s:sort_by_priority_preprocessor(options, matches) abort
" 	let l:items = []
" 	for [l:source_name, l:matches] in items(a:matches)
" 		for l:item in l:matches['items']
" 			if stridx(l:item['word'], a:options['base']) == 0
" 				let l:item['priority'] =
"					\ get(asyncomplete#get_source_info(l:source_name), 'priority', 1)
" 				call add(l:items, l:item)
" 			endif
" 		endfor
" 	endfor
" 	let l:items = sort(l:items, {a, b -> b['priority'] - a['priority']})
" 	call asyncomplete#preprocess_complete(a:options, l:items)
" endfunction
"
" let g:asyncomplete_preprocessor = [function('s:sort_by_priority_preprocessor')]

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/coc.vim
================================================
" May need for vim (not neovim) since coc.nvim calculate byte offset by count
" utf-8 byte sequence.
set encoding=utf-8
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup

" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [e <Plug>(coc-diagnostic-prev)
nmap <silent> ]e <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
autocmd ColorScheme * highlight CocHighlightText ctermfg=109 ctermbg=60 guifg=#8abeb7 guibg=#5f5f87

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
nmap <Leader>rf <Plug>(coc-refactor)

" Formatting selected code.
nmap <Leader>p  <Plug>(coc-format)
xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

nmap <leader>ti :call CocAction('showIncomingCalls') <cr>

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s).
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder.
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac  <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf  <Plug>(coc-fix-current)

" Run the Code Lens action on the current line.
nmap <leader>cl  <Plug>(coc-codelens-action)

" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
  nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif

" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)

" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')

" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call     CocAction('fold', <f-args>)

" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR   :call     CocActionAsync('runCommand', 'editor.action.organizeImport')

" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>


================================================
FILE: config/plugins/colorizer.lua
================================================
-- nvim-colorizer
-- ===
-- See https://github.com/norcalli/nvim-colorizer.lua

require 'colorizer'.setup {
  css = { rgb_fn = true; };
  scss = { rgb_fn = true; };
  sass = { rgb_fn = true; };
  stylus = { rgb_fn = true; };
  svelte = { rgb_fn = true; };
  vim = { names = false; };
  tmux = { names = false; };
  'javascript';
  'javascriptreact';
  'typescript';
  'typescriptreact';
  html = {
    mode = 'foreground';
  }
}


================================================
FILE: config/plugins/dashboard.lua
================================================
require 'dashboard'.setup {
  theme = 'hyper',
  config = {
    week_header = {
      enable = true,
    },
    shortcut = {
      { desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' },
      {
        icon = ' ',
        icon_hl = '@variable',
        desc = 'Files',
        group = 'Label',
        action = 'Telescope find_files',
        key = 'f',
      },
      {
        desc = ' Apps',
        group = 'DiagnosticHint',
        action = 'Telescope app',
        key = 'a',
      },
      {
        desc = ' dotfiles',
        group = 'Number',
        action = 'Telescope dotfiles',
        key = 'd',
      },
    },
  }
}


================================================
FILE: config/plugins/defx.vim
================================================
" :h defx
" ---
" Problems? https://github.com/Shougo/defx.nvim/issues

call defx#custom#option('_', {
	\ 'resume': 1,
	\ 'winwidth': 25,
	\ 'split': 'vertical',
	\ 'direction': 'topleft',
	\ 'show_ignored_files': 0,
	\ 'columns': 'indent:git:icons:filename',
	\ 'root_marker': '',
	\ 'ignored_files':
	\     '.mypy_cache,.pytest_cache,.git,.hg,.svn,.stversions'
	\   . ',__pycache__,.sass-cache,*.egg-info,.DS_Store,*.pyc'
	\ })

call defx#custom#column('git', {
	\   'indicators': {
	\     'Modified'  : '•',
	\     'Staged'    : '✚',
	\     'Untracked' : 'ᵁ',
	\     'Renamed'   : '≫',
	\     'Unmerged'  : '≠',
	\     'Ignored'   : 'ⁱ',
	\     'Deleted'   : '✖',
	\     'Unknown'   : '⁇'
	\   }
	\ })

call defx#custom#column('mark', { 'readonly_icon': '', 'selected_icon': '' })
call defx#custom#column('filename', { 'root_marker_highlight': 'Comment' })

" defx-icons plugin
let g:defx_icons_column_length = 2
let g:defx_icons_mark_icon = ''

" Used in s:toggle_width()
let s:original_width = get(get(defx#custom#_get().option, '_'), 'winwidth')

" Events
" ---

augroup user_plugin_defx
	autocmd!

	" Define defx window mappings
	autocmd FileType defx call <SID>defx_mappings()

	" Delete defx if it's the only buffer left in the window
	autocmd WinEnter * if &filetype == 'defx' && winnr('$') == 1 | bdel | endif

	" Move focus to the next window if current buffer is defx
	autocmd TabLeave * if &filetype == 'defx' | wincmd w | endif

	" autocmd WinEnter * if &filetype ==# 'defx'
	"	\ |   silent! highlight! link CursorLine TabLineSel
	"	\ | endif
	"
	" autocmd WinLeave * if &filetype ==# 'defx'
	"	\ |   silent! highlight! link CursorLine NONE
	"	\ | endif

augroup END

" Internal functions
" ---

function! s:jump_dirty(dir) abort
	" Jump to the next position with defx-git dirty symbols
	let l:icons = get(g:, 'defx_git_indicators', {})
	let l:icons_pattern = join(values(l:icons), '\|')

	if ! empty(l:icons_pattern)
		let l:direction = a:dir > 0 ? 'w' : 'bw'
		return search(printf('\(%s\)', l:icons_pattern), l:direction)
	endif
endfunction

function! s:defx_toggle_tree() abort
	" Open current file, or toggle directory expand/collapse
	if defx#is_directory()
		return defx#do_action('open_tree', ['nested', 'toggle'])
	endif
	" return defx#do_action('multi', ['drop', 'quit'])
	return defx#do_action('multi', ['drop'])
endfunction

function! s:defx_mappings() abort
	" Defx window keyboard mappings
	setlocal signcolumn=no expandtab
	setlocal cursorline nonu

	nnoremap <silent><buffer><expr> <CR>  <SID>defx_toggle_tree()
	nnoremap <silent><buffer><expr> e     <SID>defx_toggle_tree()
	nnoremap <silent><buffer><expr> l     <SID>defx_toggle_tree()
	nnoremap <silent><buffer><expr> h     defx#do_action('close_tree')
	nnoremap <silent><buffer><expr> t     defx#do_action('open_tree', 'recursive')
	nnoremap <silent><buffer><expr> st    defx#do_action('multi', [['drop', 'tabnew'], 'quit'])
	nnoremap <silent><buffer><expr> sg    defx#do_action('multi', [['drop', 'vsplit'], 'quit'])
	nnoremap <silent><buffer><expr> sv    defx#do_action('multi', [['drop', 'split'], 'quit'])
	nnoremap <silent><buffer><expr> P     defx#do_action('preview')
	nnoremap <silent><buffer><expr> y     defx#do_action('yank_path')
	nnoremap <silent><buffer><expr> x     defx#do_action('execute_system')
	nnoremap <silent><buffer><expr> gx    defx#do_action('execute_system')
	nnoremap <silent><buffer><expr> .     defx#do_action('toggle_ignored_files')

	" Defx's buffer management
	" nnoremap <silent><buffer><expr> <Esc>  defx#do_action('quit')
	nnoremap <silent><buffer><expr> q      defx#do_action('quit')
	nnoremap <silent><buffer><expr> se     defx#do_action('save_session')
	nnoremap <silent><buffer><expr> <C-r>  defx#do_action('redraw')
	nnoremap <silent><buffer><expr> <C-g>  defx#do_action('print')

	" File/dir management
	nnoremap <silent><buffer><expr><nowait> c  defx#do_action('copy')
	nnoremap <silent><buffer><expr><nowait> m  defx#do_action('move')
	nnoremap <silent><buffer><expr><nowait> p  defx#do_action('paste')
	nnoremap <silent><buffer><expr><nowait> r  defx#do_action('rename')
	nnoremap <silent><buffer><expr> dd defx#do_action('remove_trash')
	nnoremap <silent><buffer><expr> K  defx#do_action('new_directory')
	nnoremap <silent><buffer><expr> N  defx#do_action('new_multiple_files')

	" Jump
	nnoremap <silent><buffer>  [g :<C-u>call <SID>jump_dirty(-1)<CR>
	nnoremap <silent><buffer>  ]g :<C-u>call <SID>jump_dirty(1)<CR>

	" Change directory
	nnoremap <silent><buffer><expr><nowait> \  defx#do_action('cd', getcwd())
	nnoremap <silent><buffer><expr><nowait> &  defx#do_action('cd', getcwd())
	nnoremap <silent><buffer><expr> <BS>  defx#async_action('cd', ['..'])
	nnoremap <silent><buffer><expr> ~     defx#async_action('cd')
	nnoremap <silent><buffer><expr> u   defx#do_action('cd', ['..'])
	nnoremap <silent><buffer><expr> 2u  defx#do_action('cd', ['../..'])
	nnoremap <silent><buffer><expr> 3u  defx#do_action('cd', ['../../..'])
	nnoremap <silent><buffer><expr> 4u  defx#do_action('cd', ['../../../..'])

	" Selection
	nnoremap <silent><buffer><expr> *  defx#do_action('toggle_select_all')
	nnoremap <silent><buffer><expr><nowait> <Space>
		\ defx#do_action('toggle_select') . 'j'

	nnoremap <silent><buffer><expr> S  defx#do_action('toggle_sort', 'Time')
	nnoremap <silent><buffer><expr> C
		\ defx#do_action('toggle_columns', 'indent:mark:filename:type:size:time')

	" Tools
	nnoremap <silent><buffer><expr> w   defx#do_action('call', '<SID>toggle_width')
	nnoremap <silent><buffer><expr> gd  defx#async_action('multi', ['drop', 'quit', ['call', '<SID>git_diff']])
	nnoremap <silent><buffer><expr> gr  defx#do_action('call', '<SID>grep')
	nnoremap <silent><buffer><expr> gf  defx#do_action('call', '<SID>find_files')
	if exists('$TMUX')
		nnoremap <silent><buffer><expr> gl  defx#async_action('call', '<SID>explorer')
	endif
endfunction

" TOOLS
" ---

function! s:git_diff(context) abort
	Gina compare
endfunction

function! s:find_files(context) abort
	" Find files in parent directory with Denite
	let l:target = a:context['targets'][0]
	let l:parent = fnamemodify(l:target, ':h')
	silent execute 'wincmd w'
	silent execute 'Denite file/rec:'.l:parent
endfunction

function! s:grep(context) abort
	" Grep in parent directory with Denite
	let l:target = a:context['targets'][0]
	let l:parent = fnamemodify(l:target, ':h')
	silent execute 'wincmd w'
	silent execute 'Denite grep:'.l:parent
endfunction

function! s:toggle_width(context) abort
	" Toggle between defx window width and longest line
	let l:max = 0
	for l:line in range(1, line('$'))
		let l:len = strdisplaywidth(substitute(getline(l:line), '\s\+$', '', ''))
		let l:max = max([l:len + 1, l:max])
	endfor
	let l:new = l:max == winwidth(0) ? s:original_width : l:max
	call defx#call_action('resize', l:new)
endfunction

function! s:explorer(context) abort
	" Open file-explorer split with tmux
	let l:explorer = s:find_file_explorer()
	if empty('$TMUX') || empty(l:explorer)
		return
	endif
	let l:target = a:context['targets'][0]
	let l:parent = fnamemodify(l:target, ':h')
	let l:cmd = 'split-window -p 30 -c ' . l:parent . ' ' . l:explorer
	silent execute '!tmux ' . l:cmd
endfunction

function! s:find_file_explorer() abort
	" Detect terminal file-explorer
	let s:file_explorer = get(g:, 'terminal_file_explorer', '')
	if empty(s:file_explorer)
		for l:explorer in ['lf', 'hunter', 'ranger', 'vifm']
			if executable(l:explorer)
				let s:file_explorer = l:explorer
				break
			endif
		endfor
	endif
	return s:file_explorer
endfunction

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/denite.vim
================================================
" :h denite.txt
" ---
" Problems? https://github.com/Shougo/denite.nvim/issues

" Don't reload Denite twice (on vimrc reload)
if exists('*denite#start')
	finish
endif

" Denite general settings
call denite#custom#option('_', {
	\ 'prompt': '❯',
	\ 'start_filter': v:true,
	\ 'smartcase': v:true,
	\ 'source_names': 'short',
	\ 'highlight_preview_line': 'CursorColumn',
	\ 'max_candidate_width': 512,
	\ 'max_dynamic_update_candidates': 30000,
	\ })

" Use Neovim's floating window
if has('nvim-0.4')
	highlight! DeniteBackground ctermfg=250 ctermbg=237 guifg=#ACAFAE guibg=#2C3237

	call denite#custom#option('_', {
		\ 'split': 'floating',
		\ 'filter_split_direction': 'floating',
		\ 'floating_preview': v:true,
		\ 'preview_height': &lines / 3,
		\ 'preview_width': &columns / 2 - 4,
		\ 'match_highlight': v:false,
		\ 'highlight_window_background': 'DeniteBackground',
		\ 'highlight_filter_background': 'NormalFloat',
		\ 'highlight_matched_char': 'CursorLineNr',
		\ 'highlight_matched_range': 'Comment',
		\ })
else
	call denite#custom#option('_', {
		\ 'vertical_preview': v:true,
		\ 'preview_width': &columns / 2,
		\ })
endif

" Interactive grep search
call denite#custom#var('grep', 'min_interactive_pattern', 2)
call denite#custom#source('grep', 'args', ['', '', '!'])

" Allow customizable window positions: top, bottom, centertop, center (default)
function! s:denite_resize(position)
	if a:position ==# 'top'
		call denite#custom#option('_', {
			\ 'winwidth': &columns - 1,
			\ 'winheight': &lines / 3,
			\ 'wincol': 0,
			\ 'winrow': 1,
			\ })
	elseif a:position ==# 'bottom'
		call denite#custom#option('_', {
			\ 'winwidth': &columns - 1,
			\ 'winheight': &lines / 3,
			\ 'wincol': 0,
			\ 'winrow': (&lines - 2) - (&lines / 3),
			\ })
	elseif a:position ==# 'centertop'
		call denite#custom#option('_', {
			\ 'winwidth': &columns / 2,
			\ 'winheight': &lines / 3,
			\ 'wincol': &columns / 4,
			\ 'winrow': (&lines / 12),
			\ })
	else
		" Use Denite default, which is centered.
	endif
endfunction

" Set Denite's window position
let g:denite_position = get(g:, 'denite_position', 'centertop')
call s:denite_resize(g:denite_position)

" MATCHERS
" Default is 'matcher/fuzzy'
call denite#custom#source('tag', 'matchers', ['matcher/substring'])
call denite#custom#source('file/old', 'matchers', [
	\ 'matcher/project_files', 'matcher/ignore_globs' ])

" Use vim-clap's rust binary, called maple
if dein#tap('vim-clap')
	let s:clap_path = dein#get('vim-clap')['path']
	if executable(s:clap_path . '/target/release/maple')
		call denite#custom#filter('matcher/clap', 'clap_path', s:clap_path)
		call denite#custom#source('file/rec,grep,jump,buffer,file_mru,tag',
			\ 'matchers', [ 'matcher/clap' ])
	endif
endif

" SORTERS
" Default is 'sorter/rank'
call denite#custom#source('z', 'sorters', ['sorter/z'])
if has('nvim')
	call denite#custom#source('file/old', 'sorters', ['sorter/oldfiles'])
endif

" CONVERTERS
" Default is none
call denite#custom#source(
	\ 'buffer,file_mru,file/old',
	\ 'converters', ['converter/relative_word'])

" FIND and GREP COMMANDS
" ---
" Ripgrep
if executable('rg')
	call denite#custom#var('file/rec', 'command',
		\ ['rg', '--hidden', '--files', '--glob', '!.git', '--color', 'never'])

	call denite#custom#var('grep', {
		\ 'command': ['rg'],
		\ 'default_opts': ['--hidden', '-i', '--vimgrep', '--no-heading'],
		\ 'recursive_opts': [],
		\ 'pattern_opt': ['--regexp'],
		\ })

" The Silver Searcher (ag)
elseif executable('ag')
	call denite#custom#var('file/rec', 'command',
		\ ['ag', '--hidden', '--follow', '--nocolor', '--nogroup', '-g', ''])

	" Setup ignore patterns in your .agignore file!
	" https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage
	call denite#custom#var('grep', {
		\ 'command': ['ag'],
		\ 'default_opts': ['--vimgrep', '-i', '--hidden'],
		\ 'recursive_opts': [],
		\ 'pattern_opt': [],
		\ })

" Ack command
elseif executable('ack')
	call denite#custom#var('grep', {
		\ 'command': ['ack'],
		\ 'default_opts': [
		\   '--ackrc', $HOME.'/.config/ackrc', '-H', '-i',
		\   '--nopager', '--nocolor', '--nogroup', '--column',
		\ ],
		\ 'recursive_opts': [],
		\ 'pattern_opt': ['--match'],
		\ })
endif

" Denite EVENTS
augroup user_plugin_denite
	autocmd!

	autocmd FileType denite call s:denite_settings()
	autocmd FileType denite-filter call s:denite_filter_settings()
	autocmd User denite-preview call s:denite_preview()

	autocmd VimResized * call s:denite_resize(g:denite_position)
augroup END

" Denite main window settings
function! s:denite_settings() abort
	" Window options
	setlocal signcolumn=no cursorline

	" Use a more vibrant cursorline for Denite
	highlight! link CursorLine WildMenu
	autocmd user_plugin_denite BufDelete <buffer> highlight! link CursorLine NONE

	" Denite selection window key mappings
	nmap <silent><buffer> <C-j> j
	nmap <silent><buffer> <C-k> k
	nmap <silent><buffer> <C-n> j
	nmap <silent><buffer> <C-p> k
	nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
	nnoremap <silent><buffer><expr> i    denite#do_map('open_filter_buffer')
	nnoremap <silent><buffer><expr> /    denite#do_map('open_filter_buffer')
	nnoremap <silent><buffer><expr> dd   denite#do_map('do_action', 'delete')
	nnoremap <silent><buffer><expr> p    denite#do_map('do_action', 'preview')
	nnoremap <silent><buffer><expr> st   denite#do_map('do_action', 'tabopen')
	nnoremap <silent><buffer><expr> sg   denite#do_map('do_action', 'vsplit')
	nnoremap <silent><buffer><expr> sv   denite#do_map('do_action', 'split')
	nnoremap <silent><buffer><expr> '    denite#do_map('quick_move')
	nnoremap <silent><buffer><expr> q    denite#do_map('quit')
	nnoremap <silent><buffer><expr> r    denite#do_map('redraw')
	nnoremap <silent><buffer><expr> yy   denite#do_map('do_action', 'yank')
	nnoremap <silent><buffer><expr> <Esc>   denite#do_map('quit')
	nnoremap <silent><buffer><expr> <Tab>   denite#do_map('choose_action')
	nnoremap <silent><buffer><expr><nowait> <Space> denite#do_map('toggle_select').'j'
endfunction

" Denite-preview window settings
function! s:denite_preview() abort
	" Window options
	setlocal colorcolumn= signcolumn=no nolist nospell
	setlocal nocursorline nocursorcolumn number norelativenumber

	" Clear indents
	if exists('*indent_guides#clear_matches')
		call indent_guides#clear_matches()
	endif
endfunction

" Denite-filter window settings
function! s:denite_filter_settings() abort
	" Window options
	setlocal signcolumn=yes nocursorline nonumber norelativenumber

	" Disable Deoplete auto-completion within Denite filter window
	if exists('*deoplete#custom#buffer_option')
		call deoplete#custom#buffer_option('auto_complete', v:false)
	endif

	" Denite Filter window key mappings
	imap <silent><buffer> jj          <Plug>(denite_filter_update)
	nmap <silent><buffer> <Esc>       <Plug>(denite_filter_update)
	imap <silent><buffer> <Esc>       <Plug>(denite_filter_update)
	nmap <silent><buffer> <C-c>       <Plug>(denite_filter_update)
	imap <silent><buffer> <C-c>       <Plug>(denite_filter_update)
	imap <silent><buffer> <C-p>       <Up>
	imap <silent><buffer> <C-n>       <Down>

	imap <silent><buffer> <Tab>   <Plug>(denite_filter_update)ji
	imap <silent><buffer> <S-Tab> <Plug>(denite_filter_update)ki
endfunction

call denite#custom#filter('matcher_ignore_globs', 'ignore_globs',
	      \ [ '.git/', '.ropeproject/', '__pycache__/', 'eggs/', '.tmp', '.cache',
	      \   'venv/', 'images/', '*.min.*', 'img/', 'fonts/'])

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/gina.vim
================================================
" :h gina
" ---
" Problems? https://github.com/lambdalisue/gina.vim/issues

call gina#custom#command#alias('status', 'st')
call gina#custom#command#option('st', '-s')
call gina#custom#command#option('status', '-b')

" call gina#custom#command#option('/\v(status|branch|ls|grep|changes)', '--opener', 'botright 10split')
" call gina#custom#command#option('/\v(blame|diff|log)', '--opener', 'tabnew')
call gina#custom#command#option('commit', '--opener', 'below vnew')
call gina#custom#command#option('commit', '--verbose')

let s:width_quarter = string(winwidth(0) / 4)
let s:width_half = string(winwidth(0) / 2)

call gina#custom#command#option('blame', '--width', s:width_quarter)
let g:gina#command#blame#formatter#format = '%au: %su%= on %ti %ma%in'

" Open in vertical split
call gina#custom#command#option(
	\ '/\%(branch\|changes\|status\|grep\|log\|reflog\)',
	\ '--opener', 'vsplit'
	\)

" Fixed medium width types
call gina#custom#execute(
	\ '/\%(changes\|status\|ls\)',
	\ 'vertical resize ' . s:width_half . ' | setlocal winfixwidth'
	\)

" Fixed small width special types
call gina#custom#execute(
	\ '/\%(branch\)',
	\ 'vertical resize ' . s:width_quarter . ' | setlocal winfixwidth'
	\)

" Alias 'p'/'dp' globally
call gina#custom#action#alias('/.*', 'dp', 'diff:preview')
call gina#custom#mapping#nmap('/.*', 'dp', ':<C-u>call gina#action#call(''dp'')<CR>', {'noremap': 1, 'silent': 1})
" call gina#custom#action#alias('/\%(blame\|log\)', 'preview', 'botright show:commit:preview')
call gina#custom#mapping#nmap('/.*', 'p',
	\ ':<C-u>call gina#action#call(''preview'')<CR>',
	\ {'noremap': 1, 'silent': 1, 'nowait': 1})

" Echo chunk info with K
call gina#custom#mapping#nmap('blame', 'K', '<Plug>(gina-blame-echo)')

" Blame mappings
let g:gina#command#blame#use_default_mappings = 0
call gina#custom#mapping#nmap('blame', '<Return>', '<Plug>(gina-blame-open)')
call gina#custom#mapping#nmap('blame', '<Backspace>', '<Plug>(gina-blame-back)')
call gina#custom#mapping#nmap('blame', '<C-r>', '<Plug>(gina-blame-C-L)')


================================================
FILE: config/plugins/goyo.vim
================================================

" Goyo
" ----

" s:goyo_enter() "{{{
" Disable visual candy in Goyo mode
function! s:goyo_enter()
	if has('gui_running')
		" Gui fullscreen
		set fullscreen
		set background=light
		set linespace=7
	elseif exists('$TMUX')
		" Hide tmux status
		silent !tmux set status off
	endif

	" Activate Limelight
	let s:stl = &l:statusline
	let &l:statusline = ''
	Limelight
endfunction

" }}}
" s:goyo_leave() "{{{
" Enable visuals when leaving Goyo mode
function! s:goyo_leave()
	if has('gui_running')
		" Gui exit fullscreen
		set nofullscreen
		set background=dark
		set linespace=0
	elseif exists('$TMUX')
		" Show tmux status
		silent !tmux set status on
	endif

	" De-activate Limelight
	let &l:statusline = s:stl
	unlet s:stl
	Limelight!
endfunction
" }}}

" Goyo Commands {{{
augroup user_plugin_goyo
	autocmd!
	autocmd! User GoyoEnter
	autocmd! User GoyoLeave
	autocmd  User GoyoEnter nested call <SID>goyo_enter()
	autocmd  User GoyoLeave nested call <SID>goyo_leave()
augroup END
" }}}

" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins/iron.lua
================================================
local iron = require('iron')

iron.core.set_config {
  preferred = {
    python = 'ipython'
  }
}


================================================
FILE: config/plugins/lsp.vim
================================================
" vim-lsp
" ---

" Apply settings for languages that registered LSP
function! s:on_lsp_buffer_enabled() abort
	if empty(globpath(&rtp, 'autoload/lsp.vim'))
		finish
	endif
	setlocal omnifunc=lsp#complete

	if exists('+tagfunc')
		setlocal tagfunc=lsp#tagfunc
	endif

	" Folds are really slow
	" setlocal foldmethod=expr
	"	\ foldexpr=lsp#ui#vim#folding#foldexpr()
	"	\ foldtext=lsp#ui#vim#folding#foldtext()

	" Prefer native help with vim files
	if &filetype != 'vim'
		nmap <silent><buffer> K  <Plug>(lsp-hover)
	endif

	nmap <silent><buffer> gr     <Plug>(lsp-references)
	nmap <silent><buffer> gi     <Plug>(lsp-peek-implementation)
	nmap <silent><buffer> gy     <Plug>(lsp-peek-type-definition)
	nmap <silent><buffer> <C-]>  <Plug>(lsp-definition)
	nmap <silent><buffer> g<C-]> <Plug>(lsp-peek-definition)
	nmap <silent><buffer> gd     <Plug>(lsp-peek-declaration)
	nmap <silent><buffer> gY     <Plug>(lsp-type-hierarchy)
	nmap <silent><buffer> gA     <Plug>(lsp-code-action)
	nmap <silent><buffer> ,s     <Plug>(lsp-signature-help)
	nmap <silent><buffer> [d     <Plug>(lsp-previous-diagnostic)
	nmap <silent><buffer> ]d     <Plug>(lsp-next-diagnostic)
	nmap <buffer> <Leader>rn     <Plug>(lsp-rename)
	nmap <buffer> <Leader>F      <plug>(lsp-document-format)
	vmap <buffer> <Leader>F      <plug>(lsp-document-range-format)
endfunction

augroup lsp_user_plugin
	autocmd!

	autocmd User lsp_buffer_enabled call <SID>on_lsp_buffer_enabled()

	" autocmd CompleteDone * if pumvisible() == 0 | pclose | endif

	" autocmd VimResized * call <SID>fix_preview_max_width()

	" autocmd FileType markdown.lsp-hover
	"	\ nnoremap <buffer> K <Nop>
	"	\| nnoremap <silent><buffer>q :pclose<CR>

augroup END


================================================
FILE: config/plugins/whichkey.vim
================================================
" which-key
" ---

augroup user_events
	autocmd! FileType which_key
	autocmd  FileType which_key set laststatus=0 noshowmode noruler
		\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
augroup END

let g:which_key_hspace = 3

call which_key#register('<Space>', "g:which_key_map")

let g:which_key_map = {
	\ 'name': 'rafi vim',
	\ '-': 'swap window select',
	\ '?': 'open dictionary',
	\ 'a': 'open structure',
	\ 'b': 'find in structure',
	\ 'd': 'duplicate line',
	\ 'e': 'open diagnostics',
	\ 'f': 'filter in-place',
	\ 'G': 'distraction-free',
	\ 'h': 'show highlight',
	\ 'j': 'move line down',
	\ 'k': 'move line up',
	\ 'K': 'thesaurus',
	\ 'l': 'open side-menu',
	\ 'N': 'alternate backwards',
	\ 'n': 'alternate forwards',
	\ 'S': 'source vim line',
	\ 'V': 'comment wrap toggle',
	\ 'v': 'comment toggle',
	\ 'W': 'open wiki',
	\ 'w': 'save',
	\ 'Y': 'yank relative path',
	\ 'y': 'yank absolute path',
	\ }

let g:which_key_map['c'] = {
	\ 'name': '+misc',
	\ 'd': 'change current window directory',
	\ 'n': 'change current word in a repeatable manner (forwards)',
	\ 'N': 'change current word in a repeatable manner (backwards)',
	\ 'p': 'duplicate paragraph',
	\ 'w': 'strip trailing whitespace',
	\ }

let g:which_key_map['g'] = {
	\ 'name': '+find',
	\ }

let g:which_key_map['i'] = {
	\ 'name': '+jump',
	\ }

let g:which_key_map['m'] = {
	\ 'name': '+misc2',
	\ }

let g:which_key_map['r'] = {
	\ 'name': '+iron',
	\ }

let g:which_key_map['s'] = {
	\ 'name': '+session',
	\ 'l': ' load project session',
	\ 'e': ' save project session',
	\ }

let g:which_key_map['t'] = {
	\ 'name': '+toggle',
	\ 'h': ' toggle search highlight',
	\ 'i': ' toggle indent',
	\ 'l': ' toggle hidden chars',
	\ 'n': ' toggle line numbers',
	\ 's': ' toggle spell',
	\ 'w': ' toggle wrap',
	\ }

" vim: set ts=2 sw=2 tw=80 noet :


================================================
FILE: config/plugins.yaml
================================================
---
# PLUGINS
# ===
# See config/plugins/all.vim for plugin mappings and config/plugins/*.vim

# Startup
# -------
- repo: Shougo/dein.vim
- repo: thinca/vim-localrc
- repo: Shougo/context_filetype.vim
- repo: jaawerth/nrun.vim
- { repo: rafi/awesome-vim-colorschemes, merged: 0 }

- repo: sgur/vim-editorconfig
  hook_add: |-
    let g:editorconfig_verbose = 1
    let g:editorconfig_blacklist = {
      \ 'filetype': [
      \   'git.*', 'fugitive', 'help', 'defx', 'denite.*', 'startify',
      \   'vista.*', 'tagbar', 'lsp-.*', 'clap_.*', 'any-jump', 'gina-.*',
      \   'lsp-*'
      \  ],
      \ 'pattern': ['\.un~$']
      \ }

# Improve CursorHold performance
# See: https://github.com/neovim/neovim/issues/12587
- { repo: antoinemadec/FixCursorHold.nvim, if: "has('nvim')" }

- repo: christoomey/vim-tmux-navigator
  if: "! (has('win32') || has('win64'))"

- repo: tpope/vim-sleuth
  hook_add: let g:sleuth_neighbor_limit = 5

# GUI only:
- { repo: equalsraf/neovim-gui-shim, if: has('gui_running') }

# Vim8 only:
- { repo: roxma/nvim-yarp, if: "! has('nvim')", depends: vim-hug-neovim-rpc }
- { repo: roxma/vim-hug-neovim-rpc, if: "! has('nvim')" }

# Lazy Loading
# ==========================================

# Languages
# ---------
- { repo: hail2u/vim-css3-syntax, on_ft: css }
- { repo: othree/csscomplete.vim, on_ft: css }
- { repo: cakebaker/scss-syntax.vim, on_ft: [ scss, sass ]}
- { repo: groenewege/vim-less, on_ft: less }
- { repo: iloginow/vim-stylus, on_ft: stylus }  # or wavded/vim-stylus ?
- { repo: mustache/vim-mustache-handlebars, on_ft: [html, mustache, handlebars]}
- { repo: digitaltoad/vim-pug, on_ft: [ pug, jade ]}

- repo: othree/html5.vim
  on_ft: html
  hook_add: |-
    let g:html5_event_handler_attributes_complete = 0
    let g:html5_rdfa_attributes_complete = 0
    let g:html5_microdata_attributes_complete = 0
    let g:html5_aria_attributes_complete = 0

# Markdown related
- repo: plasticboy/vim-markdown
  on_ft: markdown
  hook_add: |-
    let g:vim_markdown_frontmatter = 1
    let g:vim_markdown_strikethrough = 1
    let g:vim_markdown_folding_disabled = 1
    let g:vim_markdown_conceal = 0
    let g:vim_markdown_conceal_code_blocks = 0
    let g:vim_markdown_new_list_item_indent = 0
    let g:vim_markdown_toc_autofit = 0
    let g:vim_markdown_edit_url_in = 'vsplit'
    let g:vim_markdown_fenced_languages = [
      \ 'c++=cpp',
      \ 'viml=vim',
      \ 'bash=sh',
      \ 'ini=dosini',
      \ 'js=javascript',
      \ 'json=javascript',
      \ 'jsx=javascriptreact',
      \ 'tsx=typescriptreact',
      \ 'docker=Dockerfile',
      \ 'makefile=make',
      \ 'py=python'
      \ ]

# Javascript related
- repo: pangloss/vim-javascript
  on_ft: [ javascript, javascriptreact ]
  hook_add: let g:javascript_plugin_jsdoc = 1

- repo: HerringtonDarkholme/yats.vim
  on_ft: [ typescript, typescriptreact ]

- repo: MaxMEllon/vim-jsx-pretty
  on_ft: [ javascript, javascriptreact, typescriptreact ]
  depends: vim-javascript
  hook_add: let g:vim_jsx_pretty_colorful_config = 1

- { repo: leafOfTree/vim-svelte-plugin, depends: yats.vim, on_ft: svelte }
- { repo: heavenshell/vim-jsdoc, on_ft: [ javascript, javascriptreact ] }
- { repo: jparise/vim-graphql, on_ft: [ javascript, javascriptreact ] }
- { repo: moll/vim-node, on_ft: [ javascript, javascriptreact ] }
- { repo: kchmck/vim-coffee-script, on_ft: [ coffee, litcoffee ] }
- { repo: elzr/vim-json, on_ft: json }
- { repo: posva/vim-vue, on_ft: vue }

# pangloss/javascript vs. othree/yajs
#- { repo: othree/yajs.vim, on_ft: [ javascript, javascriptreact ]}
#- { repo: gavocanov/vim-js-indent, on_ft: [ javascript, javascriptreact ]}
#- repo: mxw/vim-jsx
#  on_ft: [ javascript, javascriptreact ]
#  hook_add: let g:jsx_ext_required = 0

# Python related
- { repo: vim-python/python-syntax, on_ft: python }
- { repo: Vimjas/vim-python-pep8-indent, on_ft: python }
- { repo: vim-scripts/python_match.vim, on_ft: python }  # ?
- { repo: raimon49/requirements.txt.vim, on_ft: requirements }

# Misc
- { repo: StanAngeloff/php.vim, on_ft: php }
- { repo: tbastos/vim-lua, on_ft: lua }
- { repo: vim-ruby/vim-ruby, on_ft: ruby }
- { repo: keith/swift.vim, on_ft: swift }
- { repo: rust-lang/rust.vim, on_ft: rust }
- { repo: vim-jp/syntax-vim-ex, on_ft: vim }
- { repo: chrisbra/csv.vim, on_ft: csv }
- { repo: tpope/vim-git, on_ft: [ gitcommit, gitrebase, gitconfig ]}
- { repo: ekalinin/Dockerfile.vim, on_ft: [ Dockerfile, docker-compose ]}
- { repo: tmux-plugins/vim-tmux, on_ft: tmux }
- { repo: MTDL9/vim-log-highlighting, on_ft: log }
- { repo: cespare/vim-toml, on_ft: toml }
- { repo: mboughaba/i3config.vim, on_ft: i3config }
- { repo: dag/vim-fish, on_ft: fish }
- { repo: jstrater/mpvim, on_ft: portfile }
- { repo: robbles/logstash.vim, on_ft: logstash }
- { repo: lifepillar/pgsql.vim, on_ft: pgsql }
- { repo: chr4/nginx.vim, on_ft: nginx }
- { repo: towolf/vim-helm, on_ft: helm }
- { repo: udalov/kotlin-vim, on_ft: kotlin }
- { repo: reasonml-editor/vim-reason-plus, on_ft: [ reason, merlin ] }

- repo: pearofducks/ansible-vim
  on_ft: [ ansible, ansible_hosts, jinja2 ]
  hook_add: |-
    let g:ansible_extra_keywords_highlight = 1
    let g:ansible_template_syntaxes = {
      \   '*.json.j2': 'json',
      \   '*.(ba)?sh.j2': 'sh',
      \   '*.ya?ml.j2': 'yaml',
      \   '*.xml.j2': 'xml',
      \   '*.conf.j2': 'conf',
      \   '*.ini.j2': 'ini'
      \ }

- repo: hashivim/vim-terraform
  on_ft: terraform
  on_cmd: [ Terraform, TerraformFmt ]

# ==========================================
# Commands
# --------
- repo: Shougo/defx.nvim
  on_cmd: Defx
  hook_source: source $VIM_PATH/config/plugins/defx.vim

- { repo: kristijanhusak/defx-git, on_source: defx.nvim }
- { repo: kristijanhusak/defx-icons, on_source: defx.nvim }

- { repo: tyru/caw.vim, on_map: { nx: <Plug> }}
- { repo: lambdalisue/fin.vim, on_cmd: Fin }
- { repo: mbbill/undotree, on_cmd: UndotreeToggle }
- { repo: jreybert/vimagit, on_cmd: Magit }
- { repo: tweekmonster/helpful.vim, on_cmd: HelpfulVersion }
- { repo: kana/vim-altr, on_map: { n: <Plug> }}
- { repo: Shougo/vinarise.vim, on_cmd: Vinarise }
- { repo: guns/xterm-color-table.vim, on_cmd: XtermColorTable }
- { repo: cocopon/colorswatch.vim, rev: main, on_cmd: ColorSwatchGenerate }
- { repo: dstein64/vim-startuptime, on_cmd: StartupTime }
- { repo: lambdalisue/suda.vim, on_event: BufRead }

- repo: liuchengxu/vim-which-key
  on_cmd: [ WhichKey, WhichKeyVisual ]
  hook_source: source $VIM_PATH/config/plugins/whichkey.vim

- repo: lambdalisue/gina.vim
  on_cmd: Gina
  on_ft: [ gitcommit, gitrebase ]
  hook_source: source $VIM_PATH/config/plugins/gina.vim

- repo: mhinz/vim-grepper
  on_map: { nx: <Plug> }
  on_cmd: Grepper
  hook_add: |-
    let g:grepper = {
        \ 'tools': ['rg', 'git', 'fd'],
        \ 'fd': {
        \   'grepprg':    'fd',
        \   'grepformat': '%f',
        \   'escape':     '\+*^$()[]',
        \ }}

- repo: brooth/far.vim
  on_cmd: [ Far, Farp, F ]
  hook_source: |-
    if executable('rg')
      let g:far#source = 'rg'
    elseif executable('ag')
      let g:far#source = 'ag'
    elseif executable('ack')
      let g:far#source = 'ack'
    endif

- repo: pechorin/any-jump.vim
  on_cmd: [ AnyJump, AnyJumpVisual ]
  hook_add: |-
    let g:any_jump_disable_default_keybindings = 1
    autocmd user_events FileType any-jump setlocal cursorline

- repo: Vigemus/iron.nvim
  if: has('nvim')
  on_cmd: [ IronRepl, IronReplHere, IronFocus, IronSend, IronWatchCurrentFile ]
  on_map: { nv: <Plug> }
  on_func: IronUnwatchFile
  hook_add: let g:iron_map_defaults = 0 | let g:iron_map_extended = 0
  hook_source: luafile $VIM_PATH/config/plugins/iron.lua

- repo: kana/vim-niceblock
  on_map: { x: <Plug> }
  hook_add: let g:niceblock_no_default_key_mappings = 0

- repo: t9md/vim-choosewin
  on_map: { n: <Plug> }
  hook_add: |-
    let g:choosewin_label = 'ADFGHJKLUIOPQWERT'
    let g:choosewin_label_padding = 5

- repo: wfxr/minimap.vim
  on_cmd: [ Minimap, MinimapToggle ]
  hook_source: |-
    let g:minimap_block_filetypes = ['fugitive', 'nerdtree', 'defx']

- repo: mzlogin/vim-markdown-toc
  on_cmd: [ GenTocGFM, GenTocRedcarpet, GenTocGitLab, UpdateToc ]
  hook_add: let g:vmt_auto_update_on_save = 0

- repo: reedes/vim-wordy
  on_cmd: [ Wordy, NoWordy, NextWordy ]
  # hook_add: let g:wordy_spell_dir = $DATA_PATH . '/wordy'

- repo: liuchengxu/vista.vim
  # on_cmd: Vista
  hook_add: |-
    let g:vista#renderer#enable_icon = 1
    let g:vista_echo_cursor_strategy = 'scroll'
    let g:vista_vimwiki_executive = 'markdown'
    let g:vista_executive_for = {
      \ 'vimwiki': 'markdown',
      \ 'pandoc': 'markdown',
      \ 'markdown': 'toc',
      \ 'go': 'coc',
      \ }

- repo: junegunn/fzf
  merged: 0
  on_cmd: FZF
  type__depth: 1
  hook_source: |-
    let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Todo', 'border': 'rounded' } }

- repo: junegunn/fzf.vim
  depends: fzf
  merged: 0
  on_cmd: [ Files, GitFiles, Buffers, Lines, Locate, Colors, Ag, Rg, Tags ]
  on_func: [ fzf#vim#with_preview, fzf#run, vista#finder#fzf#Run ]

- repo: Ron89/thesaurus_query.vim
  on_cmd:
    - Thesaurus
    - ThesaurusQueryReplaceCurrentWord
    - ThesaurusQueryLookupCurrentWord
  hook_add: |-
    let g:tq_map_keys = 0
    let g:tq_use_vim_autocomplete = 0

# ==========================================
# Interface
# ---------
- { repo: itchyny/vim-gitbranch, on_event: FileType }
- { repo: itchyny/vim-parenmatch, on_event: FileType }
- { repo: romainl/vim-cool, on_event: [ CursorMoved, InsertEnter ]}
- { repo: haya14busa/vim-asterisk, on_map: { nv: <Plug> }}
- { repo: rhysd/accelerated-jk, on_map: { n: <Plug> }, if: $SUDO_USER == '' }
- { repo: haya14busa/vim-edgemotion, on_map: { nv: <Plug> }}
- { repo: t9md/vim-quickhl, on_map: { nv: <Plug> }}
- { repo: rafi/vim-sidemenu, on_map: { nv: <Plug> }}

- repo: machakann/vim-highlightedyank
  if: "! has('nvim-0.5')"
  on_event: TextYankPost
  hook_source: let g:highlightedyank_highlight_duration = 200

- repo: romainl/vim-qf
  on_ft: qf
  on_event: QuickFixCmdPost
  on_map: { n: <Plug> }
  hook_add: |-
    let g:qf_bufname_or_text = 1
    let g:qf_auto_open_quickfix = 0
    let g:qf_auto_open_loclist = 0
    let g:qf_auto_resize = 0
    autocmd User preview_open_pre
      \  let g:vim_markdown_no_default_key_mappings = 1
      \| let g:vim_markdown_emphasis_multiline = 0
    autocmd User preview_open_post
      \  unlet! g:vim_markdown_no_default_key_mappings
      \| unlet! g:vim_markdown_emphasis_multiline

- repo: itchyny/vim-cursorword
  on_event: FileType
  hook_add: let g:cursorword = 0
  hook_source: |-
    augroup user_plugin_cursorword
      autocmd!
      autocmd FileType json,yaml,markdown,nginx,dosini,conf
        \ let b:cursorword = 1
      autocmd WinEnter * if &diff || &pvw | let b:cursorword = 0 | endif
      autocmd InsertEnter * if get(b:, 'cursorword', 0) == 1
        \| let b:cursorword = 0
        \| endif
      autocmd InsertLeave * if get(b:, 'cursorword', 1) == 0
        \| let b:cursorword = 1
        \| endif
    augroup END

- repo: airblade/vim-gitgutter
  on_event: FileType
  hook_add: |-
    let g:gitgutter_map_keys = 0
    let g:gitgutter_sign_added = '▎'
    let g:gitgutter_sign_modified = '▎'
    let g:gitgutter_sign_removed = '▍'
    let g:gitgutter_sign_removed_first_line = '▘'
    let g:gitgutter_sign_removed_above_and_below = '_¯'
    let g:gitgutter_sign_modified_removed = '▍'
    let g:gitgutter_preview_win_floating = 1
    let g:gitgutter_sign_allow_clobber = 0
    let g:gitgutter_sign_priority = 0
    let g:gitgutter_override_sign_column_highlight = 0

- repo: kshenoy/vim-signature
  depends: vim-gitgutter
  on_event: FileType
  hook_add: |-
    let g:SignatureForceRemoveGlobal = 0
    let g:SignatureUnconditionallyRecycleMarks = 1
    let g:SignatureErrorIfNoAvailableMarks = 0
    let g:SignaturePurgeConfirmation = 0
    let g:SignatureMarkTextHLDynamic = 1
    let g:SignatureMarkerTextHLDynamic = 1
    let g:SignatureIncludeMarkers = repeat('⚐', 10)
    autocmd user_events User GitGutter call signature#sign#Refresh()

- repo: nathanaelkane/vim-indent-guides
  if: 0
  on_event: FileType
  hook_source: |-
    let g:indent_guides_enable_on_vim_startup = 0
    let g:indent_guides_default_mapping = 0
    let g:indent_guides_tab_guides = 0
    let g:indent_guides_color_change_percent = 3
    let g:indent_guides_guide_size = 1
    let g:indent_guides_exclude_filetypes = [
      \ 'help', 'man', 'fern', 'defx', 'denite', 'denite-filter', 'startify',
      \ 'vista', 'vista_kind', 'tagbar', 'lsp-hover', 'clap_input', 'fzf',
      \ 'any-jump', 'gina-status', 'gina-commit', 'gina-log', 'minimap',
      \ 'quickpick-filter', 'lsp-quickpick-filter'
      \ ]
    autocmd user_events FileType * ++once IndentGuidesEnable

- repo: rhysd/committia.vim
  on_event: BufReadPost
  hook_source: let g:committia_min_window_width = 70

- repo: junegunn/goyo.vim
  depends: limelight.vim
  on_cmd: Goyo
  hook_source: source $VIM_PATH/config/plugins/goyo.vim

- repo: junegunn/limelight.vim
  on_cmd: Limelight

- repo: itchyny/calendar.vim
  on_cmd: Calendar
  hook_source: |-
    let g:calendar_google_calendar = 1
    let g:calendar_google_task = 1

- repo: deris/vim-shot-f
  on_map: { nxo: <Plug> }
  hook_add: let g:shot_f_no_default_key_mappings = 1

- repo: vimwiki/vimwiki
  on_map: { n: <Plug> }
  on_cmd: [ VimwikiIndex, VimwikiUISelect ]
  hook_add: |-
    let g:vimwiki_use_calendar = 1
    let g:vimwiki_hl_headers = 1
    let g:vimwiki_hl_cb_checked = 1
    let g:vimwiki_autowriteall = 0
  hook_source: |-
    let g:vimwiki_list = [
    \   { 'diary_header': 'Diary',
    \     'diary_link_fmt': '%Y-%m/%d',
    \     'auto_toc': 1,
    \     'path': '~/docs/wiki/',
    \     'syntax': 'markdown',
    \     'ext': '.md' },
    \   { 'path': '~/docs/books/',
    \     'syntax': 'markdown',
    \     'ext': '.md' }
    \ ]

- repo: norcalli/nvim-colorizer.lua
  if: has('nvim-0.4')
  on_event: FileType
  hook_source: luafile $VIM_PATH/config/plugins/colorizer.lua

# ==========================================
# Completion and code analysis
# ----------

# - repo: prabirshrestha/async.vim  # only autoload functions, lazy by nature
#
# - repo: prabirshrestha/asyncomplete.vim
#   on_source: asyncomplete-lsp.vim
#   hook_add: let g:asyncomplete_auto_completeopt = 0
#   hook_source: source $VIM_PATH/config/plugins/asyncomplete.vim
#
# - repo: prabirshrestha/asyncomplete-lsp.vim
#   on_source: vim-lsp
#
# - repo: prabirshrestha/vim-lsp
#   on_source: vim-lsp-settings
#   hook_source: source $VIM_PATH/config/plugins/lsp.vim
#   hook_add: |-
#     let g:lsp_auto_enable = argc() > 0
#     let g:lsp_ignorecase = 1
#     let g:lsp_signs_enabled = 1
#     let g:lsp_async_completion = 1
#     let g:lsp_fold_enabled = 0
#     let g:lsp_text_edit_enabled = 1
#     let g:lsp_peek_alignment = 'top'
#     let g:lsp_diagnostics_enabled = 1
#     let g:lsp_diagnostics_echo_cursor = 1
#     let g:lsp_diagnostics_echo_delay = 400
#     let g:lsp_diagnostics_virtual_text_enabled = 0
#     let g:lsp_diagnostics_highlights_delay = 400
#     let g:lsp_diagnostics_signs_error = {'text': '✖'}
#     let g:lsp_diagnostics_signs_warning = {'text': '⬪'}
#     let g:lsp_diagnostics_signs_hint = {'text': '▪'}
#     let g:lsp_diagnostics_signs_information = {'text': '▫'}
#
# - repo: mattn/vim-lsp-settings
#   on_event: [ BufReadPre, VimEnter ]
#   merged: 0
#   hook_post_source: |-
#     if ! g:lsp_auto_enable
#       call lsp#enable()
#     endif
#   hook_add: |-
#     let g:lsp_settings = {
#     \   'yaml-language-server': {
#     \     'allowlist': ['yaml', 'yaml.ansible'],
#     \   }
#     \ }
#
# - repo: prabirshrestha/asyncomplete-necovim.vim
#   on_source: asyncomplete.vim
#   hook_source: |-
#     autocmd User asyncomplete_setup call asyncomplete#register_source(
#       \ asyncomplete#sources#necovim#get_source_options({
#       \ 'name': 'necovim',
#       \ 'allowlist': ['vim'],
#       \ 'completor': function('asyncomplete#sources#necovim#completor'),
#       \ }))
#
# - repo: Shougo/neco-vim
#   on_source: asyncomplete-necovim.vim
#
# - repo: prabirshrestha/asyncomplete-buffer.vim
#   on_source: asyncomplete.vim
#   hook_source: |-
#     autocmd User asyncomplete_setup call asyncomplete#register_source(
#       \ asyncomplete#sources#buffer#get_source_options({
#       \ 'name': 'buffer',
#       \ 'allowlist': ['*'],
#       \ 'blocklist': ['go', 'denite', 'denite-filter', 'clap_input',
#       \               'quickpick-filter', 'lsp-quickpick-filter'],
#       \ 'completor': function('asyncomplete#sources#buffer#completor'),
#       \ 'config': {
#       \    'max_buffer_size': 4000000,
#       \  },
#       \ }))
#
# - repo: prabirshrestha/asyncomplete-tags.vim
#   if: executable('ctags')
#   on_source: asyncomplete.vim
#   hook_source: |-
#     autocmd User asyncomplete_setup call asyncomplete#register_source(
#       \ asyncomplete#sources#tags#get_source_options({
#       \ 'name': 'tags',
#       \ 'allowlist': ['*'],
#       \ 'blocklist': ['go', 'python', 'vim', 'denite', 'denite-filter',
#       \               'clap_input', 'quickpick-filter', 'lsp-quickpick-filter'],
#       \ 'completor': function('asyncomplete#sources#tags#completor'),
#       \ 'config': { 'max_file_size': 5000000 },
#       \ }))
#
# - repo: prabirshrestha/asyncomplete-file.vim
#   on_source: asyncomplete.vim
#   hook_source: |-
#     autocmd User asyncomplete_setup call asyncomplete#register_source(
#       \ asyncomplete#sources#file#get_source_options({
#       \ 'name': 'file',
#       \ 'priority': 10,
#       \ 'allowlist': ['*'],
#       \ 'blocklist': ['denite', 'denite-filter', 'clap_input',
#       \               'quickpick-filter', 'lsp-quickpick-filter'],
#       \ 'completor': function('asyncomplete#sources#file#completor')
#       \ }))
#
# - repo: wellle/tmux-complete.vim
#   if: "! (has('win32') || has('win64'))"
#   on_source: asyncomplete.vim
#   hook_add: |-
#     let g:tmuxcomplete#trigger = ''
#     let g:tmuxcomplete#asyncomplete_source_options = {
#       \ 'name': 'tmux',
#       \ 'priority': 0,
#       \ 'allowlist': ['*'],
#       \ 'blocklist': ['denite', 'denite-filter', 'clap_input',
#       \               'quickpick-filter', 'lsp-quickpick-filter'],
#       \ 'config': {
#       \   'splitmode': 'words',
#       \   'filter_prefix': 1,
#       \   'show_incomplete': 1,
#       \   'sort_candidates': 0,
#       \   'scrollback': 0,
#       \   'truncate': 0
#       \   }
#       \ }
#
# - repo: prabirshrestha/asyncomplete-ultisnips.vim
#   if: has('python3')
#   on_source: asyncomplete.vim
#   hook_source: |-
#     autocmd User asyncomplete_setup call asyncomplete#register_source(
#       \ asyncomplete#sources#ultisnips#get_source_options({
#       \ 'name': 'snip',
#       \ 'priority': 0,
#       \ 'allowlist': ['*'],
#       \ 'blocklist': ['denite', 'denite-filter', 'clap_input',
#       \               'quickpick-filter', 'lsp-quickpick-filter'],
#       \ 'completor': function('asyncomplete#sources#ultisnips#completor'),
#       \ }))
#
# - repo: SirVer/ultisnips
#   if: has('python3')
#   on_event: FileType
#   hook_add: |-
#     let g:UltiSnipsExpandTrigger = '<C-l>'
#     let g:UltiSnipsListSnippets = '<C-Tab>'
#     let g:UltiSnipsJumpForwardTrigger = '<Tab>'
#     let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'

- repo: honza/vim-snippets
  # depends: ultisnips
  on_event: FileType
  if: has('python3')
  merged: 0

- repo: mattn/emmet-vim
  on_event: InsertEnter
  on_ft:
    - css
    - html
    - vue
    - svelte
    - javascript
    - javascriptreact
    - typescript
    - typescriptreact
  hook_source: |-
    let g:user_emmet_complete_tag = 0
    let g:user_emmet_install_global = 0
    let g:user_emmet_install_command = 0
    let g:user_emmet_mode = 'i'

- repo: ludovicchabant/vim-gutentags
  if: executable('ctags')
  on_event: [ BufReadPost, BufWritePost ]
  hook_add: |-
    let g:gutentags_cache_dir = $DATA_PATH . '/tags'
    let g:gutentags_generate_on_write = 0
    let g:gutentags_generate_on_missing = 0
    let g:gutentags_generate_on_new = 0
    let g:gutentags_exclude_project_root = [ '/usr/local' ]
    let g:gutentags_exclude_filetypes = [ 'defx', 'denite', 'vista', 'magit' ]
    let g:gutentags_ctags_exclude = [
      \ '.idea', '.cache', '.tox', '.bundle', 'build', 'dist' ]

- repo: Raimondi/delimitMate
  on_event: FileType
  hook_source: |-
    let g:delimitMate_expand_cr = 1
    let g:delimitMate_expand_space = 1
    let g:delimitMate_smart_quotes = 1
    let g:delimitMate_expand_inside_quotes = 0
    let g:delimitMate_excluded_ft = 'mail,txt,denite-filter,clap_input'
    augroup user_plugin_delimitMate
      au!
      au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
      au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
      au FileType tex let b:delimitMate_quotes = ""
      au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
    augroup END

# ==========================================
# Denite
# ------
- repo: Shougo/denite.nvim
  on_cmd: Denite
  trusted: 1
  hook_source: source $VIM_PATH/config/plugins/denite.vim

- repo: Shougo/neomru.vim
  on_source: denite.nvim
  hook_add: |-
    let g:neomru#directory_mru_path = $DATA_PATH . '/mru/dir'
    let g:neomru#file_mru_path = $DATA_PATH . '/mru/file'
    let g:unite_source_file_mru_limit = 5000

- { repo: Shougo/neoyank.vim, on_source: denite.nvim, on_event: TextYankPost }
- { repo: Shougo/junkfile.vim, on_source: denite.nvim }
- { repo: chemzqm/unite-location, on_source: denite.nvim }
- { repo: rafi/vim-denite-session, on_source: denite.nvim }

- repo: rafi/vim-denite-z
  on_source: denite.nvim
  hook_source: |-
    command! -nargs=+ -complete=file Z call denite#start(
      \ [{'name': 'z', 'args': [<q-args>], {'immediately': 1}}])

- repo: liuchengxu/vim-clap
  merged: 0
  on_cmd: Clap
  hook_add: |-
    let g:clap_cache_directory = $DATA_PATH . '/clap'
    let g:clap_disable_run_rooter = v:true
    let g:clap_theme = 'atom_dark'
    let g:clap_layout = { 'relative': 'editor' }
    let g:clap_enable_icon = 1
    let g:clap_search_box_border_style = 'curve'
    let g:clap_provider_grep_enable_icon = 1
    let g:clap_prompt_format = '%spinner%%forerunner_status% %provider_id%: '
    let g:clap_current_selection_sign = {
      \ 'text': '→',
      \ 'texthl': 'ClapCurrentSelectionSign',
      \ 'linehl': 'ClapCurrentSelection' }
    let g:clap_selected_sign = {
      \ 'text': '* ',
      \ 'texthl': 'ClapSelectedSign',
      \ 'linehl': 'ClapSelected' }
    highlight! link ClapMatches Function
    highlight! link ClapNoMatchesFound WarningMsg

# ==========================================
# Operators
# ---------
- repo: kana/vim-operator-user  # only autoload functions, lazy by nature

- { repo: kana/vim-operator-replace, on_map: { vnx: <Plug> }}

- repo: machakann/vim-sandwich
  on_map: { vonx: <Plug>(operator-sandwich- }
  hook_add: |-
    let g:sandwich_no_default_key_mappings = 1
    let g:operator_sandwich_no_default_key_mappings = 1
    let g:textobj_sandwich_no_default_key_mappings = 1

# ==========================================
# Text objects
# ------------
- repo: kana/vim-textobj-user  # only autoload functions, lazy by nature
- { repo: terryma/vim-expand-region, on_map: { x: <Plug> }}
- { repo: AndrewRadev/sideways.vim, on_map: { onx: <Plug>Sideways }}
- { repo: AndrewRadev/splitjoin.vim, on_map: { n: <Plug>Splitjoin }}
- { repo: AndrewRadev/linediff.vim, on_cmd: Linediff }

- repo: AndrewRadev/dsf.vim
  on_map: { n: <Plug>Dsf }
  hook_add: let g:dsf_no_mappings = 1

- repo: kana/vim-textobj-function
  on_map: { ox: <Plug> }
  hook_add: let g:textobj_function_no_default_key_mappings = 1

#  vim: set ts=2 sw=2 tw=80 et :


================================================
FILE: config/statusline.vim
================================================
" Statusline
" ---

let s:stl  = " %7*%{&paste ? '=' : ''}%*"         " Paste symbol
let s:stl .= "%4*%{&readonly ? '' : '#'}%*"       " Modified symbol
let s:stl .= "%6*%{badge#mode('🔒', '🔎')}"       " Read-only symbol
let s:stl .= '%*%n'                               " Buffer number
let s:stl .= "%6*%{badge#modified('+')}%0*"       " Write symbol
let s:stl .= ' %1*%{badge#filename()}%* '         " Filename
let s:stl .= '%<'                                 " Start truncating here
let s:stl .= '%( %{badge#branch()} %)'           " Git branch name
let s:stl .= '%4*%(%{badge#syntax()} %)%*'        " Syntax lint
let s:stl .= "%4*%(%{badge#trails('␣%s')} %)%*"   " Whitespace
let s:stl .= '%3*%(%{badge#indexing()} %)%*'      " Indexing indicator
let s:stl .= '%3*%(%{badge#gitstatus()} %)%*'     " Git status
let s:stl .= '%='                                 " Align to right
let s:stl .= '%{badge#format()} %4*%*'           " File format
let s:stl .= '%( %{&fenc} %)'                     " File encoding
let s:stl .= '%4*%*%( %{&ft} %)'                 " File type
let s:stl .= '%3*%2* %l/%2c%4p%% '               " Line and column

" Non-active Statusline
let s:stl_nc = " %{badge#mode('🔒', 'Z')}%n"   " Read-only symbol
let s:stl_nc .= "%6*%{badge#modified('+')}%*"  " Unsaved changes symbol
let s:stl_nc .= ' %{badge#filename()}'         " Relative supername
let s:stl_nc .= '%='                           " Align to right
let s:stl_nc .= '%{&ft} '                      " File type

" Status-line blacklist
let s:statusline_filetypes_ignore = get(g:, 'statusline_filetypes_ignore',
	\ 'defx\|denite\|vista\|undotree\|diff\|sidemenu\|qf')

let s:statusline_filetypes = get(g:, 'statusline_filetypes', {
	\ 'defx': ['%{fnamemodify(getcwd(), ":t")}%=%l/%L'],
	\ 'magit': [
	\   '%y %{badge#gitstatus()}%<%=%{fnamemodify(badge#filename(), ":~")}%=%l/%L',
	\   '%y %{badge#gitstatus()}%= %l/%L'],
	\ 'minimap': [' '],
	\ 'denite-filter': ['%#Normal#'],
	\ })

" s:set_state replaces current statusline
function! s:set_state(filetype, index, default)
	" Skip statusline render during session loading
	if &previewwindow || exists('g:SessionLoad') "|| empty(a:filetype)
		return
	endif
	if has_key(s:statusline_filetypes, a:filetype)
		let l:states = s:statusline_filetypes[a:filetype]
		let l:want = get(l:states, a:index, l:states[0])
		if &l:statusline != l:want
			let &l:statusline = l:want
		endif
	elseif a:filetype !~# s:statusline_filetypes_ignore
		if &l:statusline != a:default
			let &l:statusline = a:default
		endif
	endif
endfunction

" Bind to Vim events
augroup user_statusline
	autocmd!

	" Set active/inactive statusline templates
	autocmd VimEnter,ColorScheme, * let &l:statusline = s:stl
	autocmd FileType,WinEnter,BufWinEnter * call s:set_state(&filetype, 0, s:stl)
	autocmd WinLeave * call s:set_state(&filetype, 1, s:stl_nc)

	" Redraw on Vim events
	autocmd FileChangedShellPost,BufFilePost,BufNewFile,BufWritePost * redrawstatus

	" Redraw on Plugins custom events
	autocmd User ALELintPost,ALEFixPost redrawstatus
	autocmd User NeomakeJobFinished redrawstatus
	autocmd User GutentagsUpdating redrawstatus
	autocmd User CocStatusChange,CocGitStatusChange redrawstatus
	autocmd User CocDiagnosticChange redrawstatus
	" autocmd User lsp_diagnostics_updated redrawstatus

	" if exists('##LspDiagnosticsChanged')
	" 	autocmd LspDiagnosticsChanged * redrawstatus
	" endif
augroup END

" vim: set ts=2 sw=2 tw=80 noet :


=========
Download .txt
gitextract_ap_uenq3/

├── .gitignore
├── Makefile
├── README.md
├── after/
│   └── ftplugin/
│       ├── go.vim
│       ├── help.vim
│       ├── json.vim
│       ├── man.vim
│       ├── markdown.vim
│       ├── qf.vim
│       └── vim.vim
├── autoload/
│   ├── actionmenu.vim
│   ├── badge.vim
│   └── preview.vim
├── coc-settings.json
├── config/
│   ├── filetype.vim
│   ├── general.vim
│   ├── init.vim
│   ├── local.plugins.yaml
│   ├── local.vim
│   ├── mappings.vim
│   ├── plugins/
│   │   ├── all.vim
│   │   ├── asyncomplete.vim
│   │   ├── coc.vim
│   │   ├── colorizer.lua
│   │   ├── dashboard.lua
│   │   ├── defx.vim
│   │   ├── denite.vim
│   │   ├── gina.vim
│   │   ├── goyo.vim
│   │   ├── iron.lua
│   │   ├── lsp.vim
│   │   └── whichkey.vim
│   ├── plugins.yaml
│   ├── statusline.vim
│   ├── tabline.vim
│   ├── terminal.vim
│   ├── theme.vim
│   └── vimrc
├── filetype.vim
├── init.vim
├── plugin/
│   ├── actionmenu.vim
│   ├── devhelp.vim
│   ├── difftools.vim
│   ├── filesystem.vim
│   ├── jumpfile.vim
│   ├── sessions.vim
│   ├── unixhelp.vim
│   └── whitespace.vim
├── snippets/
│   ├── .gitignore
│   ├── go.snip
│   ├── javascript.snip
│   └── python.snip
├── themes/
│   ├── hybrid.vim
│   ├── rafi-2015.vim
│   ├── rafi-2016.vim
│   └── rafi-2017.vim
├── venv.sh
└── vimrc
Condensed preview — 58 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (283K chars).
[
  {
    "path": ".gitignore",
    "chars": 90,
    "preview": "*~\n/benchmarks/\n/spell/\n/.vault.vim\n/.local.vimrc\n/.stignore\n/.stfolder\n/.stversions\n.vim\n"
  },
  {
    "path": "Makefile",
    "chars": 1191,
    "preview": "SHELL = /bin/bash\nvim := $(if $(shell which nvim),nvim,$(shell which vim))\nvim_version := '${shell $(vim) --version}'\nXD"
  },
  {
    "path": "README.md",
    "chars": 49897,
    "preview": "# Rafael Bodill's Neo/vim Config\n\nLean mean Neo/vim machine, 30-45ms startup time.\n\nBest with [Neovim] 0.5.x or [Vim] 8."
  },
  {
    "path": "after/ftplugin/go.vim",
    "chars": 339,
    "preview": "setlocal tabstop=4\n\n\" autocorrect wrong key word spell\niabbrev mian() main()\niabbrev fucn func\niabbrev Pirntln Println\ni"
  },
  {
    "path": "after/ftplugin/help.vim",
    "chars": 2197,
    "preview": "\" Snippets from vim-help\n\" Credits: https://github.com/dahu/vim-help\n\nlet s:save_cpo = &cpoptions\nset cpoptions&vim\n\nfun"
  },
  {
    "path": "after/ftplugin/json.vim",
    "chars": 27,
    "preview": "setlocal foldmethod=syntax\n"
  },
  {
    "path": "after/ftplugin/man.vim",
    "chars": 372,
    "preview": "\nlet s:save_cpo = &cpoptions\nset cpoptions&vim\n\nsilent! nunmap <buffer> q\nnnoremap <silent><buffer> q :<C-u>quit<CR>\n\nnn"
  },
  {
    "path": "after/ftplugin/markdown.vim",
    "chars": 19,
    "preview": "set conceallevel=0\n"
  },
  {
    "path": "after/ftplugin/qf.vim",
    "chars": 3772,
    "preview": "\" Extend romainl/vim-qf\n\" ---\n\" See Also: https://github.com/romainl/vim-qf\n\nlet s:save_cpo = &cpoptions\nset cpoptions&v"
  },
  {
    "path": "after/ftplugin/vim.vim",
    "chars": 576,
    "preview": "let s:save_cpo = &cpoptions\nset cpoptions&vim\n\nif exists('b:undo_ftplugin')\n\tlet b:undo_ftplugin .= ' | '\nelse\n\tlet b:un"
  },
  {
    "path": "autoload/actionmenu.vim",
    "chars": 4392,
    "preview": "\" actionmenu\n\" ---\n\" Context-aware menu at your cursor\n\" Forked from: https://github.com/kizza/actionmenu.nvim\n\n\" Menu i"
  },
  {
    "path": "autoload/badge.vim",
    "chars": 9868,
    "preview": "\" vim-badge - Bite-size badges for tab & status lines\n\" Maintainer: Rafael Bodill <justrafi at gmail dot com>\n\"---------"
  },
  {
    "path": "autoload/preview.vim",
    "chars": 1361,
    "preview": "\" Improved preview for lists\n\" ---\n\nfunction! preview#open(file, line, column) abort\n\t\" Create or close preview window\n\t"
  },
  {
    "path": "coc-settings.json",
    "chars": 980,
    "preview": "{\n  \"languageserver\": {\n    \"golang\": {\n      \"command\": \"gopls\",\n      \"rootPatterns\": [\"go.mod\", \".vim/\", \".git/\", \".h"
  },
  {
    "path": "config/filetype.vim",
    "chars": 4784,
    "preview": "\" File Types\n\" ---\n\naugroup user_plugin_filetype \" {{{\n\tautocmd!\n\n\t\" Reload vim configuration automatically on-save\n\taut"
  },
  {
    "path": "config/general.vim",
    "chars": 9073,
    "preview": "\" Neo/vim Settings\n\" ===\n\n\" General {{{\nset mouse=nv                 \" Disable mouse in command-line mode\nset modeline  "
  },
  {
    "path": "config/init.vim",
    "chars": 10338,
    "preview": "\" Configuration and plugin-manager manager :)\n\" ---\n\" Maintainer: Rafael Bodill\n\" See: github.com/rafi/vim-config\n\"\n\" Pl"
  },
  {
    "path": "config/local.plugins.yaml",
    "chars": 4474,
    "preview": "- repo: ntpeters/vim-better-whitespace\n  hook_add: |\n    let g:better_whitespace_filetypes_blacklist=['diff', 'git', 'gi"
  },
  {
    "path": "config/local.vim",
    "chars": 2014,
    "preview": "\" Update file. :update is equlivalent to :write, but it only saves the file if the buffer has been modified\nimap <Leader"
  },
  {
    "path": "config/mappings.vim",
    "chars": 10669,
    "preview": "\" Key-mappings\n\" ===\n\n\" Elite-mode {{{\n\" ----------\nif get(g:, 'elite_mode')\n\n\t\" Disable arrow movement, resize splits i"
  },
  {
    "path": "config/plugins/all.vim",
    "chars": 19831,
    "preview": "\" Plugin Keyboard-Mappings\n\" ---\n\nif dein#tap('denite.nvim')\n\tnnoremap <silent><LocalLeader>r :<C-u>Denite -resume -refr"
  },
  {
    "path": "config/plugins/asyncomplete.vim",
    "chars": 3020,
    "preview": "\" :h asyncomplete\n\" ---\n\" Problems? https://github.com/prabirshrestha/asyncomplete.vim/issues\n\n\" Debugging:\n\" let g:asyn"
  },
  {
    "path": "config/plugins/coc.vim",
    "chars": 6185,
    "preview": "\" May need for vim (not neovim) since coc.nvim calculate byte offset by count\n\" utf-8 byte sequence.\nset encoding=utf-8\n"
  },
  {
    "path": "config/plugins/colorizer.lua",
    "chars": 429,
    "preview": "-- nvim-colorizer\n-- ===\n-- See https://github.com/norcalli/nvim-colorizer.lua\n\nrequire 'colorizer'.setup {\n  css = { rg"
  },
  {
    "path": "config/plugins/dashboard.lua",
    "chars": 660,
    "preview": "require 'dashboard'.setup {\n  theme = 'hyper',\n  config = {\n    week_header = {\n      enable = true,\n    },\n    shortcut"
  },
  {
    "path": "config/plugins/defx.vim",
    "chars": 7576,
    "preview": "\" :h defx\n\" ---\n\" Problems? https://github.com/Shougo/defx.nvim/issues\n\ncall defx#custom#option('_', {\n\t\\ 'resume': 1,\n\t"
  },
  {
    "path": "config/plugins/denite.vim",
    "chars": 7503,
    "preview": "\" :h denite.txt\n\" ---\n\" Problems? https://github.com/Shougo/denite.nvim/issues\n\n\" Don't reload Denite twice (on vimrc re"
  },
  {
    "path": "config/plugins/gina.vim",
    "chars": 2034,
    "preview": "\" :h gina\n\" ---\n\" Problems? https://github.com/lambdalisue/gina.vim/issues\n\ncall gina#custom#command#alias('status', 'st"
  },
  {
    "path": "config/plugins/goyo.vim",
    "chars": 1042,
    "preview": "\n\" Goyo\n\" ----\n\n\" s:goyo_enter() \"{{{\n\" Disable visual candy in Goyo mode\nfunction! s:goyo_enter()\n\tif has('gui_running'"
  },
  {
    "path": "config/plugins/iron.lua",
    "chars": 98,
    "preview": "local iron = require('iron')\n\niron.core.set_config {\n  preferred = {\n    python = 'ipython'\n  }\n}\n"
  },
  {
    "path": "config/plugins/lsp.vim",
    "chars": 1697,
    "preview": "\" vim-lsp\n\" ---\n\n\" Apply settings for languages that registered LSP\nfunction! s:on_lsp_buffer_enabled() abort\n\tif empty("
  },
  {
    "path": "config/plugins/whichkey.vim",
    "chars": 1839,
    "preview": "\" which-key\n\" ---\n\naugroup user_events\n\tautocmd! FileType which_key\n\tautocmd  FileType which_key set laststatus=0 noshow"
  },
  {
    "path": "config/plugins.yaml",
    "chars": 23848,
    "preview": "---\n# PLUGINS\n# ===\n# See config/plugins/all.vim for plugin mappings and config/plugins/*.vim\n\n# Startup\n# -------\n- rep"
  },
  {
    "path": "config/statusline.vim",
    "chars": 3445,
    "preview": "\" Statusline\n\" ---\n\nlet s:stl  = \" %7*%{&paste ? '=' : ''}%*\"         \" Paste symbol\nlet s:stl .= \"%4*%{&readonly ? '' :"
  },
  {
    "path": "config/tabline.vim",
    "chars": 2506,
    "preview": "\" Tabline\n\" ---\n\n\" Configuration\n\nlet g:badge_numeric_charset =\n\t\\ get(g:, 'badge_numeric_charset',\n\t\\ ['⁰','¹','²','³',"
  },
  {
    "path": "config/terminal.vim",
    "chars": 3938,
    "preview": "\" Vim Only Terminal Tweaks: Colors, cursor shape, and tmux\n\" ---\n\n\" Paste\n\" Credits: https://github.com/Shougo/shougo-s-"
  },
  {
    "path": "config/theme.vim",
    "chars": 1297,
    "preview": "\" Theme\n\" ---\n\"\n\" Autoloads theme according to user selected colorschemes\n\nfunction! s:theme_init()\n\t\" Load cached color"
  },
  {
    "path": "config/vimrc",
    "chars": 2456,
    "preview": "\" https://github.com/rafi/vim-config\n\" Created By: Rafael Bodill\n\n\" Runtime and Plugins\n\" ===\n\nif &compatible\n\t\" vint: -"
  },
  {
    "path": "filetype.vim",
    "chars": 1686,
    "preview": "\" File-type Detection\n\" ===\n\nif exists('did_load_filetypes')\n\tfinish\nendif\n\naugroup filetypedetect \"{{{\n\n\tautocmd BufNew"
  },
  {
    "path": "init.vim",
    "chars": 70,
    "preview": "execute 'source' fnamemodify(expand('<sfile>'), ':h').'/config/vimrc'\n"
  },
  {
    "path": "plugin/actionmenu.vim",
    "chars": 2170,
    "preview": "\" actionmenu\n\" ---\n\" Context-aware menu at your cursor\n\" Forked from: https://github.com/kizza/actionmenu.nvim\n\nif exist"
  },
  {
    "path": "plugin/devhelp.vim",
    "chars": 1018,
    "preview": "\" Open Dash or Zeal on words under cursor\n\" ---\n\"\n\" Behaviors:\n\" - Map `gK` for selected filetypes\n\nif exists('g:loaded_"
  },
  {
    "path": "plugin/difftools.vim",
    "chars": 1290,
    "preview": "\" Diff Unsaved Changes\n\" ---\n\"\n\" Commands:\n\" - DiffOrig: Show diff of unsaved changes\n\nif exists('g:loaded_difftools')\n\t"
  },
  {
    "path": "plugin/filesystem.vim",
    "chars": 1124,
    "preview": "\" Helpers for dealing with the filesystem\n\" ---\n\"\n\" Behaviors:\n\" - Before writing file ensure directories exist\n\"\n\" Comm"
  },
  {
    "path": "plugin/jumpfile.vim",
    "chars": 853,
    "preview": "\" Jump entire buffers from jumplist\n\" ---\n\"\n\" Commands:\n\" - JumpBuffer: Finds next (1) or previous (-1) file in jumplist"
  },
  {
    "path": "plugin/sessions.vim",
    "chars": 3347,
    "preview": "\" Session Management\n\" ---\n\"\n\" Behaviors:\n\" - Save active session when quitting vim completely\n\"\n\" Commands:\n\" - Session"
  },
  {
    "path": "plugin/unixhelp.vim",
    "chars": 1890,
    "preview": "\" Unix Help\n\" ---\n\" Open man pages for gitconfig, tmux, and sh files\n\"\n\" Behaviors:\n\" - If one of the supported filetype"
  },
  {
    "path": "plugin/whitespace.vim",
    "chars": 2929,
    "preview": "\" Whitespace utilities\n\" ---\n\"\n\" Behaviors:\n\" - Display special highlight for trailing whitespace and space preceding ta"
  },
  {
    "path": "snippets/.gitignore",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "snippets/go.snip",
    "chars": 95,
    "preview": "snippet     todo\nabbr        # todo comment\n    // TODO: <`strftime(\"%Y-%m-%d\")` `$USER`> ${0}\n"
  },
  {
    "path": "snippets/javascript.snip",
    "chars": 1380,
    "preview": "snippet cs\n\tvar cx = React.addons.classSet;\nsnippet cdm\n\tcomponentDidMount: function() {\n\t\t${1}\n\t},\nsnippet cdup\n\tcompon"
  },
  {
    "path": "snippets/python.snip",
    "chars": 521,
    "preview": "snippet     ip\nabbr        import ipdb\n    import ipdb; ipdb.set_trace()\n\nsnippet     pp\nabbr        import pprint..\n   "
  },
  {
    "path": "themes/hybrid.vim",
    "chars": 7745,
    "preview": "\n\" hybrid custom\n\" ===\n\n\" gVim Appearance {{{\n\" ---\nif has('gui_running')\n\tset guifont=PragmataPro:h16\n\tset guioptions=M"
  },
  {
    "path": "themes/rafi-2015.vim",
    "chars": 8296,
    "preview": "\n\" rafi-2015 - hybrid custom\n\" =========================\n\n\" gVim Appearance {{{\n\" --------------------------------------"
  },
  {
    "path": "themes/rafi-2016.vim",
    "chars": 10418,
    "preview": "\n\" rafi-2016 - hybrid custom\n\" =========================\n\n\" gVim Appearance {{{\n\" --------------------------------------"
  },
  {
    "path": "themes/rafi-2017.vim",
    "chars": 10564,
    "preview": "\n\" rafi-2017 - hybrid custom\n\" =========================\n\n\" gVim Appearance {{{\n\" --------------------------------------"
  },
  {
    "path": "venv.sh",
    "chars": 1726,
    "preview": "#!/usr/bin/env bash\n\n_try_pyenv() {\n\tlocal name='' src=''\n\tif hash pyenv 2>/dev/null; then\n\t\techo '===> pyenv found, sea"
  },
  {
    "path": "vimrc",
    "chars": 137,
    "preview": "\" Note: Skip initialization for vim-tiny or vim-small.\nif 1\n\texecute 'source' fnamemodify(expand('<sfile>'), ':h').'/con"
  }
]

About this extraction

This page contains the full source code of the PegasusWang/vim-config GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 58 files (256.9 KB), approximately 89.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!