Skip to content

Instantly share code, notes, and snippets.

View thinca's full-sized avatar
⌨️
Happy Vimming!

thinca thinca

⌨️
Happy Vimming!
View GitHub Profile
nnoremap <silent> <Plug>(vimrc-show-current-syntax)
\ :<C-u>echo join(map(synstack(line('.'), col('.')),
\ 'synIDattr(v:val, "name")
\ ."(".synIDattr(synIDtrans(v:val), "name").")"'), ',')<CR>
@thinca
thinca / .vimrc
Created December 25, 2011 07:52
thinca's vimrc
" == Naming convention. == {{{1
" Command name
" - CamelCase
" Global function name
" - CamelCase
" Local function name
" - s:split_by_underbar
" Group name for autocmd
" - split-by-dash
" In vimrc, start with "vimrc"
Collecting greenlet
1 location(s) to search for versions of greenlet:
* https://pypi.python.org/simple/greenlet/
Getting page https://pypi.python.org/simple/greenlet/
Starting new HTTPS connection (1): pypi.python.org
"GET /simple/greenlet/ HTTP/1.1" 200 24008
Analyzing links from page https://pypi.python.org/simple/greenlet/
Skipping link https://pypi.python.org/packages/00/6b/9d4b5faa314ac579fda43f874b69246f9d7d1635a39f02c5d5f8866f04e6/greenlet-0.4.5-cp27-none-win_amd64.whl#md5=e06ab7f742a642b7d5b490c90521d0fc (from https://pypi.python.org/simple/greenlet/); it is not compatible with this Python
Skipping link https://pypi.python.org/packages/00/73/63fa90c85f94c2deebe229d940da56148bababc8678d3109bd3ff67f1ace/greenlet-0.4.2.win-amd64-py2.7.exe#md5=ecf74a210b67842e4759a8d81ad5ca62 (from https://pypi.python.org/simple/greenlet/); unsupported archive format: .exe
Skipping link https://pypi.python.org/packages/00/8b/4ccae511e6a9d429ccbf701f1df16a3fe6afbbf75b338ab143754733d831/greenlet-0.4.
function! X() abort
let x = 10
let scope = l:
let F = { -> extend(scope, {'x': 200}) }
call F()
echo x
endfunction
call X()
@thinca
thinca / .zshrc
Last active November 23, 2017 12:58
Support :command in zsh in Vim (experimental)
# put this code in your .zshrc
if [[ "${VIM_TERMINAL_SHELL}" != "" ]]; then
command_not_found_handler() {
if [[ "${1}" != :* ]]; then
echo "command not found: ${1}" > /dev/stderr
return 127
fi
echo -ne "\e_$*\e\\" > /dev/tty
while [[ ! -f "${VIM_TERMINAL_SHELL}" ]]; do
syntax match csvHead /^/ nextgroup=csvOddColumn
syntax match csvOddColumn /[^,]*/ contained nextgroup=csvOddComma
syntax match csvOddComma /,/ contained nextgroup=csvEvenColumn
syntax match csvEvenColumn /[^,]*/ contained nextgroup=csvEvenComma
syntax match csvEvenComma /,/ contained nextgroup=csvOddColumn
highlight default link csvOddColumn Constant
highlight default link csvEvenColumn Statement

Test for Vim script!

2014/11/08 VimConf 2014

let s:Object = {}
function! s:Object.x() abort
let dt = filter(self, '1')
endfunction
let s:Object['+'] = s:Object.x
function! s:new() abort
return copy(s:Object)
endfunction
@thinca
thinca / test_dict.vim
Created March 19, 2016 16:27
test funcref in dict
let dict = {}
function! dict.func1() abort
endfunction
let dict.func2 = dict.func1
echo assert_true(dict.func1 == dict.func2)
@thinca
thinca / test_del_func.vim
Created March 19, 2016 19:06
test delete object with funcref
let obj = {}
function! obj.func() abort
endfunction
let funcname = matchstr(string(obj.func), 'function(''\zs.\{-}\ze'')')
echo assert_true(exists('*{' . funcname . '}'))
unlet obj
echo assert_false(exists('*{' . funcname . '}'))