- `Better gx`_
- `Simple Templates In Vim`_
- `gist.vim`_ create and update gists out of existing files.
- `Swap words`_
- `Annoying search highlight "everyone" tries to get rid of`_
- `Some useful custom text objects`_
- `Simple journal`_
#! /usr/bin/env bash | |
set -eu | |
_main(){ | |
input_file="$1" | |
file_path="$(realpath -s "$input_file")" | |
file_name="$(basename "$file_path")" | |
cd "$(dirname "$(realpath -s "${BASH_SOURCE[0]}")")" | |
cp "$file_path" ./ | |
git add "$file_name" |
'use strict'; | |
/** | |
* TTTTTTTTTTTTTTTTTTTTTTTHHHHHHHHH HHHHHHHHHEEEEEEEEEEEEEEEEEEEEEE | |
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E | |
* T:::::::::::::::::::::TH:::::::H H:::::::HE::::::::::::::::::::E | |
* T:::::TT:::::::TT:::::THH::::::H H::::::HHEE::::::EEEEEEEEE::::E | |
* TTTTTT T:::::T TTTTTT H:::::H H:::::H E:::::E EEEEEE | |
* T:::::T H:::::H H:::::H E:::::E | |
* T:::::T H::::::HHHHH::::::H E::::::EEEEEEEEEE |
You have turned on hlsearch
for some reason in your vim config (well
obviously to highlight your searches) but it gets in your way, right?
Now you try to find a solution to this problem, like
-
spam random searches
/klsdf<CR>
-
do
:nohl
command or
" nonymous-ix.vim uses .netrc for auth, and fucks with ix.io | |
" insert :IX [optional visual selection] - copies url to system clipboard | |
" replace :RX <URL> [optional visual selection] | |
" delete :DX <URL> | |
if has('win64') || has('win32') || has('win16') | |
let s:env = 'WINDOWS' | |
else | |
let s:env = toupper(substitute(system('uname'), '\n', '', '')) | |
endif |
This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.
For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way
For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter
This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m
Vim will move the cursor to the beginning of an object after invoking operator upon it. From an interactive editing perspective this may be considered annoying however it is the consistent choice as operators can be destructive. As such restoring the cursor to its prior position after invoking an operator on an object may not make sense.
There are many ways possible to alter this behaviour to your preference with mappings and/or scripting. But with custom operator mappings this can be particularly ugly.
function! RepWincmd(...) | |
execute (v:count ? v:count : s:rep[1]) 'wincmd' s:rep[0] | |
endfunction | |
function! s:setup(rep, ...) | |
let s:rep = [a:rep, v:count ? v:count : get(a:000, 0, 1)] | |
set operatorfunc=RepWincmd | |
return 'g@l' | |
endfunction |
A modified version of Romain's gist.
See prior revisions for functionality closer to the original. This is now a simplification that aims only to provide prompts that would typically follow basic commands.
function! ExpandCommand(pattern) abort
let aliases =
\ { 'cn' : 'cnext'