Solution 2 will be much easier.
Assuming you're using the vnc4viewer
package included with Ubuntu, just edit the ~/.vnc/xstartup
script for the user account the remote user will be running under and replace it with the following contents:
#!/bin/bash
function start_and_wait {
#Put the command line for the program you need to run here, followed by an
#ampersand (&). For example, we'll start gedit:
gedit &
wait $!
start_and_wait
}
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
metacity &
start_and_wait
That will fire up GNOME's metacity
window manager all by itself, so popup windows can be handled sanely. (They can even Alt+Tab around if they need to.) While the user will be able to minimize and resize the window, it will just give the user a bare desktop they can do nothing with. No panel, no menus, no icon, nothing. The script will also restart the program if it is exited for any reason.
Once you've done that, just fire up vncserver
and you're golden. You can put this command in your /etc/rc.local
file (or write a proper initscript), before the exit 0
line to have the server start on every boot:
su username -c "vncserver :7"
That will start the server on desktop :7
(port 5907) so any other VNC servers you might otherwise start won't get in the way and you'll have a predictable desktop number to put in the HTML file.
Make sure you're using a separate user account for the remote user that is sufficiently locked down, because even when they only have access to one program there are still many ways they can gain further access to the system. (File dialogs, commands that might open a shell, etc.)
Note that while it's possible to use any window manager and most people would use simple ones like twm
(or whatever it is the kids are using these days), I stuck with metacity
because it's included by default and to keep things simple.
There are two abstractions for syntax coloring in Vim. First, the syntax plugin provides definitions for the various syntax elements (e.g. an HTML tag name -> htmlTagName
), and links them to generic highlight groups (e.g. Statement
). A colorscheme then provides the actual attributes and colors for those (which can depend on whether you use GVIM or a terminal).
If you don't like the color / formatting of a particular highlight group, you'd basically create your own customized fork of the colorscheme. Copy the existing colors/schemename.vim
to ~/.vim/colors/newscheme.vim
, and use the new name in your .vimrc
via the :colorscheme newscheme
command.
On the other hand, if you're fine with the general colors, and just think that a particular syntax element should use a different group, you can override the default assignment. In this example:
:syntax link htmlTagName Constant
Best Answer
Use
vim
, it will load faster thangvim
. You can speed up the loading time a bit by using-X
, or a No-X version ofvim
.In order to silence it, use
>/dev/null
. But that will makevim
complain (Vim: Warning: Output is not to a terminal
) and pause a bit, hence we use-E
.We could have tried
-E -s
, but I'm somehow unable to use:TOhtml
properly, the result is uncolored, and is one a single line.I pimp the command a little by using
-R -c "set noreadonly"
or better-n
alone. This prevents the usual warning message when opening a file that already has a swapfile. There is nothing particular to prevent failures to open a non writable file (eg. owned by root).See my vimcat repository at GitHub, for an example usage of vim syntax highlighting used in a terminal.