Vim configurations and customizations
Awk, GAwk, or MAwk must be installed to make use of scripts within this repository, for Debian based Linux distributions that'd be similar to...
sudo apt-get install gawkThis repository requires the [Vim][vim_home] text editor to be installed the source code is available on GitHub -- vim/vim, and most GNU Linux package managers are able to install Vim directly, eg...
-
Arch
sudo packman -Syy sudo packman -S gvim
-
Debian
sudo apt-get update sudo apt-get install gvim
-
Termux
pkg install vim-python
Note, some configurations target Vim version 8.2 (or greater) features
Note; on desktop distributions for clipboard customization, and various plugins,
gvimis recommendedNote; on mobile environments
vim-pythonis recommended if attempting to use YouCompleteMe plugin features
For MakeTags Vim command ctags must be installed, eg...
-
Arch
sudo pacman -S ctags
-
Debian
sudo apt-get install exuberant-ctags
For the YouCompleteMe plugin you may need to install additional dependencies via distribution package manager, eg...
-
Arch
sudo pacman -S gcc go jdk-openjdk
-
Debian
sudo apt-get update sudo apt-get install g++-8 #> Provides C sudo apt-get install golang-go #> Provided Go sudo apt-get install openjdk-8-jdk #> Provides Java
... as well as manually install Rust and TypeScript via other methods, eg...
-
Arch / Debian / most other desktop distributions
#> Download and install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh #> Add and download TypeScript to project dependencies cd <project> && npm install --save-dev typescript
-
Termux
pkg install rust
-
LSP clients
mkdir "${HOME}/git/hub/ycm-core" pushd "${_}" git clone git@github.com:ycm-core/lsp-examples.git pushd "lsp-examples" ## Un-comment/run the following if errors are raised # git remote add fork git@github.com:S0AndS0/lsp-examples.git # git fetch fork ./install.py \ --enable-astro \ --enable-bash \ --enable-css \ --enable-docker \ --enable-erlang \ --enable-postgres \ --enable-ruby
For Rust Vim plugin, in addition to Rust it may be necessary to explicitly install the analyzer too
-
Arch / Debian / most other desktop distributions
rustup component add rust-src
-
Termux
pkg install rust-src
... Though provided that rustup is installed, then make install will attempt to do above via PlugInstall commands.
For the Syntastic plugin the shellcheck dependency may be installed via distribution package manager...
-
Arch
sudo pacman -S shellcheck
-
Debian
sudo apt-get install shellcheck
... as well as checkbashisms, which is often bundled with devscripts package...
-
Arch
sudo pacman -S checkbashisms
-
Debian
sudo apt-get install devscripts
Warning, the file-type recognition of Syntastic seems to be a little buggy for Bash script which by default are treated as
shscripts!
Git should be configured with GitHub for upgrade/update processes to function properly...
git config --global user.name='YourGitHubName'
git config --global user.email='Name@Domain.TLD'... Because local customizations are tracked by Git during the update process to mitigate risks of unintentional and/or unrecoverable overwrites.
For Solidity compiler npm and truffle are required
npm install -g truffleFor Prettier yarn is required
npm install -g yarnClone this project...
mkdir -vp ~/git/hub/S0AndS0
cd ~/git/hub/S0AndS0
git clone git@github.com:S0AndS0/configure-vim.gitBackup your current configurations...
[[ -f ~/.vimrc ]] && {
mv ~/.vimrc ~/.vimrc.bak
}
[[ -d ~/.vimrc.d ]] && {
mv ~/.vimrc.d ~/.vimrc.d.bak
}Make commands may then be used to install, upgrade, or uninstall configurations...
make installThe
installtarget will make symbolic links for./vimrcfile and recursively for files within./vimrc.d/directory, checkout a local branch for further customization, then download and install plugins via Plug
make uninstallThe
uninstalltarget will remove symbolic links and empty sub-directories within~/.vimrc.d/, and remove the Vim script for Plug
make upgradeThe
upgradetarget will remove current symbolic links, fetch configuration updates, merge non-conflicting changes, rebuild symbolic links, and then attempt to upgrade Plug script and pluginsNote, the merge process attempts to be nondestructive by using the
ourstarget; meaning that anytime a merge conflict may arise local customizations are used automatically.
Once installed open a new Vim session to experiment with new configurations.
The following sub-sections cover some, but not all, plugins installed and configured by this repository; as well as some, but not all, common usage examples when applicable. For plugin management the Plug Vim script is utilized, check the configurations for details and full list of plugins that are used.
Source: A Vim plugin which shows a git diff in the sign column.
Documentation
help gitgutter.txtNormal mode mappings
- Stage the hunk under the cursor
<Leader>hs- Preview the hunk under the cursor
<Leader>hp- Undo the hunk under the cursor
<Leader>huCheck the official documentation for more mappings and configuration guidance.
Source: Go development plugin for Vim
After installation via Plug run the following Vim Ex mode command to download and install dependencies;
:GoInstallBinariesRun Ex mode :make command within any .sol file
:makeTip, check trufflesuite/truffle issue 2217 if "EACCESS: permission denied" errors pop.
Source: Syntax file and other settings for TypeScript.
Should be enabled automatically for TypeScript file-types, and/or .ts file suffixes. Check the official documentation for configuration guidance.
Source: emmet-vim is a vim plug-in which provides support for expanding abbreviations similar to emmet
Documentation
help emmet.txtInsert mode mappings
Expand abbreviation or word uses the following key sequence
<C-y>,- Build a new HTML5 file from template
html:5
- Expand nested elements example
div>p#foo$*3>a
... example results...
<div>
<p id="foo1">
<a href=""></a>
</p>
<p id="foo2">
<a href=""></a>
</p>
<p id="foo3">
<a href=""></a>
</p>
</div>Check the official documentation for more mappings and configuration guidance.
Note, this plugin sets
omnifunc=emmet#completeTag
set omnifunc=emmet#completeTag
setlocal omnifunc=emmet#completeTagSource: Designed as a bright theme with pastel 'retro groove' colors and light/dark mode switching in the way of solarized
Check the official documentation for configuration guidance.
Source: plugin to change highlight scheme of spelling checker to use "UNDERLINE" instead of default "REVERSE" for color terminals when
:colorschemeis set
Check the official documentation for configuration guidance.
Source: UltiSnips - The ultimate snippit solution for Vim
Insert mode
- Ctrl ^ Enter → Expand snippit
- Tab → Next tab-stop
- Shift ^ Tab → Previous tab-stop
Warning for <C-CR> to be passed to Vim correctly may, often will, require
configuring the terminal emulator too;
-
Alacritty
~/.config/alacritty/alacritty.yml(snip)key_bindings: - { key: Return, mods: Control, chars: "\x1b[13;5u" }
Source allows you to visually select increasingly larger regions of text
Documentation
help vim-expand-region.txtVisual mode
-
+Expand visual selection -
_Contract visual selection
Check the official documentation for configuration guidance.
Source: Syntax files for Solidity, the contract-oriented programming language for Ethereum
Source: easily search for, substitute, and abbreviate multiple variants of a word
help abolish.txtVisual mode mappings
- Start
Subvertsearch/replace for highlighted text
Ctrl^r
Source: Vim plugin wrapper for Prettier
Note Solidity Prettier plugin is included when installing this Vim plugin.
Documentation
help vim-prettier.txtEx mode commands
:PrettierSource: Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim?
Documentation
help fugitive.txtEx mode commands
This plugin encapsulates many Git features via :Git or :G prefix
- Commit staged changes
G commit- Rename current file buffer and preform
git mv
GMove new-name.ext- Push changes
Git pushCheck the official documentation for more mappings and configuration guidance.
Source: Comment stuff out
Documentation
help commentary.txtNormal mode mappings
- Comment or uncomment current line
gcc- Comment or uncomment lines that
{motion}moves over
gc{motion}Visual mode mappings
- Comment or uncomment the highlighted lines
{Visual}gcCheck the official documentation for more mappings and configuration guidance.
Source: Attempts to balance removal of quotes and braces
Documentation
help balanced-backspace.txtInsert mode mappings
Pressing backspace...
<BS>... within empty and open; curly-brace, parenthesis, square-braces, double-quotes, single-quotes, or backticks, will remove closing symbol of the same type.
Behaviour may be modified for individual, or all, file-types recognized by Vim; check the documentation for details.
Source: Balance parentheses, curly-braces, and square-brackets
Documentation
help balanced-braces.txtInsert mode mappings
For most files an opening; curly-brace, parenthesis, or square-bracket, will insert the closing symbol after the cursor position.
And a closing; curly-brace, parenthesis, or square-bracket, when cursor is already on one of those symbols will cause the cursor to move left once.
Behaviour may be modified for individual, or all, file-types recognized by Vim; check the documentation for details.
Source: Attempts to balance quotes in unobtrusive ways
Documentation
help balanced-quotes.txtInsert mode mappings
For most file-types an opening; single-quote, double-quote, or backtick, will insert a closing symbol after the cursor.
And a closing/repealed; single-quote, double-quote, or backtick, when the cursor is on a closing symbol will cause the cursor to move left once.
Note, this plugin will look backwards on the same line to determine if quotes need to be balanced or if the cursor should instead be moved.
Because of specific conditional logic this plugin allows for triple quotes to be inserted, this is to avoid annoying Python developers and MarkDown authors.
Behaviour may be modified for individual, or all, file-types recognized by Vim; check the documentation for details.
Source: Commands for injecting date and/or time into current buffer
Documentation
:help date-time.txtNormal mode mappings
-
<Leader>dAppend current date after cursor position -
<Leader>DInsert current date before/at cursor position -
<Leader>tAppend current time after cursor position -
<Leader>TInsert current time before/at cursor position
Visual select mode mappings
<Leader>RReplace visual selection with date/time
Source: Vim syntax for emoji conceal characters
Documentation
help emoji-syntax.txtEnsure that conceallevel is greater than 0 and that filetype is recognized as markdown
set conceallevel=1Source: Vim plugin that adds short-cuts/commands for MarkDown headings
Documentation
help markdown-heading-transform.txt
help markdown-heading-link.txtNormal mode mappings
Note, by default mappings are activated only for
markdownfile-type
- Change current line to a heading of specified level, or update current heading level
<Leader>h1 - <Leader>h4- Add or update reference link to current heading line
<Leader>hlSource: Toggles MarkDown elements; bold, italic, and strike-through
Documentation
help markdown-surrounds.txtNormal mode mappings
Note, by default mappings are activated only for
markdownfile-type
- Toggle bold state of current (big) word or line
<Leader>b
<Leader>B- Toggle italic state of current (big) word or line
<Leader>i
<Leader>I- Toggle highlight state of current (big) word or line
<Leader>hi
<Leader>HI- Toggle strike-through state of current (big) word or line
<Leader>st
<Leader>STSource: Vim plugin that nudges visually selected lines up or down
Documentation
help nudge-lines.txtVisual mode mappings
- Move selected line(s) up, combine with Shift to attempt indentation reformatting
<C-k>
<C-K>- Move selected line(s) down, combine with Shift to attempt indentation reformatting
<C-j>
<C-J>Note, either set of motions may be prefixed with a count, eg.
5<C-k>will move selection five lines upwards.Warning, combining count with Shift has undefined behavior.
Source: Replaces misspelled word with first suggested correction
Documentation
help spelling-shortcuts.txtNormal mode mappings
- Accept first spelling correction for previous word
<Leader>sp- Accept first spelling correction for current word
<Leader>sc- Accept first spelling correction for next word
<Leader>snSource: Vim plugin for jumping between splits swiftly
Documentation
help splits-jump.txtNormal mode mappings
- Relative jump to split above
<C-k>- Relative jump towards left split
<C-l>- Relative jump to split below
<C-j>- Relative jump towards right split
<C-h>Source: Vim plugin for re-sizing splits swiftly
Documentation
help splits-jump.txtNormal mode mappings
- Resize active vertical split by
-2
<A-h>- Resize active horizontal split by
+2
<A-j>- Resize active horizontal split by
-2
<A-k>- Resize active vertical split by
+2
<A-l>Note, any of above motions may be prefixed with a count to override the default of
2rows/columns, eg.5<A-l>will resize an active vertical split by+5instead of+2Additionally, to improve compatibility with various devices
<ESC>or Meta-key may be used instead of Alt
Source: Insert a dummy text of a certain length
Documentation
help loremipsum.txtEx mode commands
:Loremipsum [WORDCOUNT] [PARAGRAPH_TEMPLATE] [PREFIX POSTFIX]
:Loreplace [REPLACEMENT] [PREFIX] [POSTFIX]Documentation
help rust.txt
help rust-syntastic.txtCheck the official documentation for configuration guidance.
Source: Syntastic is a syntax checking plugin for Vim created by Martin Grenfell
Documentation
help syntastic.txtEx mode commands
- Output information about checkers available for file-type
SyntasticInfo- Manually cause a syntax check
SyntasticCheckCheck the official documentation for configuration guidance.
Source: a code-completion engine for Vim
Documentation
help youcompletemeNormal mode mappings
Jump to definition
<Leader>jdEx mode commands
- Open quick-fix split
YcmDiags- Echos the type of the variable or method under the cursor, and where it differs, the derived type.
YcmCompleter GetType- Displays the preview window populated with quick info about the identifier under the cursor
YcmCompleter GetDoc- Where available, attempts to make changes to the buffer to correct diagnostics on the current line
YcmCompleter FixItCheck the official documentation for more mappings and configuration guidance.
This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.
Because there are many plugins utilized by this set of configurations, here are a few performance profiling tips...
- Profile time spent on syntax highlighting
syntax off
syntime on
syntax on
" ... Scroll about for a bit...
syntime report- Profile time spent executing functions and various Vim scripts
profile start /tmp/vim-profile.log
profile func *
profile file *
" ... preform actions...
profile pause
noautocmd qall!Options for contributing to configure-vim and S0AndS0
Start making a Fork of this repository to an account that you have write permissions for.
- Add remote for fork URL. The URL syntax is
git@github.com:<NAME>/<REPO>.git...
cd ~/git/hub/S0AndS0/configure-vim
git remote add fork git@github.com:<NAME>/configure-vim.git- Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/S0AndS0/configure-vim
git commit -F- <<'EOF'
:bug: Fixes #42 Issue
**Edits**
- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF
git push fork mainNote, the
-uoption may be used to setforkas the default remote, eg.git push -u fork mainhowever, this will also default theforkremote for pulling from too! Meaning that pulling updates fromoriginmust be done explicitly, eg.git pull origin main
- Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is
https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>
Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.
Thanks for even considering it!
Via Liberapay you may on a repeating basis.
Regardless of if you're able to financially support projects that S0AndS0 maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.
-
GitHub --
tran-simon/fuchsia--docs/development/languages/rust/editors.md -
StackOverflow -- how do I make vim do normal bash like tab completion for file names
-
StackOverflow -- How to get path to the current vimscript being executed
-
StackOverflow -- How to see which plugins are making Vim slow?
-
StackOverflow -- vim how to turn off search highlight after timeout x seconds
-
Reddit -- How to automatically close netrw when exiting a file?
-
YouTube -- Damian Conway, 'More Instantly Better Vim' - OSCON 2013
-
YouTube -- Using Vim's Built in Complete Menu for Autocompleting Words
-
VI StackExchange Why doesn't the backspace key work in insert mode?
-
VI StackExchange -- Cycle through autocomplete menu using tab
Vim configurations and customizations
Copyright (C) 2024 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For further details review full length version of AGPL-3.0 License.