Skip to content

Instantly share code, notes, and snippets.

" find_rust_std.vim
scriptencoding utf-8
function! FindRustStd(fname)
let fname = '*' . substitute(tolower(a:fname), '::', '/', 'g') . '.rs'
" echo fname
let found = globpath(s:path, fname)
if found != ''
return found
endif
@h14i
h14i / dscanner
Last active December 16, 2015 01:45
Dscanner driver for universal-ctags
#!/bin/sh
# ~/.ctags.d/drivers
() {
COMMAND_NOT_FOUND=127
if ! type dscanner; then
exit ${COMMAND_NOT_FOUND}
fi
} > /dev/null 2>&1
@h14i
h14i / dscanner.vim
Last active August 29, 2015 14:25
vim compiler plugin for dscanner
" :compiler dscanner
" License: Public Domain
scriptencoding utf-8
if exists('current_compiler')
finish
endif
let current_compiler = 'dscanner'
if exists(':CompilerSet') != 2
@h14i
h14i / typescript_tscpath.vim
Last active August 29, 2015 14:15
Setup project-local tsc path
augroup typescript-tscpath
autocmd!
autocmd BufNewFile,BufRead *.ts call TSCPath()
augroup END
function! TSCPath() "{{{
if !exists('g:typescript_compiler_binary')
" try get local tsc path
let tsc_path = split(system('npm ls -s --parseable typescript'), '\n')[-1]
if !executable(tsc_path . '/bin/tsc')
@h14i
h14i / vimref.zsh
Last active August 29, 2015 14:07
シェルから ref.vim を呼び出すためのラッパー関数
# wrapper for ref.vim
# license: Public Domain
function vimref {
if [[ $# < 2 ]] then
print "$0 - ref.vim wrapper
usage:
$0 SOURCE KEYWORDS
example:
$0 man vim
@h14i
h14i / ref-codic.vim
Created October 2, 2014 11:17
A ref source for codic
" ref-codic.vim - A ref source for codic.
" ref-codic.vim is inspired by unite-codic.vim <https://github.com/rhysd/unite-codic.vim>
" Version: 0.0.1
" Author : h14i <[email protected]>
" License: Public domain
"
" Requirements:
" ref.vim <https://github.com/thinca/vim-ref/>
" codic.vim <https://github.com/koron/codic-vim/>
@h14i
h14i / vim_build.zsh
Last active August 29, 2015 14:01
building vim with rbenv ruby, pyenv python and plenv perl.
#!/usr/bin/zsh
plenv local system
pyenv local 2.7.6
rbenv local 2.1.2
plenv rehash
pyenv rehash
rbenv rehash
# tmux-mouse-toggle
# via http://qiita.com/kawaz/items/7b15e18ca8e072c1dc57
if [[ -n $TMUX ]]; then
if [[ -z "$(tmux show-options -gw mode-mouse | grep off)" ]]; then
tmux set-option -gq mouse-utf8 off
tmux set-option -gq mouse-resize-pane off
tmux set-option -gq mouse-select-pane off
tmux set-option -gq mouse-select-window off
tmux set-window-option -gq mode-mouse off
@h14i
h14i / autoload-ocamlspot.lua
Created March 28, 2014 20:11
ocamlspot.vim with lua
-- ocamlspot.lua
--[[
example:
parse_loc("l100c20b3") -> 100, 20
parse_loc("abcdefghi") -> nil, nil
--]]
function parse_loc(str)
local _, _, line, col = string.find(str, "^l(%d+)c(%d+)b%d+$")
@h14i
h14i / ruby_include.vim
Last active August 29, 2015 13:56
yet another ruby include configs.
" support rack app?
let &l:include = '^\s*\<\%(load\|autoload\|require_relative\|require\|include\|use\|register\)\>\s*:\=["'']\=\(\h\w*\)["'']\=,\='
let &l:includeexpr = "substitute(substitute(tolower(substitute(substitute(v:fname,'\\(\\u\\+\\)\\(\\u\\l\\)','\\1_\\2','g'),'\\(\\l\\|\\d\\)\\(\\u\\)','\\1_\\2','g')),'::','/','g'),'$','.rb','')"
" setlocal path=/to/your/...