Can I hide the tabs in gnome-terminal? - gnome-terminal

I would like to be able to hide the tabs in gnome-terminal since I switch tabs with shortcuts and don't need or want the graphical tabs. Is there a way to hide them?

This works for me on Debian 10 with gnome-terminal 3.30.2.
If you look at the allowed values for tab-policy you will see:
$ gsettings range org.gnome.Terminal.Legacy.Settings tab-policy
enum
'always'
'automatic'
With a couple of minor changes to /usr/share/glib-2.0/schemas/org.gnome.Terminal.gschema.xml you can enable what appears to be an existing setting that will allow you to turn the tabs on and off.
--- /usr/share/glib-2.0/schemas/org.gnome.Terminal.gschema.xml 2018-12-25 13:45:29.000000000 -0800
+++ /tmp/org.gnome.Terminal.gschema.xml 2019-12-06 13:22:19.318272624 -0800
## -38,7 +38,7 ##
<enum id='org.gnome.Terminal.TabsbarPolicy'>
<value nick='always' value='0'/>
<value nick='automatic' value='1'/>
- <!-- <value nick='never' value='2'/> -->
+ <value nick='never' value='2'/>
</enum>
<enum id='org.gnome.Terminal.ThemeVariant'>
## -727,7 +727,7 ##
</key>
<key name="tab-policy" enum="org.gnome.Terminal.TabsbarPolicy">
- <default>'automatic'</default>
+ <default>'never'</default>
<summary>When to show the tabs bar</summary>
</key>
After the change you should see 'never' as a possible value:
$ gsettings range org.gnome.Terminal.Legacy.Settings tab-policy
enum
'always'
'automatic'
'never'
Note that you might need to run the following as root after editing the xml file:
# cd /usr/share/glib-2.0/schemas
# glib-compile-schemas .
After restarting your gnome-terminal tabs can be turned off with:
$ gsettings set org.gnome.Terminal.Legacy.Settings tab-policy 'never'
And turned back on with:
$ gsettings set org.gnome.Terminal.Legacy.Settings tab-policy 'always'
Update (Oct 2021)
The above no longer works in Debian 11. The schema change now needs to be made in the source. The following works for me.
$ apt source gnome-terminal
$ cd gnome-terminal-3.42.0
edit src/org.gnome.Terminal.gschema.xml and uncomment the never value in TabsbarPolicy
$ debuild -b -uc -us
$ cd ..
$ sudo dpkg -i gnome-terminal_3.42.0-1_amd64.deb gnome-terminal-data_3.42.0-1_all.deb

Related

Mercurial side-by-side diffs (at max term width)

I use extdiff in my ~/.hgrc...
[extensions]
pager =
hgext.extdiff =
[extdiff]
# add new command that runs GNU diff(1) in 'side-by-side' mode
cmd.sdiff = sh
opts.sdiff = -c 'diff -dbB --left-column -y -W `tput cols` $0 $1'
[pager]
pager = LESS='FRX' less
attend = cat, diff, sdiff, glog, log, incoming, outgoing, lg, show, lga
This means I can use hg sdiff README and use diff in side-by-side mode for the README file; however, for some reason, the output of tput cols above still gives the shell 80 characters when I run it through hg sdiff.
If I remove sdiff from the [pager] extension, my sdiff spans the full terminal width...
[pager]
pager = LESS='FRX' less
## Removing sdiff fixes the problem with terminal width
attend = cat, diff, glog, log, incoming, outgoing, lg, show, lga
Even if I remove sdiff from the [pager] section and manually pipe through less as hg sdiff | less -FRX, the diff still spans a full terminal width. How can I get [extdiff] and [pager] to allow dynamic terminal width for side-by-side diffs?
The only workaround I have found is
[extdiff]
# add new command that runs GNU diff(1) in 'side-by-side' mode
cmd.sdiff = sh
opts.sdiff = -c 'diff -dbB --left-column -y -W `tput cols` $0 $1 | less -FRX'
I also remove sdiff from the [pager] section. This looks like a Mercurial bug at this point.

