This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" As an example, put it in the statusline (you should not do this here, just put the %{} in your config): | |
let &statusline = substitute(&statusline, '%f', '%f%{get(b:,"ignore_status","")}', '') | |
" | |
" get(b:, "ignore_status", "") -> Get the key "ignore_status" from the | |
" dictionary b: (all buffer-local variables), defaulting to "" | |
" | |
augroup IgnoreStatus | |
autocmd! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Proof-of-concept, probably won't work for you, sorry | |
" Terminal colors, all grays, lighter to darker | |
let s:colors = range(232, 255) | |
augroup FugitiveColors | |
autocmd! | |
autocmd BufRead * call ShowBlameColors() | |
augroup END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Original idea: https://github.com/briangwaltney/paren-hint.nvim | |
" | |
" Requires the built-in matchparen plugin to be activated | |
if exists("g:loaded_matchparen_text") || &cp | |
finish | |
endif | |
let g:loaded_matchparen_text = 1 | |
if empty(prop_type_get('matchparen_text')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onoremap <silent> iu :<c-u>call <SID>UrlTextObject()<cr> | |
xnoremap <silent> iu :<c-u>call <SID>UrlTextObject()<cr> | |
onoremap <silent> au :<c-u>call <SID>UrlTextObject()<cr> | |
xnoremap <silent> au :<c-u>call <SID>UrlTextObject()<cr> | |
function! s:UrlTextObject() | |
let saved_view = winsaveview() | |
let saved_end_pos = getpos("'b") | |
defer setpos("'e", saved_end_pos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Save in ~/.vim/plugin/range_highlight.vim | |
augroup range_highlight | |
autocmd! | |
autocmd CmdlineChanged : call s:RangeHighlight() | |
autocmd CmdlineLeave : call s:RangeClear() | |
augroup END | |
let s:match_id = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Place file in autoload/quickmacro.vim | |
" | |
" Create mapping in vimrc to start and stop the macro with e.g. M: | |
" | |
" nnoremap M :call quickmacro#Record()<cr> | |
" | |
" Apply macro by @m, or if you have repeat.vim, just press . | |
let s:recording = v:false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Install by saving as `~/.vim/plugin/substitute_code.vim` | |
" Use like the regular `:s` command: | |
" | |
" %Scode/foo/bar/g | |
" | |
" It ignores comments, but not strings. Tweak implementation as desired. | |
command! -nargs=1 -range Scode call s:Scode(<q-args>, <line1>, <line2>) | |
" Input should be something like /<pattern>/<replacement>/<flags> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Place under ~/.vim/plugin/ | |
" | |
" Calling :Timestamp will try to convert the word under the cursor. Selecting | |
" an area in visual mode will pass it to `date` and replace the entire area. | |
" | |
command! -range=0 Timestamp call s:Timestamp(<count>) | |
function! s:Timestamp(count) abort | |
let is_visual = a:count > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Adapted from https://vi.stackexchange.com/a/16111 | |
" | |
command! -nargs=1 DumpHighlight call s:DumpHighlight(<q-args>) | |
function! s:DumpHighlight(filename) abort | |
let output = execute('hi', 'silent!') | |
let colors_name = fnamemodify(a:filename, ':r') | |
let highlights =<< trim eval EOF | |
hi clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Place this file in autoload/put_at_end.vim. | |
" | |
" Create mappings in normal mode that call the function with the string to append: | |
" | |
" nnoremap <silent> z, :call put_at_end#Mapping(',')<cr> | |
" nnoremap <silent> z; :call put_at_end#Mapping(';')<cr> | |
" nnoremap <silent> z) :call put_at_end#Mapping('),')<cr> | |
" | |
" If you have repeat.vim installed, you can repeat the append with a . | |
" |
NewerOlder