2

I have to edit a lot of files on my Ubuntu server. Filezilla sometimes blocks them from being loaded or pushed up with my changes. I was wondering if it is possible for me to access a file through the command line similar to

vi myTextFile.txt

But instead of using the cmd window it opens up sublime text 2 or some other text editor. Can this be done? or is it rather complex or not even possible?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Joe Lloyd
  • 19,471
  • 7
  • 53
  • 81
  • Emacs does this easily out of the box, but your question is tagged `vi`. – tripleee Jul 07 '15 at 16:10
  • I tagged as Vi because its the default and is related in a way. but if it shouldn't be there feel free to remove – Joe Lloyd Jul 07 '15 at 19:03
  • See e.g. http://stackoverflow.com/questions/12546722/using-emacs-server-and-emacsclient-on-other-machines-as-other-users for what appears to be your primary use case. – tripleee Jul 07 '15 at 20:37

2 Answers2

1

I think this is a perfect reason for using GNU Emacs. There is the excellent preinstalled trampmode. You can easily use GNU Emacs from your local machine in terminal mode using emacs -nw („no window“).

Then you can open a remote file like /ssh:user@remotehost:filename

What happens next: You edit the file on your local machine, every time you save it, it is updated - behind the scenes - to your server.

Once you are logged in with GNU Emacs, you can easily hop from one file to the other without reentering your password. You can even go to dired and thus have a very powerful file system utility.

Last but not last, since you are obviously coming from a vi-background: There is GNU Emacs evil-mode which makes GNU Emacs behave like vi(m).

Dennis Proksch
  • 240
  • 2
  • 9
0

If you want to access a remote file via Vim, you can do it this way:

vim scp://remoteuser@server.tld//path/to/document

Julien Grenier
  • 3,364
  • 2
  • 30
  • 43
  • yeah I've been doing that but I find it tedious for large files and was hoping it could be accessed via a local text editor without the download process – Joe Lloyd Jul 07 '15 at 19:01