Hi,
I just use BBedit with Linux via sftp. I use my Mac as my primary
graphical desktop, and nearly 100% of the time I'm ssh'd into a Linux
box (my primary coding function is embedded Linux). Over the years
I've used two different techniques:
1. You can export your Linux filesystem with nfs or samba. Of the two
I prefer nfs for this use case but I will warn you that it seems to
cause instability in Finder after long periods of connection and then
abrupt non-clean disconnections.
2. You can use the SFTP functionality of BBEdit to open remote
documents in conjunction with a little magic on the Linux side. This
is what I'm doing about 99% of the time now.
#1 you can easily research. For easy use of the SFTP function, I
create a few little adaptors on the Linux side to make it work so I
can just type `bbedit filename` on the Linux side and it opens on my
Mac.
Step 1: make sure you install the bbedit commandline tools and in a
terminal you can locally type `bbedit file.txt` and it will open the
editor etc.
Step 2: I have this in my .bashrc:
```
export REMOTEHOST=`echo $SSH_CLIENT | cut -d ' ' -f 1`
export HOSTIP=`echo $SSH_CONNECTION | cut -d ' ' -f 3`
function bbedit {
# bbedit won't open a remote file via sftp if it doesn't
exist. So, if it's a new file
# create it, call bbedit to open, and then kill it.
FCREATED=0
if [ ! -e "$PWD/$1" ]
then
touch "$PWD/$1"
FCREATED=1
fi
ssh derosier@$REMOTEHOST /usr/local/bin/bbedit -c -u
--front-window "sftp://$USER@$HOSTIP/$PWD/$1"
# The above call will background and return immediately. The
file will open in bbedit
# but since we've created it, and we don't want to leave it
around, we kill it right away.
# If the user saves it, it gets recreated and content is
saved. If not, there's no file,
# so we're cool too. It's a bit odd, but it works.
if [ "$FCREATED" -eq "1" ]
then
rm "$PWD/$1"
fi
}
function bbresults {
ssh derosier@$REMOTEHOST /usr/local/bin/bbresults
}
export CSCOPE_EDITOR=bbeditcscope
```
Step 3: totally optional, but I use cscope and it doesn't work nice
with the above, so I have ~/bin/bbeditcscope:
```
#!/bin/bash
# $1 : Line number from cscope in +## format
# $2 : File name, relative to cscope's location
#ssh derosier@$REMOTEHOST /usr/local/bin/bbedit -c -u --new-window $1
"sftp://$USER@$HOSTIP/$PWD/$2"
ssh derosier@$REMOTEHOST /usr/local/bin/bbedit --front-window $1
"sftp://$USER@$HOSTIP/$PWD/$2"
```
One thing to note, you might have to force Linux to use IPv4 instead
of IPv6 for the IP addresses to work right. I do that in my
.ssh/config via AddressFamily:
```
Host linux.local
HostName linux.local
ForwardX11 yes
ForwardX11Trusted yes
TCPKeepAlive yes
ServerAliveInterval 60
AddressFamily inet
```
Also it's critical to setup key-based auth or you're constantly typing
in your password.
Projects are worth discussing. I do utilize projects. With option #1
(use a remote fileystem) they work as expected and you can basically
just point the project at a directory and new files get picked up
automatically. However with my SFTP method, they require some manual
work. I usually setup a new project and save it locally (I don't keep
them in git with the project, instead I usually keep them in my
Dropbox. There's Reasons for that). Then, on the linux side, I'l do a
`bbedit .` in the project directory. This will bring up a ftp
browser. From here, I can open whatever files I want. I create
collections for the directories in the directory structure, and then I
drag the relevant files into my project pane into the correct
collection. Note this will create "files" that are actually SFTP URLs
and will have the '@' icon. For large projects that grow as I create
them, it's not a big deal. For large projects that are prexisting, it
would be a big problem, however you usually only need to muck with a
small subset. Like for the Linux kernel I usually only pull in the
relevant DTS files, driver code as I need them, etc, and not try to
structure the entire thing. I keep meaning to automate this but
haven't ever gotten around to it. But if you had a large number of
files all in one directory, simply selecting them all in the FTP
explorer and dragging the entire set over is pretty easy and quick.
For find-all type purposes, you can't do the "find in project"
checkbox because the files aren't local nor open. I open everything I
want and use the "Open Editing Windows" or "Open Text Documents"
search in options.
If you have situations where files might change on the server (like
git operations, eg rebases, branch changes, stashes, etc), note that's
not synchronized and BBEdit won't see those out-of-band edits.
shift-cmd-R is your friend. I have just gotten in the habit of
hitting it when moving from my terminal back to the editor. Lately
I've been making heavy use of claude code in my workflow and so reload
from server is a really big deal for me.
The remote-filesystem methods don't have the downsides of using the
SFTP, but using the SFTP method lets me work with files when very
remote over a VPN on a slow connection, and is nice not having to
setup a file service.
There's many ways to do this, but it works great for me. And the fine
guys at BareBones have always done a great job keeping my workflow
working. In other words, in the rare occasions there's been a small
bug in a new release that messes up my (admittedly fringe) workflow,
they've been super responsive and quick to fix it. Anyway, maybe the
above will work for you and let you use BBEdit "on Linux."
For quick edits (think git commit messages and config file changes)
while on a Linux terminal I use emacs. But I much prefer a good GUI.
I've been using BBEdit for 25 years as my primary editor for Linux,
Embedded Linux, and pure uC embedded work. I hate IDEs and every time
I try to switch to something, I come back to BBEdit within days. It's
one of the reasons I'm loving claude code: it works with my workflow
and editor giving me the same benefits of Cursor or the LLM features
of VSCode without me having to switch. This workflow might not be
great for you, but hopefully it helps show you how you can sync up a
Linux workflow with BBEdit.
- Steve
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or believe that the application isn't working correctly, please email "
sup...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: <
https://mastodon.social/@bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
bbedit+un...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/bbedit/1dd1f028-e6e9-4877-ae6c-2827dfff0a94n%40googlegroups.com.