有没有办法让vim在新标签中打开文件,如果它尚未打开,或打开包含它的标签,如果有的话?我知道有public class BiHashMap<K1, K2, V> {
private final Map<K1, Map<K2, V>> mMap;
public BiHashMap() {
mMap = new HashMap<K1, Map<K2, V>>();
}
public V put(K1 key1, K2 key2, V value) {
Map<K2, V> map;
if (mMap.containsKey(key1)) {
map = mMap.get(key1);
} else {
map = new HashMap<K2, V>();
mMap.put(key1, map);
}
return map.put(key2, value);
}
public static void main(String[] args) {
BiHashMap<Double, Double, Double> table1 = new BiHashMap<Double, Double, Double>();
table1.put(0.375, Double.valueOf(1), Double.valueOf(350));
}
}
,但仅适用于vim的GUI版本,我需要它用于CLI版本。
答案 0 :(得分:5)
我必须为它创建自己的命令:
command! -complete=file -nargs=1 Open call Open(<f-args>)
function! Open (file)
let b = bufnr(a:file)
for t in range(tabpagenr("$"))
let a = tabpagebuflist(t + 1)
for i in a
if i == b
exec "tabn " . (t + 1)
return
endif
endfor
endfor
if bufname("%") == "" && !&modified
exec "e " . fnameescape(a:file)
return
endif
exec "tabe " . fnameescape(a:file)
endfunction