ConEmu: Open files in vim with ConEmu through File Explorer

1

Is it possible to open files by double clicking an associated file extension or through context menu with vim in a ConEmu tab?

F. Rakes

Posted 2015-01-04T03:57:43.353

Reputation: 187

Unclear. What are you clicking (where)? – Maximus – 2015-01-04T11:42:56.443

@Maximus: I'd say a file associated with Vim (e.g. a .txt file). – Ionut Staicu – 2015-01-04T12:05:55.033

Answers

1

I'd do the following:

  1. Create a batch file, let's say conemuvim.bat and add its path into PATH variable
  2. Assign desired file extensions to be opened with conemuvim (to do so, shift+click2 on a file -> open with -> choose default
  3. Done.

Now, in conemuvim.bat you only need to add the following:

@echo off

start "ConEmu" "C:\Program Files\ConEmu\ConEmu64.exe" -cmd vim.exe "%1"

(surely enough, you need to change the path of the conemu and have vim.exe into your PATH)

That's all :)

// edit: Obviously, this will work with any other console application. Considering this is only a rough mock-up, it may not work well if you need to open multiple files, vim command flags and so on, but it's surely a good starting point.

Ionut Staicu

Posted 2015-01-04T03:57:43.353

Reputation: 257

Thanks for the suggestion, but it only opens up the ConEmu console for me without Vim or any error message. – F. Rakes – 2015-01-06T00:12:59.077

If you type vim in a cmd window will start vim? Also, you updated the conemu path to match your system (e.g. maybe you are using 32bit version?) – Ionut Staicu – 2015-01-06T08:43:16.743

Yes Vim will start anywhere I type vim. The path to ConEmu matches, otherwise that wouldn't start at all I guess. – F. Rakes – 2015-01-06T13:48:42.190

I reset my config and now it's working. This answer works. – F. Rakes – 2015-01-06T18:40:53.890