Makefile:3: *** missing separator. Stop

I have attempted what I could, with the answers found on StackOverflow on this question. I do not believe the issue is with tabs. Here is the makefile:
# $OpenBSD: Makefile,v 1.15 2010/02/09 08:55:31 markus Exp $
.include <bsd.own.mk>
SUBDIR= lib ssh sshd ssh-add ssh-keygen ssh-agent scp sftp-server \
ssh-keysign ssh-keyscan sftp ssh-pkcs11-helper
distribution:
${INSTALL} -C -o root -g wheel -m 0644 ${.CURDIR}/ssh_config \
${DESTDIR}/etc/ssh/ssh_config
${INSTALL} -C -o root -g wheel -m 0644 ${.CURDIR}/sshd_config \
${DESTDIR}/etc/ssh/sshd_config
.include <bsd.subdir.mk>
I have attempted to put a tab before line 3 (where the issue is), and had the following error appear:
Makefile:3: *** commands commence before first target. Stop.
This isn't a makefile of my own design--it was downloaded directly from here:
http://www.openssh.com/openbsd.html
(first download link)
Additionally, based on another answer to this question, I have used the following command:
root#server:/usr/src/ssh# cat -e -t -v Makefile
which output the following:
\#^I$OpenBSD: Makefile,v 1.15 2010/02/09 08:55:31 markus Exp $$ $ .include <bsd.own.mk>$ $ SUBDIR=^Ilib ssh sshd ssh-add ssh-keygen
ssh-agent scp sftp-server \$ ^Issh-keysign ssh-keyscan sftp
ssh-pkcs11-helper$ $ distribution:$ ^I${INSTALL} -C -o root -g wheel
-m 0644 ${.CURDIR}/ssh_config \$ ^I ${DESTDIR}/etc/ssh/ssh_config$ ^I${INSTALL} -C -o root -g wheel -m 0644 ${.CURDIR}/sshd_config \$ ^I
${DESTDIR}/etc/ssh/sshd_config$ $ .include <bsd.subdir.mk>$
Does anyone know what could be the issue? Thanks in advance.
This makefile is written for BSD make. You're trying to run it with GNU make. They use different formats.
In particular, the .include command is not valid in GNU make.
Since you've tagged your question with "linux", I assume you're using Linux and not OpenBSD. The ssh version you want for Linux is the portable one, but it seems you downloaded the OpenBSD-specific one. Try http://www.openssh.com/portable.html . See the openssh front page for details on the OpenBSD/portable split releases.
Check your /etc/vimrc or /etc/virc, Comment out the set expandtab
"set expandtab " Always uses spaces instead of tab characters (et)
Using tab reedit the Makefile file. You can look also see the keywords missing separator by info make, you will see:
`missing separator. Stop.'
`missing separator (did you mean TAB instead of 8 spaces?). Stop.'
This means that `make' could not understand much of anything about
the makefile line it just read. GNU `make' looks for various
separators (`:', `=', recipe prefix characters, etc.) to indicate
what kind of line it's parsing. This message means it couldn't
find a valid one.
One of the most common reasons for this message is that you (or
perhaps your oh-so-helpful editor, as is the case with many
MS-Windows editors) have attempted to indent your recipe lines
with spaces instead of a tab character. In this case, `make' will
use the second form of the error above. Remember that every line
in the recipe must begin with a tab character (unless you set
`.RECIPEPREFIX'; *note Special Variables::). Eight spaces do not
count. *Note Rule Syntax::.

Automate VIM EDITOR and update values using shell script (similar to editing crontab via shell script)

I am trying to automate a VI edit for a command similar to crontab editing via Shell script but not working for me so far.
Here is the final json with admin as true:
'{"name":"SQLSRVR","admin":"true","json_class":"Chef::ApiClient","chef_type":"client"}'
As you can see the EDITOR environment variable has to be set or passed as command line option -e
[root#vrhost user]# knife client edit SQLSRVR
ERROR: RuntimeError: Please set EDITOR environment variable
[root#vrhost user]# knife client edit
USAGE: knife client edit CLIENT (options)
-s, --server-url URL Chef Server URL
-k, --key KEY API Client Key
--[no-]color Use colored output, defaults to enabled
-c, --config CONFIG The configuration file to use
--defaults Accept default values for all questions
-d, --disable-editing Do not open EDITOR, just accept the data as is
-e, --editor EDITOR Set the editor to use for interactive commands
-E, --environment ENVIRONMENT Set the Chef environment
-F, --format FORMAT Which format to use for output
-u, --user USER API Client Username
--print-after Show the data after a destructive operation
-V, --verbose More verbose output. Use twice for max verbosity
-v, --version Show chef version
-y, --yes Say yes to all prompts for confirmation
-h, --help Show this message
FATAL: You must specify a client name
The below command opens a vim editor for editing to make the change from ["admin": "false"] to ["admin": "true"]:
[root#vrhost user]# knife client edit SQLSRVR -e vim
{
"name": "SQLSRVR",
"admin": false,
"json_class": "Chef::ApiClient",
"chef_type": "client",
}
I am trying to do this through a shell script and would like to automate it and tried many options but had no luck so far.
[root#vrhost ~]# (echo ^[:g/false/s/false/true/^[:wq!^M) | knife client edit SQLSRVR -e vim
Vim: Warning: Input is not from a terminal
Object unchanged, not saving
or
[root#vrhost user]# echo (^[echo '{"name":"SQLSRVR","admin":"true","json_class":"Chef::ApiClient","chef_type":"client"}'^[:w q!^M) | knife client edit SQLSRVR -e
[root#vrhost ~]# knife client show SQLSRVR
admin: false
chef_type: client
json_class: Chef::ApiClient
name: SQLSRVR
this is very similar to automating crontab editing via shell script but this has not been working for me.
Unless you really need special Vim capabilities, you're probably better off using non-interactive tools like sed, awk, or Perl / Python / Ruby / your favorite scripting language here.
That said, you can use Vim non-interactively, using silent batch mode.
vim -T dumb --noplugin -n -es -S "commands.ex" "filespec"
Instead of the external script to read the commands from via -S "commands.ex", you can also give a few commands directly via -c cmd1 -c cmd2. See :help -s-ex for more information.
Check out
$ knife client edit --help
[...]
-d, --disable-editing Do not open EDITOR, just accept the data as is
So I guess you can change the values without editing in vim. Just:
get the client data in json format.
replace needed values with sed.
upload the data from file.
Code:
$ knife client show -Fj SQLSRVR > SQLSRVR.json
$ sed -i.old "s/\"admin\": true,/\"admin\": false,/" SQLSRVR.json
$ knife client edit -d SQLSRVR < SQLSRVR.json
Something like that.
Here are some links to references:
i) http://mirror.hep.wisc.edu/stable/chef/chef-server-webui/app/controllers/clients_controller.rb
ii) http://www.rubydoc.info/github/opscode/chef/master/Shell/Extensions - tried but unable to get it to work
Finally did the following (it does give 409 the 2nd time on call and I did not need to do it a 2nd time):
# call to below rb, CLIENTNAME is the name of the client and STATE is true/false
$ knife exec clienttransform.rb CLIENTNAME STATE
$ cat clienttransform.rb
Chef::Config[:solo] = false
class Company
class TransformClient
attr_accessor :clientname
attr_accessor :isclientadmin
def initialize(client_name, is_client_admin)
#clientname = client_name
#isclientadmin = is_client_admin
end
def transform
client=Chef::ApiClient.load(#clientname)
# puts "client.name : " + client.name
# puts "client.admin : " + client.admin.to_s
# puts "XX - clientname : " + #clientname
# puts "XX - isclientadmin : " + #isclientadmin.to_s
boolisclientadmin = !!#isclientadmin
client.admin(boolisclientadmin)
client.save()
end
end
end
client_name = ARGV[2].to_s()
is_client_admin = ARGV[3].to_s()
# puts "YY - client_name : " + client_name
# puts "YY - is_client_admin : " + is_client_admin
trc = Company::TransformClient.new(client_name, is_client_admin)
trc.transform
exit 0
Just set your editor and it will work. In my case I use vim editor that's why my command was as follows:
export EDITOR=vim

Git is not working with vimdiff

I am using meld with git for merging and I want to try vimdiff. Configured three way merge with git and then my own diff command:
[merge]
tool = vimdiff3
conflictstyle = diff3
[mergetool "vimdiff3"]
cmd = gvim -f -d \"$LOCAL\" \"$BASE\" \"$REMOTE\" \"$MERGED\"
But everytime I try to run mergetool, git just quickly respond "[file] seems unchanged" and skips the merge.
On top of that, I'd like to get real three-way merge (four files) with merged window in the bottom, this shold work but I saw many reports it is not working on the internet:
cmd = gvim -f -d -c \"wincmd J\" \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
You could check if the upcomming mergetools/vimdiff3 setting (for git 2.0.x Q3 2014) would work for you.
See commit 7c147b7 by Felipe Contreras (felipec), merged only recently in commit 3a9dae7 (June 2014):
mergetools: add vimdiff3 mode
It's similar to the default, except that the other windows are hidden.
This ensures that removed/added colors are still visible on the main merge window, but the other windows not visible.
Specially useful with merge.conflictstyle=diff3.
gvimdiff3|vimdiff3)
if $base_present
then
"$merge_tool_path" -f -d -c 'hid | hid | hid' \
"$LOCAL" "$REMOTE" "$BASE" "$MERGED"
else
"$merge_tool_path" -f -d -c 'hid | hid' \
"$LOCAL" "$REMOTE" "$MERGED"
fi
;;
The new file mergetools/vimdiff3 has been added, which means that all you would need to do is:
git mergetool --tool=vimdiff3
(without having to configure mergetool.vimdiff3.cmd)

Increase number recently opened file list in gedit (gnome)

I have been using gedit as a programming text editor for a while...
I would like to increase the number of recently opened files from 5 to 10...
I checked the gedit preferences and the gconf-editor gedit options but there was nothing there related to the recently opened file list.
Where can I change this setting?
The configuration setting is in /schemas/apps/gedit-2/preferences/ui/recents/max_recents according to http://people.gnome.org/~bmsmith/gconf-docs/C/gedit.html.
According to OP the setting can successfully be changed by issuing the command gconftool-2 --type int --set /apps/gedit-2/preferences/ui/recents/max_recents 10 (Notice: /schemas is removed!)
I tried the accepted answer with Ubuntu 14.04 and as pevik ran into the problem that adding that did not do anything.
Instead, I had to change the already existing key in dconf:
$ dconf write /org/gnome/gedit/preferences/ui/max-recents '20'
EDIT: Since after a restart gEdit's number of most recently used items was reduced to 5 again, I did some investigation and found bug #1024168 on Launchpad and it seems that the solution is not using dconf at all, but instead gsettings:
$ dconf read /org/gnome/gedit/preferences/ui/max-recents
20
$ gsettings get org.gnome.gedit.preferences.ui max-recents
uint32 5
$ gsettings set org.gnome.gedit.preferences.ui max-recents 25
$ dconf read /org/gnome/gedit/preferences/ui/max-recents
25
$ gsettings get org.gnome.gedit.preferences.ui max-recents
uint32 25
So, it seems that the information flow dconf -> gsettings does not work properly, while gsettings -> dconf works as expected. On a side-note: dconf claims the key to be a signed int32, while gsettings states that it is an unsigned int32...

Resources