literate-dotfiles/docs/vim.html

2063 lines
175 KiB
HTML
Raw Permalink Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2021-10-25 14:37:10 +02:00
<!-- 2021-10-25 lun. 14:33 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Vim Config</title>
<meta name="author" content="Dehaeze Thomas" />
2021-04-25 19:10:57 +02:00
<meta name="generator" content="Org Mode" />
2021-01-01 20:12:34 +01:00
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
2020-01-11 22:04:45 +01:00
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
2021-10-25 14:37:10 +02:00
</div><div id="content" class="content">
2020-01-11 22:04:45 +01:00
<h1 class="title">Vim Config</h1>
2021-10-25 14:37:10 +02:00
<div id="table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<h2>Table of Contents</h2>
2021-10-25 14:37:10 +02:00
<div id="text-table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<ul>
2021-01-01 20:12:34 +01:00
<li><a href="#orge318481">Plugins Install</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-01-01 20:12:34 +01:00
<li><a href="#org176e34b">Plug start</a></li>
<li><a href="#orge8cf965">Manage Files</a></li>
<li><a href="#org1b80e1a">Text Objects</a></li>
<li><a href="#orgafb2091">Git</a></li>
<li><a href="#org9384e18">Motions, Search</a></li>
<li><a href="#org9d1d345">Manipulate Things</a></li>
<li><a href="#org7909d56">Utils</a></li>
<li><a href="#org275a5cb">Visual</a></li>
<li><a href="#org31a2233">Themes</a></li>
<li><a href="#org0630ae1">Language Server Protocol</a></li>
<li><a href="#org9fe57f5">Snippnets and autocompletion</a></li>
<li><a href="#orgbae3ff7">Syntax Checking and Build Utils</a></li>
<li><a href="#org1233214">Auto Completion</a></li>
<li><a href="#org05222b1">Tmux</a></li>
<li><a href="#orgfc62c14">Syntax</a></li>
<li><a href="#org4fbd147">Markdown</a></li>
2021-10-25 14:37:10 +02:00
<li><a href="#org18ac8fe">LaTeX</a></li>
<li><a href="#orgea260b6">Matlab</a></li>
2021-01-01 20:12:34 +01:00
<li><a href="#orgcceec60">Org Mode</a></li>
<li><a href="#org251d57e">Plug End</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2021-01-01 20:12:34 +01:00
<li><a href="#org5b58742">Basic</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-01-01 20:12:34 +01:00
<li><a href="#org21a93d9">General</a></li>
<li><a href="#org771a887">VIM user interface</a></li>
<li><a href="#orgabcd6c3">Foldings</a></li>
<li><a href="#org2af60ad">Colors and Fonts</a></li>
<li><a href="#org71df0a9">Files, backups and undo</a></li>
<li><a href="#org2acb57b">Text, tab and indent related</a></li>
<li><a href="#org5f5a79f">Moving around, tabs, windows and buffers</a></li>
<li><a href="#org6996288">Misc</a></li>
<li><a href="#org04ec469">Helper functions</a></li>
<li><a href="#org118cbb0">GUI related</a></li>
<li><a href="#org80248f8">Turn persistent undo on</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2021-01-01 20:12:34 +01:00
<li><a href="#org83825da">Mappings</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-01-01 20:12:34 +01:00
<li><a href="#org3b0e457">Normal mode related</a></li>
<li><a href="#org7e9c367">Insert mode related</a></li>
<li><a href="#org5e60816">Visual mode related</a></li>
<li><a href="#org4c2cded">Add some delimiters</a></li>
<li><a href="#orgb5c42ba">Command mode related</a></li>
<li><a href="#org5148f61">Terminal mode related</a></li>
<li><a href="#orgc99aa3c">Correct misspelled works</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2021-01-01 20:12:34 +01:00
<li><a href="#orgbf12520">Filetypes</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-10-25 14:37:10 +02:00
<li><a href="#org135a723">Vim Which Key</a></li>
2021-01-01 20:12:34 +01:00
<li><a href="#org849b459">Mails</a></li>
<li><a href="#org42e1db0">MarkDown</a></li>
2021-10-25 14:37:10 +02:00
<li><a href="#orgc5ce266">LaTeX</a></li>
2021-01-01 20:12:34 +01:00
<li><a href="#org4bc3f4d">Arduino</a></li>
<li><a href="#org9ce420d">Python</a></li>
2021-10-25 14:37:10 +02:00
<li><a href="#org975017c">Matlab</a></li>
<li><a href="#orgf9610f4">Save Which Key Configuration</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2021-01-01 20:12:34 +01:00
<li><a href="#org5ea2f36">Plugins Config</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-10-25 14:37:10 +02:00
<li><a href="#org2436daa"><code>junegunn/fzf</code></a></li>
<li><a href="#org633de78"><code>autozimu/LanguageClient-neovim</code></a></li>
<li><a href="#org530c33b"><code>JamshedVesuna/vim-markdown-preview</code></a></li>
<li><a href="#orgf435b47"><code>mhinz/vim-signify</code></a></li>
<li><a href="#org96e8776"><code>Deoplete</code></a></li>
<li><a href="#orgacfd5d8"><code>SirVer/ultisnips</code></a></li>
<li><a href="#org792637b"><code>honza/vim-snippets</code></a></li>
<li><a href="#org8bc27ac"><code>itchyny/lightline.vim</code></a></li>
<li><a href="#orgeeb846d"><code>Autopairs</code></a></li>
<li><a href="#orgec97ba8"><code>Yggdroot/indentLine</code></a></li>
<li><a href="#orgb950c54"><code>ryanoasis/vim-devicons</code></a></li>
<li><a href="#org58545fe"><code>junegunn/goyo.vim</code></a></li>
<li><a href="#orgc2ae68e"><code>tpope/vim-surround</code></a></li>
<li><a href="#org48c6403"><code>Vim-Markdown</code></a></li>
<li><a href="#org6e96121"><code>Neomake</code></a></li>
<li><a href="#org52ec1d5"><code>lervag/vimtex</code></a></li>
<li><a href="#org9b37457"><code>jpalardy/vim-slime</code></a></li>
<li><a href="#orga920649"><code>mhinz/vim-grepper</code></a></li>
2021-01-01 20:12:34 +01:00
<li><a href="#orgc009d1c">Editor config</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2021-01-01 20:12:34 +01:00
<li><a href="#org492ddcb">Bindings</a>
2020-01-11 22:04:45 +01:00
<ul>
2021-10-25 14:37:10 +02:00
<li><a href="#org804ac1a">Vim Which Key</a></li>
2021-01-01 20:12:34 +01:00
<li><a href="#org0df6a36">Direct ones</a></li>
<li><a href="#orgdfeb9c4">Quit</a></li>
<li><a href="#org8bb23f5">Files</a></li>
<li><a href="#orgec14959">Buffers</a></li>
<li><a href="#orgcbd0c97">Tabs</a></li>
<li><a href="#orge0a4b95">Terminals</a></li>
<li><a href="#org3006f94">Splits / Windows</a></li>
<li><a href="#org96f7ecd">Check Spell</a></li>
<li><a href="#org830b5fd">Make</a></li>
<li><a href="#org67f74eb">Search</a></li>
<li><a href="#org3ca1a3b">GIT</a></li>
<li><a href="#orgca221b1">Errors</a></li>
<li><a href="#orge197646">Text</a></li>
<li><a href="#orgb596c67">Config</a></li>
<li><a href="#orgeb5450c">Insert</a></li>
2021-10-25 14:37:10 +02:00
<li><a href="#orgf40e93e">Save Which Key Configuration</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
</ul>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orge318481" class="outline-2">
<h2 id="orge318481">Plugins Install</h2>
<div class="outline-text-2" id="text-orge318481">
2020-01-11 22:04:45 +01:00
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org176e34b" class="outline-3">
<h3 id="org176e34b">Plug start</h3>
<div class="outline-text-3" id="text-org176e34b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">call</span> plug#<span class="org-function-name">begin</span>(<span class="org-string">'~/.vim/plugged'</span>)
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orge8cf965" class="outline-3">
<h3 id="orge8cf965">Manage Files</h3>
<div class="outline-text-3" id="text-orge8cf965">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'tpope/vim-vinegar'</span> <span class="org-comment">" Combine with netrw to create a delicious salad dressing</span>
Plug <span class="org-string">'junegunn/fzf'</span>, { <span class="org-string">'dir'</span>: <span class="org-string">'~/.fzf'</span>, <span class="org-string">'do'</span>: <span class="org-string">'./install --bin'</span> } <span class="org-comment">" A command-line fuzzy finder written in Go</span>
Plug <span class="org-string">'junegunn/fzf.vim'</span> <span class="org-comment">" Fzf for vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org1b80e1a" class="outline-3">
<h3 id="org1b80e1a">Text Objects</h3>
<div class="outline-text-3" id="text-org1b80e1a">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'kana/vim-textobj-user'</span> <span class="org-comment">" Create your own text objects</span>
Plug <span class="org-string">'kana/vim-textobj-line'</span> <span class="org-comment">" Text objects for the current line</span>
Plug <span class="org-string">'kana/vim-textobj-entire'</span> <span class="org-comment">" Text objects for entire buffer</span>
Plug <span class="org-string">'michaeljsmith/vim-indent-object'</span> <span class="org-comment">" Defines a new text object representing lines of code at the same indent level</span>
Plug <span class="org-string">'jiangmiao/auto-pairs'</span> <span class="org-comment">" Vim plugin, insert or delete brackets, parens, quotes in pair</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgafb2091" class="outline-3">
<h3 id="orgafb2091">Git</h3>
<div class="outline-text-3" id="text-orgafb2091">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'jreybert/vimagit'</span>
Plug <span class="org-string">'tpope/vim-fugitive'</span> <span class="org-comment">" A Git wrapper so awesome, it should be illegal</span>
Plug <span class="org-string">'junegunn/gv.vim'</span> <span class="org-comment">" A git commit browser</span>
Plug <span class="org-string">'mhinz/vim-signify'</span> <span class="org-comment">" Show a diff using Vim its sign column</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org9384e18" class="outline-3">
<h3 id="org9384e18">Motions, Search</h3>
<div class="outline-text-3" id="text-org9384e18">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'terryma/vim-expand-region'</span> <span class="org-comment">" Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination</span>
Plug <span class="org-string">'justinmk/vim-sneak'</span> <span class="org-comment">" The missing motion for Vim</span>
Plug <span class="org-string">'haya14busa/is.vim'</span> <span class="org-comment">" Improved incremental searching for Vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org9d1d345" class="outline-3">
<h3 id="org9d1d345">Manipulate Things</h3>
<div class="outline-text-3" id="text-org9d1d345">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'tpope/vim-surround'</span> <span class="org-comment">" Quoting/parenthesizing made simple</span>
Plug <span class="org-string">'tpope/vim-commentary'</span> <span class="org-comment">" Comment stuff out</span>
Plug <span class="org-string">'junegunn/vim-easy-align'</span> <span class="org-comment">" A Vim alignment plugin</span>
Plug <span class="org-string">'Olical/vim-enmasse'</span> <span class="org-comment">" Edit every line in a quickfix list at the same time</span>
Plug <span class="org-string">'mhinz/vim-grepper'</span>, { <span class="org-string">'on'</span>: [<span class="org-string">'Grepper'</span>, <span class="org-string">'&lt;plug&gt;(GrepperOperator)'</span>] } <span class="org-comment">"</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org7909d56" class="outline-3">
<h3 id="org7909d56">Utils</h3>
<div class="outline-text-3" id="text-org7909d56">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'tpope/vim-repeat'</span> <span class="org-comment">" Enable repeating supported plugin maps with '.'</span>
Plug <span class="org-string">'tpope/vim-obsession'</span> <span class="org-comment">" Continuously updated session files</span>
Plug <span class="org-string">'tpope/vim-eunuch'</span> <span class="org-comment">" eunuch.vim: helpers for UNIX</span>
Plug <span class="org-string">'kana/vim-operator-user'</span> <span class="org-comment">" Define your own operator easily</span>
Plug <span class="org-string">'majutsushi/tagbar'</span> <span class="org-comment">" Vim plugin that displays tags in a window, ordered by scope</span>
Plug <span class="org-string">'tpope/vim-speeddating'</span> <span class="org-comment">" use CTRL-A/CTRL-X to increment dates, times, and more</span>
Plug <span class="org-string">'liuchengxu/vim-which-key'</span> <span class="org-comment">" Vim plugin that shows keybindings in popup</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org275a5cb" class="outline-3">
<h3 id="org275a5cb">Visual</h3>
<div class="outline-text-3" id="text-org275a5cb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'itchyny/lightline.vim'</span> <span class="org-comment">" A light and configurable statusline/tabline for Vim</span>
Plug <span class="org-string">'Yggdroot/indentLine'</span> <span class="org-comment">" A vim plugin to display the indention levels with thin vertical lines</span>
Plug <span class="org-string">'ryanoasis/vim-devicons'</span> <span class="org-comment">" Adds file type glyphs/icons to many popular Vim plugins such as: NERDTree, vim-airline, unite, vim-startify and many more</span>
Plug <span class="org-string">'mhinz/vim-startify'</span> <span class="org-comment">" The fancy start screen for Vim</span>
Plug <span class="org-string">'junegunn/goyo.vim'</span> <span class="org-comment">" Distraction-free writing in Vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org31a2233" class="outline-3">
<h3 id="org31a2233">Themes</h3>
<div class="outline-text-3" id="text-org31a2233">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'morhetz/gruvbox'</span> <span class="org-comment">" Retro groove color scheme for Vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
2021-01-01 20:12:34 +01:00
<p>
Other nice themes are <a href="https://github.com/mhartington/oceanic-next">oceanic-next</a> and <a href="https://github.com/jacoborus/tender.vim">tender</a>.
</p>
2020-01-11 22:04:45 +01:00
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org0630ae1" class="outline-3">
<h3 id="org0630ae1">Language Server Protocol</h3>
<div class="outline-text-3" id="text-org0630ae1">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'autozimu/LanguageClient-neovim'</span>, {
\ <span class="org-string">'branch'</span>: <span class="org-string">'next'</span>,
\ <span class="org-string">'do'</span>: <span class="org-string">'bash install.sh'</span>,
\ }
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org9fe57f5" class="outline-3">
<h3 id="org9fe57f5">Snippnets and autocompletion</h3>
<div class="outline-text-3" id="text-org9fe57f5">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'SirVer/ultisnips'</span> <span class="org-comment">" The ultimate snippet solution for Vim</span>
Plug <span class="org-string">'honza/vim-snippets'</span> <span class="org-comment">" Vim-snipmate default snippets</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgbae3ff7" class="outline-3">
<h3 id="orgbae3ff7">Syntax Checking and Build Utils</h3>
<div class="outline-text-3" id="text-orgbae3ff7">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'neomake/neomake'</span> <span class="org-comment">" Asynchronous linting and make framework for Neovim/Vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org1233214" class="outline-3">
<h3 id="org1233214">Auto Completion</h3>
<div class="outline-text-3" id="text-org1233214">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">if</span> <span class="org-function-name">has</span>(<span class="org-string">'nvim'</span>)
Plug <span class="org-string">'Shougo/deoplete.nvim'</span>, { <span class="org-string">'do'</span>: <span class="org-string">':UpdateRemotePlugins'</span> }
Plug <span class="org-string">'Nelyah/deoplete-mu'</span>
<span class="org-vimrc-command">else</span>
Plug <span class="org-string">'Shougo/deoplete.nvim'</span>
Plug <span class="org-string">'roxma/nvim-yarp'</span>
Plug <span class="org-string">'roxma/vim-hug-neovim-rpc'</span>
Plug <span class="org-string">'Nelyah/deoplete-mu'</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org05222b1" class="outline-3">
<h3 id="org05222b1">Tmux</h3>
<div class="outline-text-3" id="text-org05222b1">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'christoomey/vim-tmux-navigator'</span> <span class="org-comment">" Seamless navigation between tmux panes and vim splits</span>
Plug <span class="org-string">'jpalardy/vim-slime'</span> <span class="org-comment">" Used to type text into a REPL</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgfc62c14" class="outline-3">
<h3 id="orgfc62c14">Syntax</h3>
<div class="outline-text-3" id="text-orgfc62c14">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'sheerun/vim-polyglot'</span> <span class="org-comment">" A solid language pack for Vim</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org4fbd147" class="outline-3">
<h3 id="org4fbd147">Markdown</h3>
<div class="outline-text-3" id="text-org4fbd147">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'plasticboy/vim-markdown'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'markdown'</span> } <span class="org-comment">" Markdown Vim Mode</span>
Plug <span class="org-string">'mzlogin/vim-markdown-toc'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'markdown'</span> } <span class="org-comment">" A vim plugin to generate table of contents for Markdown files</span>
Plug <span class="org-string">'JamshedVesuna/vim-markdown-preview'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'markdown'</span> } <span class="org-comment">" A light Vim plugin for previewing markdown files in a browser</span>
Plug <span class="org-string">'nelstrom/vim-markdown-folding'</span> <span class="org-comment">" Fold markdown documents by section</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org18ac8fe" class="outline-3">
<h3 id="org18ac8fe">LaTeX</h3>
<div class="outline-text-3" id="text-org18ac8fe">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'lervag/vimtex'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'tex'</span> } <span class="org-comment">" A modern vim plugin for editing LaTeX files.</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgea260b6" class="outline-3">
<h3 id="orgea260b6">Matlab</h3>
<div class="outline-text-3" id="text-orgea260b6">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'tdehaeze/matlab-vim'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'matlab'</span> } <span class="org-comment">" Edit Matlab M-files in Vim editor</span>
Plug <span class="org-string">'djoshea/vim-matlab-fold'</span>, { <span class="org-string">'for'</span>: <span class="org-string">'matlab'</span> } <span class="org-comment">" Vim code folding for Matlab files</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgcceec60" class="outline-3">
<h3 id="orgcceec60">Org Mode</h3>
<div class="outline-text-3" id="text-orgcceec60">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc">Plug <span class="org-string">'jceb/vim-orgmode'</span> <span class="org-comment">" Text outlining and task management for Vim</span>
Plug <span class="org-string">'vim-scripts/SyntaxRange'</span> <span class="org-comment">" Define a different filetype syntax on regions of a buffer</span>
Plug <span class="org-string">'chrisbra/NrrwRgn'</span> <span class="org-comment">" A Narrow Region Plugin for vim</span>
Plug <span class="org-string">'mattn/calendar-vim'</span> <span class="org-comment">" calendar vimscript</span>
Plug <span class="org-string">'vim-scripts/utl.vim'</span> <span class="org-comment">" Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org251d57e" class="outline-3">
<h3 id="org251d57e">Plug End</h3>
<div class="outline-text-3" id="text-org251d57e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">call</span> plug#<span class="org-function-name">end</span>()
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org5b58742" class="outline-2">
<h2 id="org5b58742">Basic</h2>
<div class="outline-text-2" id="text-org5b58742">
2020-01-11 22:04:45 +01:00
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org21a93d9" class="outline-3">
<h3 id="org21a93d9">General</h3>
<div class="outline-text-3" id="text-org21a93d9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">set</span> <span class="org-vimrc-option">runtimepath</span><span class="org-constant">+=</span>~/<span class="org-constant">.</span><span class="org-vimrc-command">vim</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Sets how many lines of history VIM has to remember</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">history</span><span class="org-constant">=</span><span class="org-vimrc-number">500</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Enable filetype plugins</span>
<span class="org-vimrc-option">filetype</span> plugin <span class="org-vimrc-command">on</span>
<span class="org-vimrc-option">filetype</span> indent <span class="org-vimrc-command">on</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Set to auto read when a file is changed from the outside</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">autoread</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" writes the content of the file automatically if you call :make</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">autowrite</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Share clipboard with system</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">clipboard</span><span class="org-constant">+=</span>unnamedplus
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Define Leader Key as Space key</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">mapleader</span> <span class="org-constant">=</span> <span class="org-comment">"\&lt;Space&gt;"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:mapleader</span> <span class="org-constant">=</span> <span class="org-comment">"\&lt;Space&gt;"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">maplocalleader</span> <span class="org-constant">=</span> <span class="org-comment">","</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org771a887" class="outline-3">
<h3 id="org771a887">VIM user interface</h3>
<div class="outline-text-3" id="text-org771a887">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Set 7 lines to the cursor - when moving vertically using j/k</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">so</span><span class="org-constant">=</span><span class="org-vimrc-number">7</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Avoid garbled characters in Chinese language windows OS</span>
<span class="org-vimrc-command">let</span> $LANG<span class="org-constant">=</span><span class="org-string">'en'</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">langmenu</span><span class="org-constant">=</span><span class="org-vimrc-command">en</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Set Timeout config</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">timeout</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ttimeout</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">timeoutlen</span><span class="org-constant">=</span><span class="org-vimrc-number">500</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ttimeoutlen</span><span class="org-constant">=</span><span class="org-vimrc-number">50</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Turn on the wild menu</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wildmenu</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Ignore compiled files</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wildignore</span><span class="org-constant">=</span>*<span class="org-constant">.</span><span class="org-vimrc-command">o</span>,*~,*<span class="org-constant">.</span>pyc
<span class="org-vimrc-command">if</span> <span class="org-function-name">has</span>(<span class="org-comment">"win16") || has("win32")</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wildignore</span><span class="org-constant">+=.</span>git\*,<span class="org-constant">.</span>hg\*,<span class="org-constant">.</span>svn\*
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wildignore</span><span class="org-constant">+=</span>*/<span class="org-constant">.</span>git/*,*/<span class="org-constant">.</span>hg/*,*/<span class="org-constant">.</span>svn/*,*/<span class="org-constant">.</span>DS_Store
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wildmode</span><span class="org-constant">=</span>full
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">"Always show current position</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ruler</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Height of the command bar</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">cmdheight</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" A buffer becomes hidden when it is abandoned</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">hid</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Configure backspace so it acts as it should act</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">backspace</span><span class="org-constant">=</span><span class="org-vimrc-option">eol</span>,start,indent
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">whichwrap</span><span class="org-constant">+=&lt;</span>,<span class="org-constant">&gt;</span>,h,<span class="org-vimrc-command">l</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Ignore case when searching</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ignorecase</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" When searching try to be smart about cases</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">smartcase</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Option for smarter completions that will be case aware</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">infercase</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Highlight search results</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">hlsearch</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Makes search act like search in modern browsers</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">incsearch</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Don't redraw while executing macros (good performance config)</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">lazyredraw</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" For regular expressions turn magic on</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">magic</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Show matching brackets when text indicator is over them</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">showmatch</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Don't show tab line if there is only one tab</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">showtabline</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" How tany tenths of a second to blink when matching brackets</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">mat</span><span class="org-constant">=</span><span class="org-vimrc-number">2</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" No annoying sound on errors</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">noerrorbells</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">novisualbell</span>
<span class="org-vimrc-command">set</span> t_vb<span class="org-constant">=</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">tm</span><span class="org-constant">=</span><span class="org-vimrc-number">500</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Add a bit extra margin to the left</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">foldcolumn</span><span class="org-constant">=</span><span class="org-vimrc-number">0</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Improve VIM scrolling</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ttyfast</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Relative Numbers</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">relativenumber</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Smarter J and K navigation</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>expr<span class="org-constant">&gt;</span> <span class="org-vimrc-command">j</span> <span class="org-variable-name">v:count</span> ? (<span class="org-variable-name">v:count</span> <span class="org-constant">&gt;</span> <span class="org-highlight-numbers-number">5</span> ? <span class="org-comment">"m'" . v:count : '') . 'j' : 'gj'</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>expr<span class="org-constant">&gt;</span> <span class="org-vimrc-command">k</span> <span class="org-variable-name">v:count</span> ? (<span class="org-variable-name">v:count</span> <span class="org-constant">&gt;</span> <span class="org-highlight-numbers-number">5</span> ? <span class="org-comment">"m'" . v:count : '') . 'k' : 'gk'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">splitbelow</span> splitright
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgabcd6c3" class="outline-3">
<h3 id="orgabcd6c3">Foldings</h3>
<div class="outline-text-3" id="text-orgabcd6c3">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">if</span> <span class="org-function-name">has</span>(<span class="org-string">'folding'</span>)
<span class="org-vimrc-command">if</span> <span class="org-function-name">has</span>(<span class="org-string">'windows'</span>)
<span class="org-vimrc-command">let</span> &amp;<span class="org-vimrc-option">fillchars</span><span class="org-constant">=</span><span class="org-string">'vert: '</span> <span class="org-comment">" less cluttered vertical window separators</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">foldmethod</span><span class="org-constant">=</span>indent <span class="org-comment">" not as cool as syntax, but faster</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">foldlevelstart</span><span class="org-constant">=</span><span class="org-vimrc-number">99</span> <span class="org-comment">" start unfolded</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org2af60ad" class="outline-3">
<h3 id="org2af60ad">Colors and Fonts</h3>
<div class="outline-text-3" id="text-org2af60ad">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-vimrc">syntax enable
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">background</span><span class="org-constant">=</span>dark
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">base16colorspace</span><span class="org-constant">=</span><span class="org-vimrc-number">256</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:gruvbox_contrast_dark</span> <span class="org-constant">=</span> <span class="org-string">'soft'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">try</span>
<span class="org-vimrc-command">colorscheme</span> gruvbox
<span class="org-vimrc-command">catch</span>
<span class="org-vimrc-command">endtry</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" set cursor shapes for insert and replace modes</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guicursor</span><span class="org-constant">=</span><span class="org-vimrc-command">n</span><span class="org-constant">-</span>v<span class="org-constant">-</span><span class="org-vimrc-command">c</span><span class="org-constant">-</span><span class="org-vimrc-option">sm</span>:block,i<span class="org-constant">-</span><span class="org-vimrc-option">ci</span><span class="org-constant">-</span><span class="org-vimrc-option">ve</span>:ver25,<span class="org-vimrc-command">r</span><span class="org-constant">-</span>cr<span class="org-constant">-</span><span class="org-vimrc-command">o</span>:hor20
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Set utf8 as standard encoding</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">encoding</span><span class="org-constant">=</span>utf<span class="org-vimrc-number">-8</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">fileencoding</span><span class="org-constant">=</span>utf<span class="org-vimrc-number">-8</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Use Unix as the standard file type</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">ffs</span><span class="org-constant">=</span>unix,dos,mac
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Do not highlight the cursor line : http://vim.wikia.com/wiki/Highlight_current_line</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">nocursorline</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">nocursorcolumn</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Always show the status line</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">laststatus</span><span class="org-constant">=</span><span class="org-vimrc-number">2</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Underline for bad spelled words</span>
<span class="org-vimrc-option">hi</span> clear SpellBad
<span class="org-vimrc-option">hi</span> SpellBad cterm<span class="org-constant">=</span>underline
<span class="org-comment">" Set style for gVim</span>
<span class="org-vimrc-option">hi</span> SpellBad gui<span class="org-constant">=</span>undercurl
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org71df0a9" class="outline-3">
<h3 id="org71df0a9">Files, backups and undo</h3>
<div class="outline-text-3" id="text-org71df0a9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Turn backup off, since most stuff is in SVN, git et.c anyway...</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">nobackup</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">nowb</span>
<span class="org-vimrc-command">set</span> noswapfile
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org2acb57b" class="outline-3">
<h3 id="org2acb57b">Text, tab and indent related</h3>
<div class="outline-text-3" id="text-org2acb57b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Use spaces instead of tabs</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">expandtab</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Be smart when using tabs</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">smarttab</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" 1 tab == 4 spaces</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">shiftwidth</span><span class="org-constant">=</span><span class="org-vimrc-number">4</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">tabstop</span><span class="org-constant">=</span><span class="org-vimrc-number">4</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Enable Line Number</span>
<span class="org-vimrc-command">set</span> number
</pre>
</div>
<p>
From <a href="https://stackoverflow.com/questions/36950231/auto-wrap-lines-in-vim-without-inserting-newlines">https://stackoverflow.com/questions/36950231/auto-wrap-lines-in-vim-without-inserting-newlines</a>.
</p>
<div class="org-src-container">
<pre class="src src-vimrc"><span class="org-comment">" Word wrap without line breaks</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">textwidth</span><span class="org-constant">=</span><span class="org-vimrc-number">0</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wrapmargin</span><span class="org-constant">=</span><span class="org-vimrc-number">0</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">wrap</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">linebreak</span>
<span class="org-comment">" set columns=160</span>
</pre>
</div>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<div class="org-src-container">
<pre class="src src-vimrc"><span class="org-vimrc-command">set</span> <span class="org-vimrc-option">autoindent</span> <span class="org-comment">" Auto Indentation</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">nosmartindent</span> <span class="org-comment">" No Smart Indentation</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org5f5a79f" class="outline-3">
<h3 id="org5f5a79f">Moving around, tabs, windows and buffers</h3>
<div class="outline-text-3" id="text-org5f5a79f">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Specify the behavior when switching between buffers</span>
<span class="org-vimrc-command">try</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">switchbuf</span><span class="org-constant">=</span>useopen,usetab
<span class="org-vimrc-command">catch</span>
<span class="org-vimrc-command">endtry</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Return to last edit position when opening files (You want this!)</span>
<span class="org-vimrc-command">au</span> BufReadPost * <span class="org-vimrc-command">if</span> <span class="org-function-name">line</span>(<span class="org-comment">"'\"") &gt; 1 &amp;&amp; line("'\"") &lt;= line("$") | exe "normal! g'\"" | endif</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">splitbelow</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">splitright</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" This enables mouse in all modes</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">mouse</span><span class="org-constant">=</span>a
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Automatically equalize splits when Vim is resized</span>
<span class="org-vimrc-command">autocmd</span> VimResized * <span class="org-vimrc-command">wincmd</span> <span class="org-constant">=</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org6996288" class="outline-3">
<h3 id="org6996288">Misc</h3>
<div class="outline-text-3" id="text-org6996288">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Speed up cursor movments : http://superuser.com/a/625994/587300</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">regexpengine</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span> <span class="org-comment">" https://github.com/xolox/vim-easytags/issues/88</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Set the maximum column for syntax highlighting</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">synmaxcol</span><span class="org-constant">=</span><span class="org-vimrc-number">250</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org04ec469" class="outline-3">
<h3 id="org04ec469">Helper functions</h3>
<div class="outline-text-3" id="text-org04ec469">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">CmdLine</span>(str)
<span class="org-vimrc-command">exe</span> <span class="org-comment">"menu Foo.Bar :" . a:str</span>
<span class="org-vimrc-command">emenu</span> Foo<span class="org-constant">.</span>Bar
unmenu Foo
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">VisualSelection</span>(direction, extra_filter) range
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:saved_reg</span> <span class="org-constant">=</span> @<span class="org-comment">"</span>
<span class="org-vimrc-command">execute</span> <span class="org-comment">"normal! vgvy"</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:pattern</span> <span class="org-constant">=</span> <span class="org-function-name">escape</span>(@<span class="org-comment">", '\\/.*$^~[]')</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:pattern</span> <span class="org-constant">=</span> <span class="org-function-name">substitute</span>(<span class="org-variable-name">l:pattern</span>, <span class="org-comment">"\n$", "", "")</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">if</span> <span class="org-variable-name">a:direction</span> <span class="org-constant">==</span> <span class="org-string">'gv'</span>
<span class="org-vimrc-command">call</span> <span class="org-function-name">CmdLine</span>(<span class="org-comment">"Ag \"" . l:pattern . "\" " )</span>
<span class="org-vimrc-command">elseif</span> <span class="org-variable-name">a:direction</span> <span class="org-constant">==</span> <span class="org-string">'replace'</span>
<span class="org-vimrc-command">call</span> <span class="org-function-name">CmdLine</span>(<span class="org-comment">"%s" . '/'. l:pattern . '/')</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> @/ <span class="org-constant">=</span> <span class="org-variable-name">l:pattern</span>
<span class="org-vimrc-command">let</span> @<span class="org-comment">" = l:saved_reg</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Don't close window, when deleting a buffer</span>
<span class="org-vimrc-command">command</span><span class="org-constant">!</span> Bclose <span class="org-vimrc-command">call</span> <span class="org-constant">&lt;</span>SID<span class="org-constant">&gt;</span><span class="org-function-name">BufcloseCloseIt</span>()
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-constant">&lt;</span>SID<span class="org-constant">&gt;</span><span class="org-function-name">BufcloseCloseIt</span>()
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:currentBufNum</span> <span class="org-constant">=</span> <span class="org-function-name">bufnr</span>(<span class="org-comment">"%")</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:alternateBufNum</span> <span class="org-constant">=</span> <span class="org-function-name">bufnr</span>(<span class="org-comment">"#")</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">if</span> <span class="org-function-name">buflisted</span>(<span class="org-variable-name">l:alternateBufNum</span>)
<span class="org-vimrc-command">buffer</span> #
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">bnext</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">if</span> <span class="org-function-name">bufnr</span>(<span class="org-comment">"%") == l:currentBufNum</span>
<span class="org-vimrc-command">new</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">if</span> <span class="org-function-name">buflisted</span>(<span class="org-variable-name">l:currentBufNum</span>)
<span class="org-function-name">execute</span>(<span class="org-comment">"bdelete! ".l:currentBufNum)</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org118cbb0" class="outline-3">
<h3 id="org118cbb0">GUI related</h3>
<div class="outline-text-3" id="text-org118cbb0">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guifont</span><span class="org-constant">=</span>Hack\ Nerd\ Font\ Mono:h13
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">gfn</span><span class="org-constant">=</span>Hack\ Nerd\ Font\ Mono:h13
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Disable scrollbars</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guioptions</span><span class="org-constant">-=</span><span class="org-vimrc-command">r</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guioptions</span><span class="org-constant">-=</span>R
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guioptions</span><span class="org-constant">-=</span><span class="org-vimrc-command">l</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">guioptions</span><span class="org-constant">-=</span>L
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org80248f8" class="outline-3">
<h3 id="org80248f8">Turn persistent undo on</h3>
<div class="outline-text-3" id="text-org80248f8">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">try</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">undodir</span><span class="org-constant">=~</span>/<span class="org-constant">.</span>vim_runtime/temp_dirs/<span class="org-vimrc-option">undodir</span>
<span class="org-vimrc-command">set</span> undofile
<span class="org-vimrc-command">catch</span>
<span class="org-vimrc-command">endtry</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org83825da" class="outline-2">
<h2 id="org83825da">Mappings</h2>
<div class="outline-text-2" id="text-org83825da">
2020-01-11 22:04:45 +01:00
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org3b0e457" class="outline-3">
<h3 id="org3b0e457">Normal mode related</h3>
<div class="outline-text-3" id="text-org3b0e457">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Smart way to move between windows</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">j</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>W<span class="org-constant">&gt;</span><span class="org-vimrc-command">j</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">k</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>W<span class="org-constant">&gt;</span><span class="org-vimrc-command">k</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>h<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>W<span class="org-constant">&gt;</span>h
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">l</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>W<span class="org-constant">&gt;</span><span class="org-vimrc-command">l</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org7e9c367" class="outline-3">
<h3 id="org7e9c367">Insert mode related</h3>
<div class="outline-text-3" id="text-org7e9c367">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Paste while in insert mode</span>
<span class="org-vimrc-command">inoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>v<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">r</span><span class="org-constant">&gt;</span>*
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Go to the end of line</span>
<span class="org-vimrc-command">inoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">e</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span>A
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Go to the beginning of line</span>
<span class="org-vimrc-command">inoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>a<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span>I
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org5e60816" class="outline-3">
<h3 id="org5e60816">Visual mode related</h3>
<div class="outline-text-3" id="text-org5e60816">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Visual mode pressing / or ? searches for the current selection</span>
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> / :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>u<span class="org-constant">&gt;</span><span class="org-vimrc-command">call</span> <span class="org-function-name">VisualSelection</span>(<span class="org-string">''</span>, <span class="org-string">''</span>)<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>/<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>R<span class="org-constant">&gt;=</span>@/<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> ? :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>u<span class="org-constant">&gt;</span><span class="org-vimrc-command">call</span> <span class="org-function-name">VisualSelection</span>(<span class="org-string">''</span>, <span class="org-string">''</span>)<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;?&lt;</span>C<span class="org-constant">-</span>R<span class="org-constant">&gt;=</span>@/<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;&lt;</span>CR<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Re-select visual block after indenting</span>
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&lt;</span> <span class="org-constant">&lt;</span>gv
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&gt;</span> <span class="org-constant">&gt;</span>gv
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Move visual block</span>
<span class="org-vimrc-command">vnoremap</span> J :<span class="org-vimrc-command">m</span> <span class="org-string">'&gt;+1&lt;CR&gt;gv=gv</span>
<span class="org-string">vnoremap K :m '</span><span class="org-constant">&lt;</span><span class="org-vimrc-number">-2</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>gv<span class="org-constant">=</span>gv
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org4c2cded" class="outline-3">
<h3 id="org4c2cded">Add some delimiters</h3>
<div class="outline-text-3" id="text-org4c2cded">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" use $ as a delimiter</span>
<span class="org-vimrc-command">xnoremap</span> i$ :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>u<span class="org-constant">&gt;</span>normal<span class="org-constant">!</span> T$vt$<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">xnoremap</span> a$ :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>u<span class="org-constant">&gt;</span>normal<span class="org-constant">!</span> T$hvt$l<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">onoremap</span> i$ :normal vi$<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">onoremap</span> a$ :normal va$<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgb5c42ba" class="outline-3">
<h3 id="orgb5c42ba">Command mode related</h3>
<div class="outline-text-3" id="text-orgb5c42ba">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Bash like keys for the command line</span>
<span class="org-vimrc-command">cnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>A<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Home<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">cnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>E<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>End<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">cnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>K<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>U<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">cnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">P</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Up<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">cnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">N</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Down<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org5148f61" class="outline-3">
<h3 id="org5148f61">Terminal mode related</h3>
<div class="outline-text-3" id="text-org5148f61">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" tnoremap &lt;Esc&gt; &lt;C-\&gt;&lt;C-n&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
tnoremap <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>h <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>\<span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">n</span><span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>h
tnoremap <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>j <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>\<span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">n</span><span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>j
tnoremap <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>k <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>\<span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">n</span><span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>k
tnoremap <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>l <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>\<span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">n</span><span class="org-constant">&gt;&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>l
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgc99aa3c" class="outline-3">
<h3 id="orgc99aa3c">Correct misspelled works</h3>
<div class="outline-text-3" id="text-orgc99aa3c">
2020-01-11 22:04:45 +01:00
<p>
Taken from: <a href="https://vi.stackexchange.com/questions/68/autocorrect-spelling-mistakes">https://vi.stackexchange.com/questions/68/autocorrect-spelling-mistakes</a>
</p>
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Go back to last misspelled word and pick first suggestion.</span>
2021-10-25 14:37:10 +02:00
<span class="org-vimrc-command">inoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>L<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">c</span><span class="org-constant">-</span>g<span class="org-constant">&gt;</span>u<span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span>[s1z<span class="org-constant">=</span>`]a<span class="org-constant">&lt;</span><span class="org-vimrc-command">c</span><span class="org-constant">-</span>g<span class="org-constant">&gt;</span>u
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Select last misspelled word (typing will edit).</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>K<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span>[sve<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>G<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">inoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>K<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span>[sve<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>G<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">snoremap</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span>K<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Esc<span class="org-constant">&gt;</span><span class="org-vimrc-command">b</span>[sviw<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>G<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgbf12520" class="outline-2">
<h2 id="orgbf12520">Filetypes</h2>
<div class="outline-text-2" id="text-orgbf12520">
2020-01-11 22:04:45 +01:00
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org135a723" class="outline-3">
<h3 id="org135a723">Vim Which Key</h3>
<div class="outline-text-3" id="text-org135a723">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span> :WhichKey <span class="org-string">'&lt;Space&gt;'</span><span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span> <span class="org-constant">=</span> {}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org849b459" class="outline-3">
<h3 id="org849b459">Mails</h3>
<div class="outline-text-3" id="text-org849b459">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">autocmd</span> FileType mail <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">spell</span> <span class="org-vimrc-option">spelllang</span><span class="org-constant">=</span>en_us,fr
2021-04-25 19:10:57 +02:00
<span class="org-vimrc-command">autocmd</span> FileType mail <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">textwidth</span><span class="org-constant">=</span><span class="org-vimrc-number">0</span>
2021-10-25 14:37:10 +02:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">Mailcomplete</span>(findstart, base)
<span class="org-vimrc-command">if</span> <span class="org-variable-name">a:findstart</span> <span class="org-constant">==</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">line</span> <span class="org-constant">=</span> <span class="org-function-name">getline</span>(<span class="org-string">'.'</span>)
<span class="org-vimrc-command">let</span> <span class="org-variable-name">idx</span> <span class="org-constant">=</span> <span class="org-function-name">col</span>(<span class="org-string">'.'</span>)
<span class="org-vimrc-command">while</span> idx <span class="org-constant">&gt;</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">idx</span> <span class="org-constant">-=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">c</span> <span class="org-constant">=</span> line[idx]
<span class="org-vimrc-command">if</span> c <span class="org-constant">==</span> <span class="org-string">':'</span> <span class="org-constant">||</span> <span class="org-vimrc-command">c</span> <span class="org-constant">==</span> <span class="org-string">'&gt;'</span>
<span class="org-vimrc-command">return</span> idx <span class="org-constant">+</span> <span class="org-highlight-numbers-number">2</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">continue</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endwhile</span>
<span class="org-vimrc-command">return</span> idx
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">return</span> <span class="org-function-name">split</span>(<span class="org-function-name">system</span>(<span class="org-string">'~/.local/scripts/find-config.sh '</span> <span class="org-constant">.</span> <span class="org-variable-name">a:base</span>), <span class="org-string">'\n'</span>)
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
<span class="org-vimrc-command">setl</span> <span class="org-vimrc-option">omnifunc</span><span class="org-constant">=</span>Mailcomplete
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-variable-name">search</span>=<span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">@</span></span><span class="org-string">"</span>
<span class="org-variable-name">contacts</span>=<span class="org-sh-quoted-exec">`mu cfind "$search"`</span>
<span class="org-variable-name">emails</span>=<span class="org-sh-quoted-exec">`</span><span class="org-type"><span class="org-sh-quoted-exec">echo</span></span><span class="org-sh-quoted-exec"> "$contacts" | awk -F' ' '{print "&lt;" $NF "&gt;"}'`</span>
<span class="org-variable-name">names</span>=<span class="org-sh-quoted-exec">`</span><span class="org-type"><span class="org-sh-quoted-exec">echo</span></span><span class="org-sh-quoted-exec"> "$contacts" | awk -F' ' '{$NF=""; print $0}'`</span>
paste -d <span class="org-string">""</span> &lt;<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-builtin">printf</span> %s <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">names</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-1">)</span> &lt;<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-builtin">printf</span> %s <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">emails</span></span><span class="org-string">"</span><span class="org-rainbow-delimiters-depth-1">)</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org42e1db0" class="outline-3">
<h3 id="org42e1db0">MarkDown</h3>
<div class="outline-text-3" id="text-org42e1db0">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Automatically turn on spell-checking for Markdown files</span>
<span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>md <span class="org-vimrc-command">setlocal</span> <span class="org-vimrc-option">spell</span> <span class="org-vimrc-option">spelllang</span><span class="org-constant">=</span>fr,<span class="org-vimrc-command">en</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgc5ce266" class="outline-3">
<h3 id="orgc5ce266">LaTeX</h3>
<div class="outline-text-3" id="text-orgc5ce266">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>tikz <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">filetype</span><span class="org-constant">=</span>tex
<span class="org-vimrc-command">let</span> <span class="org-variable-name">tex_no_error</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span> <span class="org-comment">" used to not highlight underscores</span>
<span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>tex <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">filetype</span><span class="org-constant">=</span>tex
<span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>tex <span class="org-vimrc-command">let</span> <span class="org-variable-name">b:AutoPairs</span><span class="org-constant">=</span>{<span class="org-string">'('</span>:<span class="org-string">')'</span>, <span class="org-string">'['</span>:<span class="org-string">']'</span>, <span class="org-string">'{'</span>:<span class="org-string">'}'</span>,<span class="org-comment">"'":"'",'"':'"', '`':'`', '$':'$'}</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>tex <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">iskeyword</span><span class="org-constant">+=-</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" " clear the current list of matches that cause error-highlighting</span>
<span class="org-comment">" syn clear texOnlyMath</span>
<span class="org-comment">" " still mark '^' as an error outside of math mode</span>
<span class="org-comment">" syn match texOnlyMath /[\^]/</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" autocmd FileType tex,tikz nnoremap &lt;leader&gt;lt &lt;plug&gt;(vimtex-toc-toggle)</span>
<span class="org-comment">" autocmd FileType tex,tikz nnoremap &lt;leader&gt;ll &lt;plug&gt;(vimtex-labels-open)</span>
<span class="org-comment">" autocmd FileType tex,tikz nnoremap &lt;leader&gt;lv &lt;plug&gt;(vimtex-view)</span>
<span class="org-comment">" autocmd FileType tex,tikz nnoremap &lt;leader&gt;lf &lt;plug&gt;(vimtex-reverse-search)</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" " Make Tikz</span>
<span class="org-comment">" nnoremap &lt;leader&gt;mt :Make pdf t=tikz f=%:t:r&lt;cr&gt;</span>
<span class="org-comment">" nnoremap &lt;leader&gt;mto :make open t=tikz f=%:t:r&lt;cr&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" " Make LaTeX</span>
<span class="org-comment">" nnoremap &lt;leader&gt;ml :Make pdf f=%:t:r&lt;cr&gt;</span>
<span class="org-comment">" nnoremap &lt;leader&gt;mlo :make open f=%:t:r&lt;cr&gt;</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org4bc3f4d" class="outline-3">
<h3 id="org4bc3f4d">Arduino</h3>
<div class="outline-text-3" id="text-org4bc3f4d">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span>pde <span class="org-vimrc-command">set</span> <span class="org-vimrc-option">filetype</span><span class="org-constant">=</span>arduino
<span class="org-vimrc-command">au</span> BufRead,BufNewFile *<span class="org-constant">.</span><span class="org-vimrc-command">ino</span> set <span class="org-vimrc-option">filetype</span><span class="org-constant">=</span>arduino
<span class="org-comment">" au FileType arduino map &lt;leader&gt;ac :!platformio run&lt;CR&gt;</span>
<span class="org-comment">" au FileType arduino map &lt;leader&gt;au :!platformio run -s --target=upload&lt;CR&gt;</span>
<span class="org-comment">" au FileType arduino map &lt;leader&gt;am :!platformio serialports monitor --port=/dev/cu</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org9ce420d" class="outline-3">
<h3 id="org9ce420d">Python</h3>
<div class="outline-text-3" id="text-org9ce420d">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:slime_python_ipython</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> setlocal <span class="org-vimrc-option">expandtab</span>
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> setlocal <span class="org-vimrc-option">tabstop</span><span class="org-constant">=</span><span class="org-vimrc-number">4</span>
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> setlocal <span class="org-vimrc-option">shiftwidth</span><span class="org-constant">=</span><span class="org-vimrc-number">4</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Run Section</span>
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> nmap <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;&lt;</span>localleader<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>SlimeParagraphSend
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Run Selected text</span>
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> vmap <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;&lt;</span>localleader<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>SlimeRegionSend
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CD to directory of current file</span>
<span class="org-vimrc-command">au</span> FileType <span class="org-vimrc-command">python</span> nmap <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span><span class="org-vimrc-command">c</span> :SlimeSend0(<span class="org-string">'cd '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-string">'%:p:h'</span>))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" let python_highlight_all = 1</span>
<span class="org-comment">" au FileType python syn keyword pythonDecorator True None False self</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" au BufNewFile,BufRead *.jinja set syntax=htmljinja</span>
<span class="org-comment">" au BufNewFile,BufRead *.mako set ft=mako</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" au FileType python map &lt;buffer&gt; F :set foldmethod=indent&lt;cr&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" au FileType python inoremap &lt;buffer&gt; $r return</span>
<span class="org-comment">" au FileType python inoremap &lt;buffer&gt; $i import</span>
<span class="org-comment">" au FileType python inoremap &lt;buffer&gt; $p print</span>
<span class="org-comment">" au FileType python inoremap &lt;buffer&gt; $f #--- &lt;esc&gt;a</span>
<span class="org-comment">" au FileType python map &lt;buffer&gt; &lt;leader&gt;1 /class</span>
<span class="org-comment">" au FileType python map &lt;buffer&gt; &lt;leader&gt;2 /def</span>
<span class="org-comment">" au FileType python map &lt;buffer&gt; &lt;leader&gt;C ?class</span>
<span class="org-comment">" au FileType python map &lt;buffer&gt; &lt;leader&gt;D ?def</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org975017c" class="outline-3">
<h3 id="org975017c">Matlab</h3>
<div class="outline-text-3" id="text-org975017c">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Run Section (delimited by %%)</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span><span class="org-vimrc-option">mm</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>SlimeParagraphSend
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+matlab'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Run either Selected text</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">vmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span><span class="org-vimrc-option">mm</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>SlimeRegionSend
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span><span class="org-vimrc-option">mm</span> <span class="org-constant">=</span> <span class="org-string">'run-code'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
func<span class="org-constant">!</span> <span class="org-function-name">GetSelectedText</span>()
normal gv<span class="org-comment">"xy</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">result</span> <span class="org-constant">=</span> <span class="org-function-name">getreg</span>(<span class="org-comment">"x")</span>
2020-11-03 16:27:09 +01:00
normal gv
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">return</span> result
2020-01-11 22:04:45 +01:00
endfunc
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Help on the current selection</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">vmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span><span class="org-vimrc-option">mh</span> :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>U<span class="org-constant">&gt;</span>SlimeSend0(<span class="org-string">'help '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-function-name">GetSelectedText</span>()))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span><span class="org-vimrc-option">mh</span> <span class="org-constant">=</span> <span class="org-string">'help'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Documentation on the current selection</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">vmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span>mH :<span class="org-constant">&lt;</span>C<span class="org-constant">-</span>U<span class="org-constant">&gt;</span>SlimeSend0(<span class="org-string">'doc '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-function-name">GetSelectedText</span>()))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span><span class="org-vimrc-option">mh</span> <span class="org-constant">=</span> <span class="org-string">'help'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Open the current file in the Matlab Editor (usefull for debuging)</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span><span class="org-vimrc-command">me</span> :SlimeSend0(<span class="org-string">'edit '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-string">'%:p'</span>))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span><span class="org-vimrc-command">me</span> <span class="org-constant">=</span> <span class="org-string">'edit-gui'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Run all the file</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span>mr :SlimeSend0(<span class="org-string">'run '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-string">'%:t'</span>))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span>mr <span class="org-constant">=</span> <span class="org-string">'run-file'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Send "cd filepath" to matlab</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span>mc :SlimeSend0(<span class="org-string">'cd '</span><span class="org-constant">.</span><span class="org-function-name">expand</span>(<span class="org-string">'%:p:h'</span>))<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span>mr <span class="org-constant">=</span> <span class="org-string">'cd-file'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Open workspace</span>
<span class="org-vimrc-command">au</span> FileType matlab <span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>localleader<span class="org-constant">&gt;</span>mw :SlimeSend0(<span class="org-string">'workspace'</span>)<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map_local</span><span class="org-constant">.</span>mr <span class="org-constant">=</span> <span class="org-string">'workspace'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgf9610f4" class="outline-3">
<h3 id="orgf9610f4">Save Which Key Configuration</h3>
<div class="outline-text-3" id="text-orgf9610f4">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">call</span> which_key#<span class="org-function-name">register</span>(<span class="org-string">'&lt;Space&gt;'</span>, <span class="org-comment">"g:which_key_map")</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org5ea2f36" class="outline-2">
<h2 id="org5ea2f36">Plugins Config</h2>
<div class="outline-text-2" id="text-org5ea2f36">
2020-01-11 22:04:45 +01:00
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org2436daa" class="outline-3">
<h3 id="org2436daa"><code>junegunn/fzf</code></h3>
<div class="outline-text-3" id="text-org2436daa">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" This is the default extra key bindings</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:fzf_action</span> <span class="org-constant">=</span> {
\ <span class="org-string">'ctrl-t'</span>: <span class="org-string">'tab split'</span>,
\ <span class="org-string">'ctrl-h'</span>: <span class="org-string">'split'</span>,
\ <span class="org-string">'ctrl-v'</span>: <span class="org-string">'vsplit'</span> }
<span class="org-comment">" [[B]Commits] Customize the options used by 'git log':</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:fzf_commits_log_options</span> <span class="org-constant">=</span> <span class="org-string">'--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:fzf_colors</span> <span class="org-constant">=</span>
\ { <span class="org-string">'fg'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Normal'</span>],
\ <span class="org-string">'bg'</span>: [<span class="org-string">'bg'</span>, <span class="org-string">'Normal'</span>],
\ <span class="org-string">'hl'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Comment'</span>],
\ <span class="org-string">'fg+'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'CursorLine'</span>, <span class="org-string">'CursorColumn'</span>, <span class="org-string">'Normal'</span>],
\ <span class="org-string">'bg+'</span>: [<span class="org-string">'bg'</span>, <span class="org-string">'CursorLine'</span>, <span class="org-string">'CursorColumn'</span>],
\ <span class="org-string">'hl+'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Statement'</span>],
\ <span class="org-string">'info'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'PreProc'</span>],
\ <span class="org-string">'prompt'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Conditional'</span>],
\ <span class="org-string">'pointer'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Exception'</span>],
\ <span class="org-string">'marker'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Keyword'</span>],
\ <span class="org-string">'spinner'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Label'</span>],
\ <span class="org-string">'header'</span>: [<span class="org-string">'fg'</span>, <span class="org-string">'Comment'</span>] }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">s:fzf_statusline</span>()
<span class="org-comment">" Override statusline as you like</span>
<span class="org-vimrc-option">highlight</span> fzf1 ctermfg<span class="org-constant">=</span><span class="org-vimrc-number">161</span> ctermbg<span class="org-constant">=</span><span class="org-vimrc-number">251</span>
<span class="org-vimrc-option">highlight</span> fzf2 ctermfg<span class="org-constant">=</span><span class="org-vimrc-number">23</span> ctermbg<span class="org-constant">=</span><span class="org-vimrc-number">251</span>
<span class="org-vimrc-option">highlight</span> fzf3 ctermfg<span class="org-constant">=</span><span class="org-vimrc-number">237</span> ctermbg<span class="org-constant">=</span><span class="org-vimrc-number">251</span>
<span class="org-vimrc-command">setlocal</span> <span class="org-vimrc-option">statusline</span><span class="org-constant">=</span>%#fzf1#\ <span class="org-constant">&gt;\</span> %#fzf2#fz%#fzf3#<span class="org-vimrc-command">f</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">autocmd</span><span class="org-constant">!</span> User FzfStatusLine <span class="org-vimrc-command">call</span> <span class="org-constant">&lt;</span>SID<span class="org-constant">&gt;</span>fzf_<span class="org-function-name">statusline</span>()
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org633de78" class="outline-3">
<h3 id="org633de78"><code>autozimu/LanguageClient-neovim</code></h3>
<div class="outline-text-3" id="text-org633de78">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:LanguageClient_serverCommands</span> <span class="org-constant">=</span> {
\ <span class="org-string">'matlab'</span>: [<span class="org-string">'java'</span>, <span class="org-string">' -Djava.library.path=$MATLABROOT/bin/glnxa64 -cp $MATLABROOT/extern/engines/java/jar/engine.jar:$MATLABROOT/java/jar/jmi.jar:/home/thomas/github/matlab-langserver/build/libs/lsp-matlab-0.1.jar org.tokor.lspmatlab.Application'</span>],
\ }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>F5<span class="org-constant">&gt;</span> :<span class="org-vimrc-command">call</span> LanguageClient_<span class="org-function-name">contextMenu</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-comment">" Or map each action separately</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> K :<span class="org-vimrc-command">call</span> LanguageClient#textDocument_<span class="org-function-name">hover</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-vimrc-option">gd</span> :<span class="org-vimrc-command">call</span> LanguageClient#textDocument_<span class="org-function-name">definition</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>F2<span class="org-constant">&gt;</span> :<span class="org-vimrc-command">call</span> LanguageClient#textDocument_<span class="org-function-name">rename</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org530c33b" class="outline-3">
<h3 id="org530c33b"><code>JamshedVesuna/vim-markdown-preview</code></h3>
<div class="outline-text-3" id="text-org530c33b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">vim_markdown_preview_github</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">vim_markdown_preview_browser</span><span class="org-constant">=</span><span class="org-string">'Google Chrome'</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">vim_markdown_preview_temp_file</span><span class="org-constant">=</span><span class="org-vimrc-number">1</span>
<span class="org-comment">" let vim_markdown_preview_pandoc=1</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgf435b47" class="outline-3">
<h3 id="orgf435b47"><code>mhinz/vim-signify</code></h3>
<div class="outline-text-3" id="text-orgf435b47">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:signify_vcs_list</span> <span class="org-constant">=</span> [<span class="org-string">'git'</span>]
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:signify_disable_by_default</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org96e8776" class="outline-3">
<h3 id="org96e8776"><code>Deoplete</code></h3>
<div class="outline-text-3" id="text-org96e8776">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:deoplete#enable_at_startup</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" let g:deoplete#omni#functions = {}</span>
<span class="org-comment">" set completeopt=longest,menuone,preview</span>
<span class="org-comment">" let g:deoplete#sources = {}</span>
<span class="org-comment">" let g:deoplete#enable_smart_case = 1</span>
<span class="org-comment">" call deoplete#custom#set('ultisnips', 'matchers', ['matcher_fuzzy'])</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgacfd5d8" class="outline-3">
<h3 id="orgacfd5d8"><code>SirVer/ultisnips</code></h3>
<div class="outline-text-3" id="text-orgacfd5d8">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:UltiSnipsSnippetsDir</span> <span class="org-constant">=</span> <span class="org-string">'~/.vim/UltiSnip'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" inoremap &lt;silent&gt;&lt;expr&gt;&lt;TAB&gt; pumvisible() ? "\&lt;C-n&gt;" : "\&lt;TAB&gt;"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:UltiSnipsExpandTrigger</span><span class="org-constant">=</span><span class="org-comment">"&lt;C-j&gt;"</span>
<span class="org-comment">" let g:UltiSnipsJumpForwardTrigger="&lt;tab&gt;"</span>
<span class="org-comment">" let g:UltiSnipsJumpBackwardTrigger="&lt;s-tab&gt;"</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org792637b" class="outline-3">
<h3 id="org792637b"><code>honza/vim-snippets</code></h3>
<div class="outline-text-3" id="text-org792637b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:snipMate</span> <span class="org-constant">=</span> {}
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:snipMate</span><span class="org-constant">.</span>scope_aliases <span class="org-constant">=</span> {}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org8bc27ac" class="outline-3">
<h3 id="org8bc27ac"><code>itchyny/lightline.vim</code></h3>
<div class="outline-text-3" id="text-org8bc27ac">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">LightlineObsession</span>()
<span class="org-vimrc-command">return</span> <span class="org-string">'%{ObsessionStatus("&#61639;")}'</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" \ 'colorscheme': 'gruvbox',</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:lightline</span> <span class="org-constant">=</span> {
\ <span class="org-string">'colorscheme'</span>: <span class="org-string">'solarized'</span>,
\ <span class="org-string">'active'</span>: {
\ <span class="org-string">'left'</span>: [ [ <span class="org-string">'mode'</span>, <span class="org-string">'paste'</span> ],
\ [ <span class="org-string">'filename'</span>, <span class="org-string">'modified'</span>, <span class="org-string">'fugitive'</span>, <span class="org-string">'obsession'</span> ] ]
\ },
\ <span class="org-string">'component'</span>: {
\ <span class="org-string">'fugitive'</span>: <span class="org-string">'%{exists("*fugitive#head")?fugitive#head():""}'</span>
\ },
\ <span class="org-string">'component_expand'</span>: {
\ <span class="org-string">'obsession'</span>: <span class="org-string">'LightlineObsession'</span>
\ },
\ <span class="org-string">'component_visible_condition'</span>: {
\ <span class="org-string">'fugitive'</span>: <span class="org-string">'(exists("*fugitive#head") &amp;&amp; ""!=fugitive#head())'</span>
\ },
\ <span class="org-string">'separator'</span>: { <span class="org-string">'left'</span>: <span class="org-string">''</span>, <span class="org-string">'right'</span>: <span class="org-string">''</span> },
\ <span class="org-string">'subseparator'</span>: { <span class="org-string">'left'</span>: <span class="org-comment">"|", 'right': "|" }</span>
2020-01-11 22:04:45 +01:00
\ }
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgeeb846d" class="outline-3">
<h3 id="orgeeb846d"><code>Autopairs</code></h3>
<div class="outline-text-3" id="text-orgeeb846d">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Incompatibilit&#233; entre auto-pairs et clang-complete</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:AutoPairsMapCR</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">imap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>CR<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;&lt;</span>Plug<span class="org-constant">&gt;</span>AutoPairsReturn
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgec97ba8" class="outline-3">
<h3 id="orgec97ba8"><code>Yggdroot/indentLine</code></h3>
<div class="outline-text-3" id="text-orgec97ba8">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" :IndentLinesToggle toggles lines on and off.</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:indentLine_color_term</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">239</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgb950c54" class="outline-3">
<h3 id="orgb950c54"><code>ryanoasis/vim-devicons</code></h3>
<div class="outline-text-3" id="text-orgb950c54">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:webdevicons_enable_ctrlp</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org58545fe" class="outline-3">
<h3 id="org58545fe"><code>junegunn/goyo.vim</code></h3>
<div class="outline-text-3" id="text-org58545fe">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:goyo_width</span><span class="org-constant">=</span><span class="org-vimrc-number">100</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:goyo_margin_top</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">2</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:goyo_margin_bottom</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">2</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
<p>
This is for soft line breaks
</p>
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">s:goyo_enter</span>()
<span class="org-vimrc-command">let</span> <span class="org-variable-name">b:quitting</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">b:quitting_bang</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">autocmd</span> QuitPre <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-vimrc-command">let</span> <span class="org-variable-name">b:quitting</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
cabbrev <span class="org-constant">&lt;</span><span class="org-vimrc-command">buffer</span><span class="org-constant">&gt;</span> <span class="org-vimrc-command">q</span><span class="org-constant">!</span> <span class="org-vimrc-command">let</span> <span class="org-variable-name">b:quitting_bang</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span> <span class="org-constant">&lt;</span>bar<span class="org-constant">&gt;</span> <span class="org-vimrc-command">q</span><span class="org-constant">!</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
<p>
Quit Vim if this is the only remaining buffer
</p>
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">s:goyo_leave</span>()
<span class="org-vimrc-command">if</span> <span class="org-variable-name">b:quitting</span> <span class="org-constant">&amp;&amp;</span> <span class="org-function-name">len</span>(<span class="org-function-name">filter</span>(<span class="org-function-name">range</span>(<span class="org-highlight-numbers-number">1</span>, <span class="org-function-name">bufnr</span>(<span class="org-string">'$'</span>)), <span class="org-string">'buflisted(v:val)'</span>)) <span class="org-constant">==</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">if</span> <span class="org-variable-name">b:quitting_bang</span>
<span class="org-vimrc-command">qa</span><span class="org-constant">!</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">qa</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">autocmd</span><span class="org-constant">!</span> User GoyoEnter <span class="org-vimrc-command">call</span> <span class="org-constant">&lt;</span>SID<span class="org-constant">&gt;</span>goyo_<span class="org-function-name">enter</span>()
<span class="org-vimrc-command">autocmd</span><span class="org-constant">!</span> User GoyoLeave <span class="org-vimrc-command">call</span> <span class="org-constant">&lt;</span>SID<span class="org-constant">&gt;</span>goyo_<span class="org-function-name">leave</span>()
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgc2ae68e" class="outline-3">
<h3 id="orgc2ae68e"><code>tpope/vim-surround</code></h3>
<div class="outline-text-3" id="text-orgc2ae68e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">vmap</span> Si <span class="org-function-name">S</span>(i_<span class="org-constant">&lt;</span>esc<span class="org-constant">&gt;</span><span class="org-vimrc-command">f</span>)
<span class="org-vimrc-command">au</span> FileType mako <span class="org-vimrc-command">vmap</span> Si S<span class="org-comment">"i${ _(&lt;esc&gt;2f"a) }&lt;esc&gt;</span>
<span class="org-comment">" surroung un visual mode : use S, then b to make the text bold in markdown</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:surround</span>_{char2<span class="org-function-name">nr</span>(<span class="org-string">'b'</span>)} <span class="org-constant">=</span> <span class="org-comment">"__\r__"</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org48c6403" class="outline-3">
<h3 id="org48c6403"><code>Vim-Markdown</code></h3>
<div class="outline-text-3" id="text-org48c6403">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:vim_markdown_folding_disabled</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:vim_markdown_conceal</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:vim_markdown_toc_autofit</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:vim_markdown_toml_frontmatter</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:tex_conceal</span> <span class="org-constant">=</span> <span class="org-comment">""</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org6e96121" class="outline-3">
<h3 id="org6e96121"><code>Neomake</code></h3>
<div class="outline-text-3" id="text-org6e96121">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Latex</span>
<span class="org-vimrc-command">autocmd</span><span class="org-constant">!</span> BufWritePost *<span class="org-constant">.</span>tex Neomake
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:neomake_tex_chktex_maker</span> <span class="org-constant">=</span> {
\ <span class="org-string">'exe'</span>: <span class="org-string">'chktex'</span>,
\ <span class="org-string">'args'</span>: [<span class="org-string">'--inputfiles'</span>],
\ <span class="org-string">'errorformat'</span>:
\ <span class="org-string">'%EError %n in %f line %l: %m,'</span> <span class="org-constant">.</span>
\ <span class="org-string">'%WWarning %n in %f line %l: %m,'</span> <span class="org-constant">.</span>
\ <span class="org-string">'%WMessage %n in %f line %l: %m,'</span> <span class="org-constant">.</span>
\ <span class="org-string">'%Z%p^,'</span> <span class="org-constant">.</span>
\ <span class="org-string">'%-G%.%#'</span>
2020-01-11 22:04:45 +01:00
\ }
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:neomake_tex_enabled_makers</span> <span class="org-constant">=</span> [<span class="org-string">'chktex'</span>]
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Matlab</span>
<span class="org-vimrc-command">autocmd</span><span class="org-constant">!</span> BufWritePost *<span class="org-constant">.</span><span class="org-vimrc-command">m</span> Neomake
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:neomake_matlab_mlint_maker</span> <span class="org-constant">=</span> {
\ <span class="org-string">'exe'</span>: <span class="org-string">'mlint'</span>,
\ <span class="org-string">'mapexpr'</span>: <span class="org-comment">"neomake_bufname.':'.v:val",</span>
\ <span class="org-string">'errorformat'</span>:
\ <span class="org-string">'%f:L %l (C %c): %m,'</span> <span class="org-constant">.</span>
\ <span class="org-string">'%f:L %l (C %c-%*[0-9]): %m,'</span>,
\ }
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:neomake_matlab_enabled_makers</span> <span class="org-constant">=</span> [<span class="org-string">'mlint'</span>]
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org52ec1d5" class="outline-3">
<h3 id="org52ec1d5"><code>lervag/vimtex</code></h3>
<div class="outline-text-3" id="text-org52ec1d5">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" let g:tex_conceal=""</span>
<span class="org-comment">" autocmd FileType tex let b:vimtex_main = 'main.tex'</span>
<span class="org-comment">" let g:vimtex_mappings_enabled=0</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org9b37457" class="outline-3">
<h3 id="org9b37457"><code>jpalardy/vim-slime</code></h3>
<div class="outline-text-3" id="text-org9b37457">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">if</span> <span class="org-function-name">exists</span>(<span class="org-string">'$TMUX'</span>)
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:slime_target</span> <span class="org-constant">=</span> <span class="org-comment">"tmux"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:slime_default_config</span> <span class="org-constant">=</span> {<span class="org-comment">"socket_name": split($TMUX, ",")[0], "target_pane": ":.2"}</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:slime_dont_ask_default</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">endif</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orga920649" class="outline-3">
<h3 id="orga920649"><code>mhinz/vim-grepper</code></h3>
<div class="outline-text-3" id="text-orga920649">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" nnoremap &lt;leader&gt;G :Grepper -tool ag&lt;cr&gt;</span>
<span class="org-comment">" nmap gs &lt;plug&gt;(GrepperOperator)</span>
<span class="org-comment">" xmap gs &lt;plug&gt;(GrepperOperator)</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgc009d1c" class="outline-3">
<h3 id="orgc009d1c">Editor config</h3>
<div class="outline-text-3" id="text-orgc009d1c">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" To ensure that this plugin works well with Tim Pope's fugitive, use the following patterns array:</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:EditorConfig_exclude_patterns</span> <span class="org-constant">=</span> [<span class="org-string">'fugitive://.*'</span>]
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org492ddcb" class="outline-2">
<h2 id="org492ddcb">Bindings</h2>
<div class="outline-text-2" id="text-org492ddcb">
2020-01-11 22:04:45 +01:00
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-org804ac1a" class="outline-3">
<h3 id="org804ac1a">Vim Which Key</h3>
<div class="outline-text-3" id="text-org804ac1a">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span> :WhichKey <span class="org-string">'&lt;Space&gt;'</span><span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span> <span class="org-constant">=</span> {}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org0df6a36" class="outline-3">
<h3 id="org0df6a36">Direct ones</h3>
<div class="outline-text-3" id="text-org0df6a36">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-comment">" Switch with last buffer</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;&lt;</span>Tab<span class="org-constant">&gt;</span> :<span class="org-vimrc-command">e</span> #<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-comment">" let g:which_key_map.&lt;Tab&gt; = 'last-buffer'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgdfeb9c4" class="outline-3">
<h3 id="orgdfeb9c4">Quit</h3>
<div class="outline-text-3" id="text-orgdfeb9c4">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">q</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+quit'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quit</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>qq :<span class="org-vimrc-command">qa</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">q</span><span class="org-constant">.</span>q <span class="org-constant">=</span> <span class="org-string">'quit'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quit - Force</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>qQ :<span class="org-vimrc-command">qa</span><span class="org-constant">!&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">q</span><span class="org-constant">.</span>Q <span class="org-constant">=</span> <span class="org-string">'quit-force'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quit - Save</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>qw :<span class="org-vimrc-command">wq</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">q</span><span class="org-constant">.</span>w <span class="org-constant">=</span> <span class="org-string">'quit-save'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quit - Save all</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>qW :<span class="org-vimrc-command">wqa</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">q</span><span class="org-constant">.</span>W <span class="org-constant">=</span> <span class="org-string">'quit-save-all'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org8bb23f5" class="outline-3">
<h3 id="org8bb23f5">Files</h3>
<div class="outline-text-3" id="text-org8bb23f5">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">f</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+files'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Fast saving</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">fs</span> :<span class="org-vimrc-command">w</span><span class="org-constant">!&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">f</span><span class="org-constant">.</span>s <span class="org-constant">=</span> <span class="org-string">'save-file'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Fast saving all</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>fS :<span class="org-vimrc-option">wa</span><span class="org-constant">!&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">f</span><span class="org-constant">.</span>S <span class="org-constant">=</span> <span class="org-string">'save-all'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Find Files</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">ff</span> :Files<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">f</span><span class="org-constant">.</span>f <span class="org-constant">=</span> <span class="org-string">'find-file'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Find File corresping to Word</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>fw
\ :<span class="org-vimrc-command">call</span> fzf#<span class="org-vimrc-command">vim</span>#<span class="org-function-name">files</span>(<span class="org-string">'.'</span>, fzf#<span class="org-vimrc-command">vim</span>#with_<span class="org-function-name">preview</span>({<span class="org-string">'options'</span>: [<span class="org-string">'--query'</span>, <span class="org-function-name">expand</span>(<span class="org-string">'&lt;cword&gt;'</span>)]}))<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
2020-11-03 16:27:09 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">f</span><span class="org-constant">.</span>w <span class="org-constant">=</span> <span class="org-string">'find-file-word'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgec14959" class="outline-3">
<h3 id="orgec14959">Buffers</h3>
<div class="outline-text-3" id="text-orgec14959">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+buffers'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Create</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>bc :<span class="org-vimrc-command">enew</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>c <span class="org-constant">=</span> <span class="org-string">'buffer-create'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Delete</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">bd</span> :Bclose<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>d <span class="org-constant">=</span> <span class="org-string">'buffer-delete'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Delete all others</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>bD :<span class="org-vimrc-command">bufdo</span> bd<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>D <span class="org-constant">=</span> <span class="org-string">'buffer-delete-others'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Next</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">bn</span> :<span class="org-vimrc-command">bnext</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>n <span class="org-constant">=</span> <span class="org-string">'buffer-next'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Previous</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">bp</span> :<span class="org-vimrc-command">bprevious</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>p <span class="org-constant">=</span> <span class="org-string">'buffer-previous'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Find Buffers</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">bf</span> :Buffers<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>f <span class="org-constant">=</span> <span class="org-string">'buffer-find'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Buffer Home (startify)</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">bh</span> :Startify<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>h <span class="org-constant">=</span> <span class="org-string">'buffer-home'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CD to buffer path</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">bw</span> :<span class="org-vimrc-option">cd</span> %:<span class="org-vimrc-command">p</span>:h<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>:<span class="org-vimrc-command">pwd</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">b</span><span class="org-constant">.</span>w <span class="org-constant">=</span> <span class="org-string">'buffer-pwd'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgcbd0c97" class="outline-3">
<h3 id="orgcbd0c97">Tabs</h3>
<div class="outline-text-3" id="text-orgcbd0c97">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+tabs'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Let 'tt' toggle between this and the last accessed tab</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:lasttab</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">au</span> TabLeave * <span class="org-vimrc-command">let</span> <span class="org-variable-name">g:lasttab</span> <span class="org-constant">=</span> <span class="org-function-name">tabpagenr</span>()
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab New</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">tc</span> :<span class="org-vimrc-command">tabnew</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>c <span class="org-constant">=</span> <span class="org-string">'tab-create'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Delete</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>td :<span class="org-vimrc-command">tabclose</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>d <span class="org-constant">=</span> <span class="org-string">'tab-delete'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Maximize</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>tD :<span class="org-vimrc-command">tabonly</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>D <span class="org-constant">=</span> <span class="org-string">'tab-delete-others'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Left</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">th</span> gt<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>h <span class="org-constant">=</span> <span class="org-string">'tab-left'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Right</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">tl</span> gT<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>l <span class="org-constant">=</span> <span class="org-string">'tab-right'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Move Left</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>tH :<span class="org-vimrc-command">tabmove</span> <span class="org-vimrc-number">-1</span><span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>H <span class="org-constant">=</span> <span class="org-string">'tab-move-left'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Move Right</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>tL :<span class="org-vimrc-command">tabmove</span> <span class="org-constant">+</span><span class="org-vimrc-number">1</span><span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>L <span class="org-constant">=</span> <span class="org-string">'tab-move-right'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Tab Toggle</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span>tt :<span class="org-vimrc-command">exe</span> <span class="org-comment">"tabn ".g:lasttab&lt;CR&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">t</span><span class="org-constant">.</span>t <span class="org-constant">=</span> <span class="org-string">'tab-toggle'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orge0a4b95" class="outline-3">
<h3 id="orge0a4b95">Terminals</h3>
<div class="outline-text-3" id="text-orge0a4b95">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>T <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+terminals'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quickly create a new terminal in a new tab</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span>Tc :<span class="org-vimrc-command">tab</span> new<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>:<span class="org-vimrc-option">term</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>T<span class="org-constant">.</span><span class="org-vimrc-command">c</span> <span class="org-constant">=</span> <span class="org-string">'term-create'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quickly create a new terminal in a vertical split</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span>T/ :<span class="org-vimrc-command">vsplit</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>:<span class="org-vimrc-option">term</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-comment">" let g:which_key_map.T./ = 'term-vert'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Quickly create a new terminal in a horizontal split</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span>T<span class="org-constant">-</span> :<span class="org-vimrc-command">split</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>:<span class="org-vimrc-option">term</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-comment">" let g:which_key_map.T.- = 'term-hor'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org3006f94" class="outline-3">
<h3 id="org3006f94">Splits / Windows</h3>
<div class="outline-text-3" id="text-org3006f94">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+windows'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Horizontal</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">w</span><span class="org-constant">-</span> :<span class="org-vimrc-command">split</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-comment">" let g:which_key_map.w.- = 'win-hor'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Vertical</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">w</span>/ :<span class="org-vimrc-command">vsplit</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-comment">" let g:which_key_map.w./ = 'win-vert'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Maximize</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wD <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>o
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>D <span class="org-constant">=</span> <span class="org-string">'win-delete-others'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Delete</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">wd</span> <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>q
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>d <span class="org-constant">=</span> <span class="org-string">'win-delete'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Go Left</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">wh</span> :<span class="org-vimrc-command">wincmd</span> h<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>h <span class="org-constant">=</span> <span class="org-string">'win-left'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Go Down</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wj :<span class="org-vimrc-command">wincmd</span> j<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>j <span class="org-constant">=</span> <span class="org-string">'win-down'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Go Up</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wk :<span class="org-vimrc-command">wincmd</span> k<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>k <span class="org-constant">=</span> <span class="org-string">'win-up'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split Go Right</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wl :<span class="org-vimrc-command">wincmd</span> l<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>l <span class="org-constant">=</span> <span class="org-string">'win-right'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Split to Tab</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wt <span class="org-constant">&lt;</span>C<span class="org-constant">-</span><span class="org-vimrc-command">w</span><span class="org-constant">&gt;</span>T
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>t <span class="org-constant">=</span> <span class="org-string">'win-make-tab'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Find window</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>wf :Windows<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>f <span class="org-constant">=</span> <span class="org-string">'win-find'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Maximize window</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">wm</span> :<span class="org-vimrc-command">call</span> <span class="org-function-name">MaximizeToggle</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">w</span><span class="org-constant">.</span>m <span class="org-constant">=</span> <span class="org-string">'win-maximize'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">MaximizeToggle</span>()
<span class="org-vimrc-command">if</span> <span class="org-function-name">exists</span>(<span class="org-comment">"s:maximize_session")</span>
exec <span class="org-comment">"source " . s:maximize_session</span>
<span class="org-vimrc-command">call</span> <span class="org-function-name">delete</span>(<span class="org-variable-name">s:maximize_session</span>)
unlet <span class="org-variable-name">s:maximize_session</span>
<span class="org-vimrc-command">let</span> &amp;<span class="org-vimrc-option">hidden</span><span class="org-constant">=</span><span class="org-variable-name">s:maximize_hidden_save</span>
unlet <span class="org-variable-name">s:maximize_hidden_save</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:maximize_hidden_save</span> <span class="org-constant">=</span> &amp;<span class="org-vimrc-option">hidden</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:maximize_session</span> <span class="org-constant">=</span> <span class="org-function-name">tempname</span>()
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">hidden</span>
exec <span class="org-comment">"mksession! " . s:maximize_session</span>
<span class="org-vimrc-command">only</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org96f7ecd" class="outline-3">
<h3 id="org96f7ecd">Check Spell</h3>
<div class="outline-text-3" id="text-org96f7ecd">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+spell-check'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Toggle</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>St :<span class="org-vimrc-command">setlocal</span> <span class="org-vimrc-option">spell</span><span class="org-constant">!&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">t</span> <span class="org-constant">=</span> <span class="org-string">'spell-toggle'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Correct</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>Sc z<span class="org-constant">=</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">c</span> <span class="org-constant">=</span> <span class="org-string">'spell-correct'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Do first</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>SC <span class="org-vimrc-number">1</span>z<span class="org-constant">=</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span>C <span class="org-constant">=</span> <span class="org-string">'spell-correct-first'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Language</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>Sl :<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">spelllang</span><span class="org-constant">=</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">l</span> <span class="org-constant">=</span> <span class="org-string">'spell-language'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Next</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>Sn ]s
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">n</span> <span class="org-constant">=</span> <span class="org-string">'spell-next'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Next and correct</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>SN ]s1z<span class="org-constant">=</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">N</span> <span class="org-constant">=</span> <span class="org-string">'spell-next-correct'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Previous</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>Sp [s
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">p</span> <span class="org-constant">=</span> <span class="org-string">'spell-prev'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Previous and correct</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>SP [s1z<span class="org-constant">=</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span><span class="org-vimrc-command">P</span> <span class="org-constant">=</span> <span class="org-string">'spell-prev-correct'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" CheckSpell Add to dictionnary</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>Sa zg
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>S<span class="org-constant">.</span>a <span class="org-constant">=</span> <span class="org-string">'spell-add-dict'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org830b5fd" class="outline-3">
<h3 id="org830b5fd">Make</h3>
<div class="outline-text-3" id="text-org830b5fd">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+make'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Make Make</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">mm</span> :Make <span class="org-constant">-</span>B<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span><span class="org-constant">.</span>m <span class="org-constant">=</span> <span class="org-string">'make'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Make Clean</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>mc :Make clean<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span><span class="org-constant">.</span>c <span class="org-constant">=</span> <span class="org-string">'make-clean'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Make Force</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>mf :Make<span class="org-constant">!</span> <span class="org-constant">-</span>B<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span><span class="org-constant">.</span>f <span class="org-constant">=</span> <span class="org-string">'make-force'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Make Run</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>mr :Make<span class="org-constant">!</span> run<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span><span class="org-constant">.</span>r <span class="org-constant">=</span> <span class="org-string">'make-run'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Make Open</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>mo :<span class="org-vimrc-command">make</span><span class="org-constant">!</span> <span class="org-vimrc-command">open</span><span class="org-constant">&lt;</span>cr<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">m</span><span class="org-constant">.</span>o <span class="org-constant">=</span> <span class="org-string">'make-open'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org67f74eb" class="outline-3">
<h3 id="org67f74eb">Search</h3>
<div class="outline-text-3" id="text-org67f74eb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+search'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Search History</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">sh</span> :History<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s<span class="org-constant">.</span>h <span class="org-constant">=</span> <span class="org-string">'search-history'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Search Tags</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>sT :Tags<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s<span class="org-constant">.</span>T <span class="org-constant">=</span> <span class="org-string">'search-tags'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Search All</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">sa</span> :Rg<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s<span class="org-constant">.</span>g <span class="org-constant">=</span> <span class="org-string">'search-all'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Search Word</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">sw</span> :<span class="org-vimrc-command">exe</span> <span class="org-string">':Rg '</span> <span class="org-constant">.</span> <span class="org-function-name">expand</span>(<span class="org-string">'&lt;cword&gt;'</span>)<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s<span class="org-constant">.</span><span class="org-vimrc-command">w</span> <span class="org-constant">=</span> <span class="org-string">'search-word'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Search todo keyboard</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">st</span> :Grepper <span class="org-constant">-</span>tool rg <span class="org-constant">-</span>query TODO<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>s<span class="org-constant">.</span><span class="org-vimrc-command">t</span> <span class="org-constant">=</span> <span class="org-string">'search-todos'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-org3ca1a3b" class="outline-3">
<h3 id="org3ca1a3b">GIT</h3>
<div class="outline-text-3" id="text-org3ca1a3b">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+git'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Gutter</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span>gg :SignifyToggle<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span>g <span class="org-constant">=</span> <span class="org-string">'git-'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Gutter Highlight</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span>gG :SignifyToggleHighlight<span class="org-constant">&lt;</span><span class="org-vimrc-command">cr</span><span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span>G <span class="org-constant">=</span> <span class="org-string">'git-'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Commit</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gc :Gcommit<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span><span class="org-vimrc-command">c</span> <span class="org-constant">=</span> <span class="org-string">'git-commit'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Status</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gs :Gstatus<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span>s <span class="org-constant">=</span> <span class="org-string">'git-status'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Diff</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">gd</span> :Gdiff<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span><span class="org-vimrc-command">d</span> <span class="org-constant">=</span> <span class="org-string">'git-diff'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Blame</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gb :Gblame<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span><span class="org-vimrc-command">b</span> <span class="org-constant">=</span> <span class="org-string">'git-blame'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Visualise</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gv :GV<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span>v <span class="org-constant">=</span> <span class="org-string">'git-visualize'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git File (visualise)</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gF :GV<span class="org-constant">!&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span>F <span class="org-constant">=</span> <span class="org-string">'git-file'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Git Find Commits</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>gf :Commits<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>g<span class="org-constant">.</span><span class="org-vimrc-command">f</span> <span class="org-constant">=</span> <span class="org-string">'git-find-commit'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgca221b1" class="outline-3">
<h3 id="orgca221b1">Errors</h3>
<div class="outline-text-3" id="text-orgca221b1">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+errors'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">s:GetBufferList</span>()
<span class="org-vimrc-command">redir</span> <span class="org-constant">=&gt;</span>buflist
<span class="org-vimrc-command">silent</span><span class="org-constant">!</span> <span class="org-vimrc-option">ls</span>
<span class="org-vimrc-command">redir</span> END
<span class="org-vimrc-command">return</span> buflist
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">ToggleLocationList</span>()
<span class="org-vimrc-command">let</span> <span class="org-variable-name">curbufnr</span> <span class="org-constant">=</span> <span class="org-function-name">winbufnr</span>(<span class="org-highlight-numbers-number">0</span>)
<span class="org-vimrc-command">for</span> bufnum in <span class="org-function-name">map</span>(<span class="org-function-name">filter</span>(<span class="org-function-name">split</span>(<span class="org-function-name">s:GetBufferList</span>(), <span class="org-string">'\n'</span>), <span class="org-string">'v:val =~ "Location List"'</span>), <span class="org-string">'str2nr(matchstr(v:val, "\\d\\+"))'</span>)
<span class="org-vimrc-command">if</span> curbufnr <span class="org-constant">==</span> bufnum
<span class="org-vimrc-command">lclose</span>
<span class="org-vimrc-command">return</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfor</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">winnr</span> <span class="org-constant">=</span> <span class="org-function-name">winnr</span>()
<span class="org-vimrc-command">let</span> <span class="org-variable-name">prevwinnr</span> <span class="org-constant">=</span> <span class="org-function-name">winnr</span>(<span class="org-comment">"#")</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">nextbufnr</span> <span class="org-constant">=</span> <span class="org-function-name">winbufnr</span>(winnr <span class="org-constant">+</span> <span class="org-highlight-numbers-number">1</span>)
<span class="org-vimrc-command">try</span>
<span class="org-vimrc-command">lopen</span>
<span class="org-vimrc-command">catch</span> /E776/
echohl ErrorMsg
echo <span class="org-comment">"Location List is Empty."</span>
echohl None
<span class="org-vimrc-command">return</span>
<span class="org-vimrc-command">endtry</span>
<span class="org-vimrc-command">if</span> <span class="org-function-name">winbufnr</span>(<span class="org-highlight-numbers-number">0</span>) <span class="org-constant">==</span> nextbufnr
<span class="org-vimrc-command">lclose</span>
<span class="org-vimrc-command">if</span> prevwinnr <span class="org-constant">&gt;</span> winnr
<span class="org-vimrc-command">let</span> <span class="org-variable-name">prevwinnr</span><span class="org-constant">-=</span><span class="org-vimrc-number">1</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">if</span> prevwinnr <span class="org-constant">&gt;</span> winnr
<span class="org-vimrc-command">let</span> <span class="org-variable-name">prevwinnr</span><span class="org-constant">+=</span><span class="org-vimrc-number">1</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endif</span>
<span class="org-comment">" restore previous window</span>
exec prevwinnr<span class="org-constant">.</span><span class="org-comment">"wincmd w"</span>
exec winnr<span class="org-constant">.</span><span class="org-comment">"wincmd w"</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Error Toggle</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span>ee :<span class="org-vimrc-command">call</span> <span class="org-function-name">ToggleLocationList</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span><span class="org-constant">.</span>e <span class="org-constant">=</span> <span class="org-string">'error-toggle'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Error Open</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span>eo :<span class="org-vimrc-command">lopen</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span><span class="org-constant">.</span>o <span class="org-constant">=</span> <span class="org-string">'error-open'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Error Close</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span>ec :<span class="org-vimrc-command">lclose</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span><span class="org-constant">.</span>c <span class="org-constant">=</span> <span class="org-string">'error-close'</span>
<span class="org-comment">" Error Next</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">en</span> :<span class="org-vimrc-command">lnext</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span><span class="org-constant">.</span>n <span class="org-constant">=</span> <span class="org-string">'error-next'</span>
<span class="org-comment">" Error Previous</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">ep</span> :<span class="org-vimrc-command">lprevious</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">e</span><span class="org-constant">.</span>p <span class="org-constant">=</span> <span class="org-string">'error-previous'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge197646" class="outline-3">
<h3 id="orge197646">Text</h3>
<div class="outline-text-3" id="text-orge197646">
<div class="org-src-container">
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">x</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+text'</span> }
<span class="org-comment">" Start interactive EasyAlign in visual mode (e.g. vipga) and for a motion</span>
<span class="org-vimrc-command">xmap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">xa</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>(EasyAlign)
<span class="org-vimrc-command">nmap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">xa</span> <span class="org-constant">&lt;</span>Plug<span class="org-constant">&gt;</span>(EasyAlign)
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">x</span><span class="org-constant">.</span>a <span class="org-constant">=</span> <span class="org-string">'text-align'</span>
<span class="org-comment">" Indent all file</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">x</span><span class="org-constant">=</span> mzgg<span class="org-constant">=</span>G`z
<span class="org-comment">" let g:which_key_map.x.= = 'text-indent-file'</span>
<span class="org-comment">" Custom Multiple Cursor</span>
<span class="org-comment">" http://www.kevinli.co/posts/2017-01-19-multiple-cursors-in-500-bytes-of-vimscript/</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:mc</span> <span class="org-constant">=</span> <span class="org-comment">"y/\\V\&lt;C-r&gt;=escape(@\", '/')\&lt;CR&gt;\&lt;CR&gt;"</span>
<span class="org-comment">" Multiple Cursor</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">xm</span> *``cgn
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&lt;</span>expr<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">xm</span> <span class="org-variable-name">g:mc</span> <span class="org-constant">.</span> <span class="org-comment">"``cgn"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">x</span><span class="org-constant">.</span>m <span class="org-constant">=</span> <span class="org-string">'multiple-cursor'</span>
<span class="org-comment">" Multiple Cursor - reserve direction</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>xM *``cgN
<span class="org-vimrc-command">vnoremap</span> <span class="org-constant">&lt;</span>expr<span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>xM <span class="org-variable-name">g:mc</span> <span class="org-constant">.</span> <span class="org-comment">"``cgN"</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">x</span><span class="org-constant">.</span>M <span class="org-constant">=</span> <span class="org-string">'multiple-cursor-reverse'</span>
<span class="org-comment">" Delete trainling Whitespaces</span>
<span class="org-vimrc-command">fun</span><span class="org-constant">!</span> <span class="org-function-name">TrimWhitespace</span>()
<span class="org-vimrc-command">let</span> <span class="org-variable-name">l:save</span> <span class="org-constant">=</span> <span class="org-function-name">winsaveview</span>()
keeppatterns %s/\s\<span class="org-constant">+</span>$//<span class="org-vimrc-command">e</span>
<span class="org-vimrc-command">call</span> <span class="org-function-name">winrestview</span>(<span class="org-variable-name">l:save</span>)
2020-01-11 22:04:45 +01:00
endfun
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>xt :<span class="org-vimrc-command">call</span> <span class="org-function-name">TrimWhitespace</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">x</span><span class="org-constant">.</span>t <span class="org-constant">=</span> <span class="org-string">'delete-trailing-whitespaces'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgb596c67" class="outline-3">
<h3 id="orgb596c67">Config</h3>
<div class="outline-text-3" id="text-orgb596c67">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span> <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+config'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedsh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">ToggleSyntaxH</span>()
<span class="org-vimrc-command">if</span> <span class="org-variable-name">s:activatedsh</span> <span class="org-constant">==</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedsh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">synmaxcol</span><span class="org-constant">=</span><span class="org-vimrc-number">800</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedsh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">set</span> <span class="org-vimrc-option">synmaxcol</span><span class="org-constant">=</span><span class="org-vimrc-number">100</span>
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Toggle Syntax column</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>cs :<span class="org-vimrc-command">call</span> <span class="org-function-name">ToggleSyntaxH</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>s <span class="org-constant">=</span> <span class="org-string">'toggle-syntax-col'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">function</span><span class="org-constant">!</span> <span class="org-function-name">ToggleH</span>()
<span class="org-vimrc-command">if</span> <span class="org-variable-name">s:activatedh</span> <span class="org-constant">==</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">1</span>
<span class="org-vimrc-command">match</span> Search <span class="org-string">'\%&gt;80v.\+'</span>
<span class="org-vimrc-command">else</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">s:activatedh</span> <span class="org-constant">=</span> <span class="org-highlight-numbers-number">0</span>
<span class="org-vimrc-command">match</span> none
<span class="org-vimrc-command">endif</span>
<span class="org-vimrc-command">endfunction</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Toggle Highlight</span>
<span class="org-vimrc-command">nnoremap</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">ch</span> :<span class="org-vimrc-command">call</span> <span class="org-function-name">ToggleH</span>()<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>h <span class="org-constant">=</span> <span class="org-string">'toggle-highlight'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Reload vim config</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">cr</span> :<span class="org-vimrc-command">source</span> $MYVIMRC<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>e <span class="org-constant">=</span> <span class="org-string">'reload-config'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Edit vim config</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">ce</span> :<span class="org-vimrc-command">e</span> $MYVIMRC<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>e <span class="org-constant">=</span> <span class="org-string">'edit-config'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Disable highlight</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span><span class="org-vimrc-command">c</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span> :<span class="org-vimrc-command">noh</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>enter <span class="org-constant">=</span> <span class="org-string">'disable-highlight'</span>
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Theme</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span><span class="org-vimrc-command">silent</span><span class="org-constant">&gt;</span> <span class="org-constant">&lt;</span>leader<span class="org-constant">&gt;</span>ct :<span class="org-vimrc-command">noh</span><span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span><span class="org-vimrc-command">c</span><span class="org-constant">.</span>t <span class="org-constant">=</span> <span class="org-string">'choose-theme'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-01-01 20:12:34 +01:00
<div id="outline-container-orgeb5450c" class="outline-3">
<h3 id="orgeb5450c">Insert</h3>
<div class="outline-text-3" id="text-orgeb5450c">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>i <span class="org-constant">=</span> { <span class="org-string">'name'</span> : <span class="org-string">'+insert'</span> }
2020-01-11 22:04:45 +01:00
2021-01-01 20:12:34 +01:00
<span class="org-comment">" Insert Snippet</span>
<span class="org-vimrc-option">noremap</span> <span class="org-constant">&lt;</span>Leader<span class="org-constant">&gt;</span><span class="org-vimrc-option">is</span> :Snippets<span class="org-constant">&lt;</span>CR<span class="org-constant">&gt;</span>
<span class="org-vimrc-command">let</span> <span class="org-variable-name">g:which_key_map</span><span class="org-constant">.</span>i<span class="org-constant">.</span>s <span class="org-constant">=</span> <span class="org-string">'insert-snippet'</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-orgf40e93e" class="outline-3">
<h3 id="orgf40e93e">Save Which Key Configuration</h3>
<div class="outline-text-3" id="text-orgf40e93e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-01 20:12:34 +01:00
<pre class="src src-vimrc"><span class="org-vimrc-command">call</span> which_key#<span class="org-function-name">register</span>(<span class="org-string">'&lt;Space&gt;'</span>, <span class="org-comment">"g:which_key_map")</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2021-10-25 14:37:10 +02:00
<p class="date">Created: 2021-10-25 lun. 14:33</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>