I am learning VIM. I have a local project, and I want to keep it synchronized on FTP server. So I need:
turning automated sync on, when i edit files localy
turning it off
forcing to uploading one file (useful when automatic sync off)
forcing to download one file
way to compare local and FTP version of a file
I use those features all the time with PHPStorm IDE, and now I wonder is it possible at all in VIM.
I was thinking... maybe to use external rsync app or svn, and sync svn with ftp. Is that more like the way to go?
You can install this plugin which allow you to open a remote file with
:e ftp:www.foobax.com/myfile.txt
and save it locally
:w myfile.txt
(use w! to overwrite it)
You could diff it using the diffsplit command. Example (on the window containing the remote file)
:diffsplit myfile.txt
Obviously, if you can use a VCS, that's even better.
Related
I'm trying to get this installed in my vim for ubuntu:
https://github.com/nelsyeung/twig.vim
I downloaded the files to ~/.vim folder, but there are no instructions on what I need to put into the .vimrc file to get it activated. What steps am I missing?
I downloaded the files to ~/.vim folder,
No. If you want to use Vim new integrated plugins management, first create the pack directory with a dedicated subdirectory of your choice (let's call it git-plugins but it's really own to you and depend how you want to have things organised)
mkdir -p ~/.vim/pack/git-plugins
In that location, create one of these directories:
start for plugins you always want available when you launch Vim
opt for plugins you want to activate and deactivate manually
Last, there will be a directory for the plugin itself. So, here, you have to download the files into let's say ~/.vim/pack/git-plugins/start/twig/
instructions on what I need […] to get it activated.
Now, launch vim and type the following command:
:packloadall
Check the included manual with
:h packl
This plugin has no doc to integrate into that system. But for general cases, put the following in your ~/.vimrc, after all internal setting and before plugins dedicated settings.
packloadall
silent! helptags ALL
I am trying to start using a vim plugin management tool to manage my vim plugins, like vundle, and I have multiple hosts and want them syncing with vim settings. currently I am checking the .vim dir into a git repo. but I don’t want to check in all plugins as they belongs to others. Wonder what would be the best practice if I use the plugin management tool to keep them sync without checking in plugins code
if you used plugin mgmt, like vundle, you don't have to push your .vim dir to git repo. You just push your .vimrc file to git. Because vimrc should have already configured vundle and declared which plugins you want to have.
What you can do on a new host:(assume you put vundle to $HOME/.vim/Bundle)
pull your .vimrc file from git repo
get vundle: git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Then open vim, run :PluginInstall. You have all plugins.
I recently came across the exact same problem regarding the sync between my laptop and my desktop workstation. Like Kent I already used the Vundle.vim plugin manager on both machines but had the need for a more comfortable sync solution for my vim setup than only syncing my ~/.vim/vimrc between both machines and run :PluginInstall on the other machine each time I add a plugin.
My solution now is that I use Syncthing that is configured to directly sync my ~/.vim folder between both machines to each other as soon changes happen.
The only downside of this solution is that both machines need to be running to sync changes. But I handle this with my little homeserver which's also configured in the sync-chain and provides the latest version of my ~/.vim directory to each of the machines when the other one is not running.
Let me know if you need any further details about the configuration settings.
I use WinSCP to get access on the remote files of our project. How can I search for some text/words in all remote files/directories using WinSCP?
WinSCP does not support text searching in its primary GUI.
But there's a built-in extension to Search recursively for text in remote directory.
This is a universal solution that works with SFTP, even if the server does not allow shell access, or even for FTP or WebDAV sessions.
Alternatively, you may be able to make use of WinSCP console window (Commands > Open Terminal) to launch the search from the command-line.
grep -r "text_to_search_for" *
This of course requires a shell access to the server.
When I'm working with remote files (over SSH/SFTP), Emacs always saves the files with permission 700, but any other editor (e.g. GEdit) maintains the previous permission of 770.
Is there any way to configure Emacs such that it does not change the file permissions?
So here's something that may help. The bug I linked to describes your situation almost to a tee (substituting vim for emacs). Someone there posted a workaround you could try:
...after installing sshfs (fuse was already installed), then mounting
the remote server by creating /mnt/servername, and using sshfs
user#servername:/path/ /mnt/servername/ -p port, I was able to use
gvfs to navigate to /mnt/servername and open, edit and save the file
using GVim without problems. This is both a workaround, and perhaps
useful in narrowing down the problem.
Of course, the easiest (and quickest) solution will be to use Tramp Mode:
C-x C-f /user#10.10.1.10:/var/www/test.php
I'm trying to switch from a windows environment to Linux. I'm primarily PHP developer, but I do know quite a bit about other languages such as CSS, XHTML and Javascript. I need a way of editing my files locally because I work in a git repository and need to commit my saves. On windows I used Aptana and PDT. I'd save my files, upload via Aptana, then commit my work with git.
I need to get a work flow going on my Linux machine now. If you know a better way to do this let me know, however my real question is, is there a plugin that allows gedit to upload files instead of working remotely?
git was designed for distributed development and works well as a mechanism for deploying code to a web server.
On your Linux PC, git clone your git repository url. Edit and commit locally and then git push the changes to the git repository. Then, if you have shell access on the server, use git pull to copy the changes to your server.
To ftp sync, you could set up a branch, ftpbranch, that corresponds to what is on the server, and then each time you want to sync ftpbranch with master:
filestoput=`git diff --name-only master ftpbranch`
Now upload the files:
for f in $filestoput; do curl --ftp-create-dirs -T $f ftp://serverurl
Now update ftpbranch indicating these files have been copied to the server:
git checkout ftpbranch; git merge master; git checkout master
When using linux, you can mount the ftp server to a local folder, then opening and save file from that folder will automatically download and upload the file to ftp server.
If you use ubuntu, just click on Places > Connect To Server.... Choose FTP in Service Type dropdown, fill in the required info, then don't forget to bookmark it.
After this, you can open the file directly in any text editor, not just gedit. I would recoment geany for serious programming editor, because it have a lot of neat feature, almost same with Notepad++ in Windows.
But, since you already using git, why not just use git push to get the update and git pull to upload the update? I have long since uploading manually to my server. Git do all the work for me, synchronizing it between servers. Any particular reason why you still need ftp?