Skip to content

Instantly share code, notes, and snippets.

View chemzqm's full-sized avatar
🇨🇳
Focusing

Qiming zhao chemzqm

🇨🇳
Focusing
View GitHub Profile
@chemzqm
chemzqm / open.vim
Last active May 9, 2019 16:28
Open url in vim
" ============================================================================
" Description: Open url under cursor or git repository of a module
" Author: Qiming Zhao <chemzqm@gmail.com>
" Licence: Vim licence
" Version: 0.1
" Last Modified: January 16, 2016
" ============================================================================
if exists('did_open_loaded') || v:version < 700
finish
@chemzqm
chemzqm / error-parser.js
Created January 3, 2016 15:53
Send mocha error msg back to macvim quickfix
#!/usr/bin/env node
// Warning: clientserver feature required for MacVim, check it by `:echo has('clientserver')` in MacVim
'use strict'
var lstream = require('./lstream')
var stream = new lstream()
var exec = require('child_process').exec
var hasError = false
stream.on('line', function (line) {
if (line.length) {
@chemzqm
chemzqm / statusline.vim
Created January 2, 2016 19:20
my statusline plugin
function! MyStatusSyntaxItem()
return synIDattr(synID(line("."),col("."),1),"name")
endfunction
function! MyStatusLine()
return "%2*%3.3{MyStatusModeMap()}%*"
\. s:GetPaste()
\. "%4*%0{MyStatusBranch()}%*"
\. " %f " . s:GetModifySymbol()
@chemzqm
chemzqm / iterm.diff
Last active July 15, 2016 09:19
iterm2
diff --git a/autoload/dispatch/iterm.vim b/autoload/dispatch/iterm.vim
index 7b52012..068f95f 100644
--- a/autoload/dispatch/iterm.vim
+++ b/autoload/dispatch/iterm.vim
@@ -21,22 +21,23 @@ function! dispatch#iterm#handle(request) abort
endfunction
function! dispatch#iterm#spawn(command, request, activate) abort
- let script = dispatch#isolate([], dispatch#set_title(a:request), a:command)
+ let script = s:isolate(a:request.command)
@chemzqm
chemzqm / focusmacvim
Last active December 26, 2015 11:41
some osascript
#!/bin/sh
osascript <<END
tell application "MacVim"
activate
end tell
END
@chemzqm
chemzqm / complete.vim
Last active April 4, 2024 07:21
My supertab, complex plugin completion is quite confusing
" Take <tab> for word complete only
" The 'complete' option controls where the keywords are searched (include files, tag files, buffers, and more).
" The 'completeopt' option controls how the completion occurs (for example, whether a menu is shown).
if exists('did_completes_me_loaded') || v:version < 700
finish
endif
let did_completes_me_loaded = 1
function! s:completes_me(shift_tab)
@chemzqm
chemzqm / grepprg.sh
Created December 20, 2015 10:13
git grep with column and new files
#! /bin/bash
git --no-pager grep --no-color --no-index --exclude-standard -n $1 | while read git_grep; do
file_and_line=$(echo "$git_grep" | cut -d : -f 1,2)
match=$(echo "$git_grep" | sed 's/[^:]*:[^:]*:\(.*\)/\1/')
column=$(echo "$match" | awk "{print index(\$0, \"$1\")}")
echo "$file_and_line:$column:$match"
done
@chemzqm
chemzqm / location_list.vim
Last active December 19, 2015 15:51
location_list for unite
scriptencoding utf-8
function! unite#sources#location_list#define()
return s:source
endfunction
let s:source = {
\ "name" : "location_list",
\ "description" : "output location_list",
\ "syntax" : "uniteSource__LocationList",
@chemzqm
chemzqm / quickfix.vim
Created December 19, 2015 10:58
Unite quickfix
scriptencoding utf-8
function! unite#sources#quickfix#define()
return s:source
endfunction
let s:source = {
\ "name" : "quickfix",
\ "description" : "output quickfix",
\ "syntax" : "uniteSource__Quickfix",
" Jump previous/next according to existence of unite, quickfix list, location list
" make sure only one list is opening
function! s:Filter(name)
return a:name =~# '\v\[(Location List|Quickfix List)\]'
endfunction
function! s:GetBuffer()
redir =>buflist
silent! ls