Vim remote editing: why no --remote-send-silent? - vim

I would like to send commands to a named vim server. If the named server
doesn't exist, it should be created automatically, and the commands run in the
new instance of vim.
My problem is that there isn't a "silent" version of --remote-send. I think an
option such as --remote-send-silent would do exactly what I want, but it
doesn't exist.
Is there a way to achieve this? Alternatively, is there a way to
query (programmatically) whether a named vim server exists, so I can switch
the behaviour accordingly?

Related

Open file in a running nvim-qt instance

I want to open new files from the command line on Windows in a single nvim-qt instance that is already open.
I know the existence of the --server option, but how do I know the IP or the socket name or path of the running instance?
As el_technic0 said, the neovim-remote utility is the easiest way to get remote file opening to work. I even added an alias to it in my .bashrc file (alongside the listen address definition) for easier invocation:
export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
alias vim='nvr --remote'
This way the first call will start a new neovim instance, and subsequent calls will be forwarded to that instance.
You may also want to add the set hidden option to your init.vim configuration file, otherwise subsequent calls may fail if the current buffer contains unsaved changes.

have to set port every time in command line when trying to trigger any Perforce command

I'm new to Perforce, need to work in command line, i'm so confused why all the commands on the tutorial websites all write like $p4 command, but I have to add the port every time when try to trigger that command, for an example, for $p4 sync, i have to type $p4 -p myhost:myport sync every time even after I logged in, if i missed the host and port, like if i just typing $p4 sync, the program will just hang in there... anyone can provide some suggestions?
There are a couple ways to make myhost:1666 the default. These are, in the order of decreasing precedence:
command-line options (like -p myhost:1666)
the P4CONFIG file
environment variables (%P4PORT%)
on Windows, the registry (use p4 set P4PORT=myhost:1666 to set it)
See the docs here.
In your case, I guess the registry (if on Windows) or the env. var. (if on Linux) is the best option.
Type:
p4 set P4PORT=myhost:myport
From that point on, "myhost:myport" will be used as the P4PORT when you run commands.
If you use multiple workspaces/servers, P4CONFIG files make it easy to have different sets of settings (based on your working directory), but for a single value, "p4 set" is a nice persistent one-shot method.

using Atom.io with winscp

I am not able to configure winscp to work with ATOM.IO/
I tried to add external editor from the wincsp settings however when I clicked on the file to edit, an command line is opening and nothing happen.
external url : C:\Users\yjradeh\AppData\Local\atom\Update.exe !.!
any help on this ?
I guess the question is off topic, but since it's here and I was JUST trying to figure this out, I thought I would leave an answer just in case.
You need to find the location of the atom.io executable, atom.exe. The update is just run to check for updates and then starts the executable with some other commands. I don't think you can use the Update.exe to start the editor at a specific file, at least not through winscp.
For me, I found that the atom.exe was installed to
C:\Users\mynamehere\AppData\Local\atom\app-0.187.0\atom.exe
So I just copied and pasted this into my winscp editor preferences and it seemed to work fine.
Sidenote: I'm also going to be trying out some of the sftp plugins for atom as they might be better than using winscp if they allow the use of authorization keys. There seem to be plenty of choices.
Update (3/22/16): I found that atom installs itself in the PATH. So now I just add atom as an external editor and use the command
atom !.!

Creating a generic command to edit and quickly execute (python) scripts

I am currently using tmux to create two panes and have vim open in one and plain terminal on the other.
I am using tmuxinator to automate the proccess but I can't figure out a way to make it more generic for different files in different project.
Here is my project.yml for tmuxinator
windows:
- editor:
layout: 9a26,204x53,0,0{115x53,0,0,0,88x53,116,0,1}
panes:
- editor:
- workon dev
- vim ~/repos/project/ #somehow specify this file through arguements
- commandline:
- workon dev
and here is the vim map I use to execute the current file to the pane on the right
:map <Leader>rl :w<Bar>execute 'silent !tmux send-keys -t right "python $(pwd)/%" ENTER'<Bar>redraw!<C-M>
I was wondering if there is a way to give an arguement to the tmuxinator project command or something of this sort for the file that vim is going to open.
Kind of an alias that I could type tmux-alias-for-vim-and-python dev-file.py without having to create a project.yml for each and every different project/file I want to work on.
I may be following an incorrect approach to using tmux/tmuxinator this way so I am open to other suggestion that could accomplish the same thing without tmuxinator
There is no existing trivial way to achieve this.
tmux/tmuxinator aren't really set up to work this way. The best way I can think to have something like this would be to have a template tmuxinator file and set up a shell script so that the script
Takes the arguments you need to pass to the template
Uses those arguments to create a new tmuxinator file
Launches tmuxinator using the new file name as the argument
Once you've done that, put the project up on GitHub. I'm sure there are plenty of people who'd like to have something like this.

Duplicate keyboard typing to another terminal

I have laptop-desktop setup at home and I have successfully cloned my Archlinux installation from one to another. However, I would like to avoid having to {install all new software, edit settings, update} twice, so I was wondering if it'd be possible to log over ssh from laptop to desktop, do something in terminal and have linux copy everything I type into second terminal with ssh logged in?
Thanks for ideas!
You could type the commands into one terminal then edit ~/.bash_history and save the commands into a script. Copy the script onto the machine with the second terminal and execute it. The advantage of this is now you have a script that saved your setup so you can reuse it whenever you need to.
You can use clusterssh, which duplicates your typed input across multiple systems. It is designed for situations in which the exact same tasks, such as software installation or configuration commands, are needed to be performed exactly the same on multiple systems. See http://sourceforge.net/projects/clusterssh/. Also, the KDE Konsole terminal has similar functionality.

Resources