You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get path of document 1 should return the file path of the first document being currently displayed. I believe it's also called the 'front document'.
Version of Vim and architecture
9.0.65 (173)
Environment
Operating System: Bug Sur version 11.6.8 (20G730)
Terminal: Using MacVim GUI, not a terminal. It's version shows the Vim version 9.0.65 (173). It also says c2007 Bjorn Winckler.
Value of $TERM: xterm-256color
How MacVim was installed
brew install macvim
Logs and stack traces
Don't find any log or other error besides what's displayed. Maybe I don't know how to turn on verbose logging?
Vim configuration where issue is reproducable
No response
Issue has been tested with given configuration
by running MacVim.app from GUI macOS interface
by running vim/gvim/etc installed by MacVim
by running other versions of vim (e.g. /usr/bin/vim)
Issue has been tested with no configuration
by running mvim --clean (or gvim, supplied by MacVim distribution)
by running vim --clean (in terminal, supplied by MacVim distribution)
by running vim --clean (in terminal, other suppliers, e.g. /usr/bin/vim)
Other conditions
The both Homebrew packages "vim" and "macvim" are installed
This would be a useful thing to support but I think it requires MacVim to be a document-based program. It's a little more tricky than it seems because the actual files opened are being managed by Vim. We could just expose the currently edited document but that wouldn't be really supporting the full document API.
Marking this as a feature request for now. It's doable, but just not very high priority.
Just curious though @cpmarco what are you trying to do here? What do you want to accomplish by writing that script?
We could just expose the currently edited document but that wouldn't be really supporting the full document API.
I'd vote for that - I'm only interested in this one functionality.
Marking this as a feature request for now.
Makes sense.
Just curious though @cpmarco what are you trying to do here?
I often open/take quick notes with TextEdit, while Vim is used for development. I'd like to be able to toggle those quick notes into MacVim, and back out into TextEdit if I need.
I see. And you are only interested in the file path right? Can you show me what an example script would look like and how you would use the path you get from MacVim to send to TextEdit? AppleScript is always one of those things that I didn't feel like learning too much of. That would cover MacVim -> TextEdit. As for TextEdit -> MacVim, I would imagine the easiest way is just to use the mvim:// protocol.
I kind of need to think through more how to expose MacVim functionality to other apps anyway. There are kind of too many ways to do this right now and Apple seems keen on pushing more and more without supporting each one fully. For example, I was going to suggest doing this via the Shortcuts app instead, but it doesn't seem like TextEdit even supports it (correct me if I'm wrong). There are Services, Apple Script, Share, Shortcuts w/ SiriKit Intents and App Intents and Action extensions, and more, and they all have overlapping functionality. Anyway I digress.
Ok, I can take a look. Judging from current features down the line, I am guessing this will be investigated around r176. AppleScript support is kind of one of those things that haven't been touched in a while and I want to take a cohesive look into what kind of functionality MacVim should expose to other applications via Shortcuts, intents, and whatnot as well.
Activity
eirnym commentedon Aug 8, 2022
The problem is not in MacVim, but in the script file itself as some conditions hasn't been met. This error is quite common as you Google it
ychin commentedon Aug 8, 2022
This would be a useful thing to support but I think it requires MacVim to be a document-based program. It's a little more tricky than it seems because the actual files opened are being managed by Vim. We could just expose the currently edited document but that wouldn't be really supporting the full document API.
Marking this as a feature request for now. It's doable, but just not very high priority.
Just curious though @cpmarco what are you trying to do here? What do you want to accomplish by writing that script?
marcopolo4k commentedon Aug 14, 2022
I'd vote for that - I'm only interested in this one functionality.
Makes sense.
I often open/take quick notes with TextEdit, while Vim is used for development. I'd like to be able to toggle those quick notes into MacVim, and back out into TextEdit if I need.
ychin commentedon Aug 14, 2022
I see. And you are only interested in the file path right? Can you show me what an example script would look like and how you would use the path you get from MacVim to send to TextEdit? AppleScript is always one of those things that I didn't feel like learning too much of. That would cover MacVim -> TextEdit. As for TextEdit -> MacVim, I would imagine the easiest way is just to use the
mvim://protocol.I kind of need to think through more how to expose MacVim functionality to other apps anyway. There are kind of too many ways to do this right now and Apple seems keen on pushing more and more without supporting each one fully. For example, I was going to suggest doing this via the Shortcuts app instead, but it doesn't seem like TextEdit even supports it (correct me if I'm wrong). There are Services, Apple Script, Share, Shortcuts w/ SiriKit Intents and App Intents and Action extensions, and more, and they all have overlapping functionality. Anyway I digress.
marcopolo4k commentedon Aug 14, 2022
Yes, the file path is what I need. The full script I'm using is here.
~/toggle-text-editor.apple.scptosascript ~/toggle-text-editor.apple.scpt eIf I had to do any setup to install Applescript in Mac osacript, I don't remember any.
ychin commentedon Aug 14, 2022
Ok, I can take a look. Judging from current features down the line, I am guessing this will be investigated around r176. AppleScript support is kind of one of those things that haven't been touched in a while and I want to take a cohesive look into what kind of functionality MacVim should expose to other applications via Shortcuts, intents, and whatnot as well.
ychin commentedon Aug 14, 2022
Just don't listen to that StackOverflow comment about switching to Emacs :)