It seems like versions of this question have been asked here before, but I haven't been able to glean from them the exact response to what I am looking for.
Say I open up a .txt file via vim on my mac machine and I then want to copy a line from that file to be used in another .txt file or in a google search or in terminal during an ssh session. What would be the simplest way to do this?
Thanks,
EDIT
Found a potential duplicate: Vim: copy selection to OS X clipboard. But I am open to improvements! :)
i'm not sure wether it works for osx too but here on linux i use "+<yank>, there is also "*<yank>
see also http://vim.wikia.com/wiki/Copy_an_Entire_Buffer_to_the_Clipboard
As mentioned in the other answer, use the + register or * register.
In some environments, * and + may not behave as expected. To enable the expected behavior, use a plugin like fakeclip. Fakeclip enables clipboard support when it is not available out of the box.
Related
I am creating a Windows virtual machine and would like to edit the default commands for the command prompt like tree so that when that command is typed it will do what I want it to do. I found 'tree.com' in System32, but when I open it, it is gibberish. How might I be able to read and edit it?
Modifying basic Windows programs is not a good idea (in case you need them there not there anymore), but there's another approaches: doskey, based on UNIX aliases: this allows you to, when you enter tree, to start up another program instead. Help can be found under doskey /? and there are plenty of examples online.
Files with extension .com are compiled executables. There is nothing to edit in there.
I've been looking for at way to copy from vim to my system clipboard. I've read through the question "How to copy to clipboard in vim" and from that I can see that i'll have to compile Vim with +clipboard.
This is not an option for me, when working on a remote server, so for now, I'll have to switch to the mouse, to make the selection to make my system regard the selection a selection. Simply doing a visual select through Vim does not work.
So my question is this;
Is it possible to make my system see the selection made by Vim (e.g. using viw) as something that can be copied to the clipboard using a cmd-c?
I'm using Mac OS High Sierra, running iTerm 2.
I have a car without wheels, can it drive anyway?
Well, the answer is no, unless you strap some sort of wheels or similar to it.
xclip may be a solution (:'<,'>w !xclip -i) but if you can install stuff, it would be easier to install a proper version of vim.
The idea of using xclip will only work if you're on a local machine.
If you're on a remote server and use xclip, it will copy the text to the remote clipboard, making it unavailable locally.
There are ways around this, and you can adapt them from this post, which can be summed up in either:
Use and ANSI escape sequence
OR
Setup communication with the server and an SSH tunnel (yes, not complicated but quite involved)
The first way is actually quite easy, because you just need to enable access to the clipboard from the terminal in the general preferences of iTerm, and then if you do
printf "\033]52;c;$(printf "%s" "YOUR_CLIPBOARD" | base64)\a"
then the text YOUR_CLIPBOARD will be copied in your local clipboard, even if you're on a remote server.
All you have to do is put that printf in a shell script that take what you want as input and map whatever shortcut you want to running the script with the selection as a parameter.
I've been scowering the internet for a good portion of the morning trying to figure this out:
Using OSX, is there a way to either 1) Open a .jff file directly using a third-party software or 2) Is there any terminal command that has proven successful in converting such a file to a type recognizable to OSX?
#ShotgunNinja, you're correct on filling out the form. Thank you so much!
I guess there's not much else to the question. OS X 10.5.
If possible, use the mvim://-protocol instead. It should be compatible with the txmt://-protocol.
If you are not able to change the links themselves, you could try editing the Info.plist for MacVim.
I do not know whether plugin for this «protocol» already exists, but if you want to write your own, you should take a look at BufReadCmd event (and also BufWriteCmd). If you don't want to start from scratch, some such events are defined in $VIMRUNTIME/plugin/netrwPlugin.vim (for example, for ftp:// protocol) file which should come with your vim installation.
AngeFtp? EFS?
Is there a better option?
Is the preferred option built-in?
If so, how do I turn it on?
If not, where do I download it?
I tried with AngeFtp, just by doing find-file using a filespec like
/name#server:/directory
and it prompts me for a password, then does the login to the FTP server and gets the contents - it takes a while - but when it finishes, I don't get or see a dired buffer. I just get a blank buffer with a weird name.
Tramp is the modern replacement for ange-ftp.
The short version is, you specify a file like "/myusername#host:path/to/file". Works like a charm.
View the linked documentation for installation instructions, though it might already be installed if you have a fairly new installation of emacs. Also, there are several questions related to tramp and remote development with emacs on SO
I just use C-x C-f or C-x C-d, with the remote-file format /host:/path/to/my/dir/. And I customize tramp-default-method to "ftp". Works like a charm. When it opens the connection for the first time (only), it prompts for the password.