Skip to content

Instantly share code, notes, and snippets.

View emanon001's full-sized avatar

emanon001 emanon001

View GitHub Profile
@emanon001
emanon001 / syntax_highlight_of_user_defined_commands.vim
Created January 24, 2012 05:47
Vim script: Syntax highlight of user-defined commands.
augroup syntax-highlight-extension
autocmd!
autocmd Syntax vim call s:set_syntax_of_user_defined_commands()
augroup END
function! s:set_syntax_of_user_defined_commands()
redir => _
silent! command
redir END
@emanon001
emanon001 / vaivavai.vim
Created March 10, 2012 15:06
Vim script: One two three vai!(Haruka Amami shout)
" Commands
command! -nargs=0 -bang Vai
\ call s:vai.vavai('<bang>' == '!')
" Variables
let s:vai = {}
@emanon001
emanon001 / prefix_key_mapping.vim
Created March 13, 2012 15:46
Vim script: Definition of key-mapping using a prefix key is supported.
let s:current_prefix_key = ''
command! -nargs=1 PrefixKeyMappingStart
\ let s:current_prefix_key = <q-args>
command! -nargs=0 PrefixKeyMappingEnd
\ let s:current_prefix_key = ''
function! s:create_prefix_key_mapping_commands()
let base_commands = ['map', 'nmap', 'vmap', 'xmap', 'smap', 'omap',
\ 'imap', 'lmap', 'cmap']
let command_prefix = 'P'
@emanon001
emanon001 / dvorak_for_kinesis.xml
Created March 19, 2012 16:16
KeyRemap4MacBook setting: Dvorak for kinesis keyboard.
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>PI_Engineering</vendorname>
<vendorid>0x05f3</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Kinesis_Keyboard</productname>
<productid>0x0007</productid>
</deviceproductdef>
@emanon001
emanon001 / prefixedmap_step1.vim
Created March 28, 2012 03:31
Definition of key-mapping using a prefix key. (step1)
" 抽象的なプレフィックスキーを定義する
nnoremap <SID>[Tag] <Nop>
nnoremap <silent> <SID>[Tag]<Space> <C-]>
nnoremap <silent> <SID>[Tag]j :<C-u>tag<CR>
nnoremap <silent> <SID>[Tag]k :<C-u>pop<CR>
nnoremap <silent> <SID>[Tag]s :<C-u>tags<CR>
nnoremap <silent> <SID>[Tag]n :tnext<CR>
nnoremap <silent> <SID>[Tag]p :tprevious<CR>
nnoremap <silent> <SID>[Tag]f :tfirst<CR>
@emanon001
emanon001 / prefixedmap_step1_1.vim
Created March 28, 2012 03:41
Definition of key-mapping using a prefix key. (step1-1)
" 実際に打鍵するプレフィックスキーを <C-t> に変更する
nnoremap <script> <C-t> <SID>[Tag]
@emanon001
emanon001 / prefixedmap_ideal.vim
Created March 28, 2012 03:51
Definition of key-mapping using a prefix key. (ideal)
PrefixedMapBegin <SID>[Tag]
" {map-command} {map-arguments} <Nop>
" -> {map-command} {map-arguments} {prefix-key} <Nop>
nnoremap <Nop>
" {map-command} {map-arguments} {lhs} {rhs}
" -> {map-command} {map-arguments} {prefix-key}{lhs} {rhs}
nnoremap <silent> <Space> <C-]>
nnoremap <silent> j :<C-u>tag<CR>
nnoremap <silent> k :<C-u>pop<CR>
nnoremap <silent> s :<C-u>tags<CR>
@emanon001
emanon001 / prefixedmap_step2.vim
Created March 28, 2012 03:58
Definition of key-mapping using a prefix key. (step2)
" ユーザ定義コマンドが使えるようにプラグインの読み込みを行なう。
call prefixedmap#load()
PrefixedMapBegin <SID>[Tag]
Pnnoremap <Nop>
Pnnoremap <silent> <Space> <C-]>
Pnnoremap <silent> j :<C-u>tag<CR>
Pnnoremap <silent> k :<C-u>pop<CR>
Pnnoremap <silent> s :<C-u>tags<CR>
Pnnoremap <silent> n :tnext<CR>
@emanon001
emanon001 / kr4mb_sample.vim
Created April 4, 2012 18:46
Vim script: kr4mb sample.
let g:kr4mb_identifier_aliases = {
\ 'to_dvorak': 'private.remap.device_kinesis_qwerty2dvorak_qwerty'
\ }
command! -nargs=0 DvorakEnable
\ KR4MBEnable to_dvorak
command! -nargs=0 DvorakDisable
\ KR4MBDisable to_dvorak
command! -nargs=0 DvorakToggle
\ KR4MBToggle to_dvorak
function! any_plugin#util#define_boolean(scope)
let a:scope.FALSE = 0
let a:scope.TRUE = !a:scope.FALSE
endfunction