GVim X C#
来源:互联网 发布:怎么编辑淘宝宝贝详情 编辑:程序博客网 时间:2024/06/05 04:32
GVIM与其他Win32应用程序的集成有很多方式,照着手册调用了一下,结果vim.eval几乎失败了,百思不得其解 gvim --windowid HWND倒是成功了
1 //!C:\windows\Microsoft.NET\Framework\v2.0.50727\csc % && %<.exe & pause
2
3 using System;
4 using System.Timers;
5 using System.Drawing;
6 using System.Diagnostics;
7 using System.Windows.Forms;
8 using System.Reflection;
9
10 using Timer=System.Timers.Timer; //There are 3...
11
12 public class myform : Form{
13 private PictureBox pb;
14 private Timer tm;
15 private Object vimServer;
16 private Type vimServerType;
17
18 public static void Main(String[] args){
19 Application.Run(new myform());
20 }
21
22 public myform(){
23 SetControls();
24 SetTimer();
25 }
26
27 void SetTimer(){
28 tm = new Timer(1000);
29 tm.Elapsed += OnTimer;
30 tm.AutoReset = true;
31 tm.Enabled = true;
32 }
33
34 void SetControls(){
35 pb = new PictureBox();
36 pb.Dock = DockStyle.Fill;
37 pb.BackColor = Color.FromArgb(255,0, 0, 255);
38 this.Controls.AddRange(new Control[]{pb, });
39 Process.Start("gvim.exe", String.Format("--windowid {0}", pb.Handle));
40 }
41
42 void GetVimObject(){
43 vimServerType = Type.GetTypeFromProgID("Vim.Application");
44 vimServer = System.Activator.CreateInstance(vimServerType);
45 }
46
47 public void OnTimer(Object Sender, ElapsedEventArgs e){
48 try{
49 GetVimObject();
50
51 String cmd = "bufname(bufnr('.'))";
52 Console.WriteLine("{0}:{1}",cmd, (String)vimServerType.InvokeMember(
53 "Eval",
54 BindingFlags.InvokeMethod,
55 null,
56 vimServer,
57 new object[]{cmd},
58 null,null,null));
59 }catch(Exception ex){Console.WriteLine(ex.ToString());}
60 }
61 }
62
63
64
65
66
- GVim X C#
- CentOS 6.x 下安装配置 gvim
- gvim
- gvim
- GVim
- gVim
- GVIM
- gvim
- gvim
- GVIM
- gvim
- GVIM
- GVim
- GVIM
- gvim
- GVIM
- gvim
- gvim
- TechCrunch Disrupt大会:YouTube创始人陈士骏专访
- node.js 初体验
- Android: persist instance state across multiple sessions
- 在目标板上移植动态库(-/bin/sh: XXX: not found 问题的解决)
- 编码规范
- GVim X C#
- VSS的每日自动备份
- (转)Oracle的EXP/IMP的使用
- oracle imp/exp
- 关于android:background="@drawable/ 出错
- 解决 /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
- JPEG文件编/解码详解
- 编程之美
- Android的layout分析