dusko + cli   1116

Draft of the ANSI C standard - Programming Language C, X3.???-1988.
Originally posted as a comment, here is a link (http://web.archive.org/web/20030222051144/http://home.earthlink.net/~bobbitts/c89.txt) to what appears to be a draft of the former mentioned standard, the ANSI C standard. It is my understanding that the drafts can be viewed for free, as @pmg has noted as well.

. . .

3.1.3.2 Integer constants

Syntax

integer-constant:
decimal-constant integer-suffix<opt>
octal-constant integer-suffix<opt>
hexadecimal-constant integer-suffix<opt>

decimal-constant:
nonzero-digit
decimal-constant digit

octal-constant:
0
octal-constant octal-digit

hexadecimal-constant:
0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit

nonzero-digit: one of
1 2 3 4 5 6 7 8 9

octal-digit: one of
0 1 2 3 4 5 6 7

hexadecimal-digit: one of
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F

. . .

3.1.3.4 Character constants

Syntax

character-constant:
' c-char-sequence'
L' c-char-sequence'

c-char-sequence:
c-char
c-char-sequence c-char

c-char:
any member of the source character set except
the single-quote ', backslash \, or new-line character
escape-sequence

escape-sequence:
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence

simple-escape-sequence: one of
\' \" \? \\
\a \b \f \n \r \t \v

octal-escape-sequence:
\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit

hexadecimal-escape-sequence:
\x hexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit
. . .

The single-quote ', the double-quote , the question-mark ?, the
backslash \ , and arbitrary integral values, are representable
according to the following table of escape sequences:

single-quote ' \'
double-quote " \"
question-mark ? \?
backslash \ \\
octal integer \ octal digits
hexadecimal integer \x hexadecimal digits

The double-quote and question-mark ? are representable either by
themselves or by the escape sequences \" and \? respectively, but the
single-quote ' and the backslash \ shall be represented, respectively,
by the escape sequences \' and \\ .

The octal digits that follow the backslash in an octal escape
sequence are taken to be part of the construction of a single
character for an integer character constant or of a single wide
character for a wide character constant. The numerical value of the
octal integer so formed specifies the value of the desired character.

The hexadecimal digits that follow the backslash and the letter x
in a hexadecimal escape sequence are taken to be part of the
construction of a single character for an integer character constant
or of a single wide character for a wide character constant. The
numerical value of the hexadecimal integer so formed specifies the
value of the desired character.
c  programming  terminal  console  shell  xterm  cli  unix 
14 hours ago by dusko
c - Where can I find the C89/C90 standards in PDF format? - Stack Overflow
Just a little background from GCC's online documentation to help clarify what exactly the key terms are:

The original ANSI C standard (X3.159-1989) was ratified in 1989 and published in 1990. This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later in 1990. There were no technical differences between these publications, although the sections of the ANSI standard were renumbered and became clauses in the ISO standard. This standard, in both its forms, is commonly known as C89, or occasionally as C90, from the dates of ratification.

Originally posted as a comment, here is a link (http://web.archive.org/web/20030222051144/http://home.earthlink.net/~bobbitts/c89.txt) to what appears to be a draft of the former mentioned standard, the ANSI C standard. It is my understanding that the drafts can be viewed for free, as @pmg has noted as well.
c  programming  terminal  console  shell  xterm  cli  unix 
14 hours ago by dusko
Text-Terminal-HOWTO
This document was originally written for real text terminals which were like monitors (with keyboards), but could only display text with a command line interface (no pictures). They were widely used to access mainframe computers in the late 1970's and 1980's but use of them declined in the 1990's and they are seldom used anymore. However much of this howto also applies to command-line interfaces on Linux PC's which are in wide use today. It's not about the user programs one might run on the command line, but about setting up, managing, and understanding the interface itself Such as using a monitor as a virtual (text-only) console, using a text-window in a GUI such as xterm, connecting to a remote computer over a network via ssh, telnet, etc., or even using software on another PC to turn it into a serial-port text-terminal. All these 4 methods are known as "text-terminal emulation". But unfortunately, the main emphasis in this howto is real text terminals and the coverage of emulation is inadequate for the first 3 methods of emulation mentioned above. The Keyboard-and-Console-HOWTO filled much this gap but it was written for Linux 2.0 and now needs rewriting (or merging into this Text-Terminal howto). A new author is needed that has time to do all this. For the seldom used real text-terminals, it explains how they work, explains how to install and configure them, and provides some info on how to repair them. This HOWTO also provides a brief overview of modern GUI terminals.
console  terminal  commandline  cli  howto  xterm  unix 
yesterday by dusko
A day without X
Don’t wanna be a PITA, but you’re still using an xterm in all your examples :)

Hehe. I know, but I wasn’t sure how to take screenshots on the TTY.

You can make screenshot of what you run in a framebufer tty with fbgrab or fbshot.

. . .

For viewing images, as I mentioned earlier, I use fbi (through framebuffer). For videos there isn’t anything better than using some old DXR3-like card with TV output.
terminal  console  cli  shell  x11  xorg 
yesterday by dusko
Further Reading - Blessed 1.15.1 documentation
These are often written in the C language, and directly map the “Control Sequence Inducers” (CSI, literally \x1b[ for most modern terminal types) emitted by most terminal capabilities to an action in a series of case switch statements.
terminal  xterm  commandline  cli  shell  console  unix  c  programming 
2 days ago by dusko
Clear! (clear your terminal screen) | Linux.org
The Ctrl-l shortcut only works as a shortcut for the "clear" command if you have readline {see *} set to use the default emacs input option. But it doesn't work if you set the vi input mode - at least not when in edit mode.

{* NOTE: readline is a utility that is used by bash and other shells to get input from the user.}

I use the following line in my .bashrc, which puts readline into vi input mode:
Code:

set -o vi

In the vi input mode, the Ctrl+l keybind is only available when in 'command' mode. So you have to hit <esc> and then Ctrl-l. Which is not really very helpful. It would also be handy to have it available in 'insert' mode too.

The good news is - you can easily add a keybind for Ctrl-l for 'insert' mode by adding the following line to your .bashrc:
Code:

bind -m vi-insert "\C-l":clear-screen

Alternatively, instead of editing .bashrc - you could create or edit .inputrc, which is a config file used by readline:

set editing-mode vi
$if mode=vi

# Set up a Ctrl+l key-bind for vi's insert-mode
set keymap vi insert
Control-l: clear-screen

# Set up a Ctrl+l key-bind for command mode
# Note: This key-bind is already defined in vi mode
# I've put it here as an example of how to create a
# vi command-mode shortcut
set keymap vi command
Control-l: clear-screen

$endif

Either method works. I edited .bashrc because it involved less typing and because I pretty much use bash exclusively.

But if you tend to switch between using different shells.
e.g. Bash, zsh, ksh, csh etc.
Then putting the settings into .inputrc will apply those settings to ANY shell that uses readline. In other words - no matter what shell you are using, your keybinds/settings for readline will always be the same.
Whereas .bashrc only applies to bash.

There are many different bits of functionality and options available in readline. So if there are any key-binds/shortcuts to functionality that you feel you are missing in either vi or emacs mode, you can easily set up a new keyboard shortcut - as I have done for clear-screen in the vi insert mode.
xterm  terminal  x11  xorg  shell  console  cli  unix  reference  traditionalvi  vi 
2 days ago by dusko
command line - What protocol/standard is used by terminals? - Unix & Linux Stack Exchange
Properly-written Unix programs don't emit these escape sequences directly. Instead, they use one of the libraries mentioned above, telling it to "move the cursor to position (1,1)" or whatever, and the **library** emits the necessary terminal control codes based on your TERM environment variable setting. This allows the program to work properly no matter what terminal type you run it on.
xterm  terminal  commandline  cli  shell  console  x11  xorg  unix  utf8  unicode  ansi  ascii 
3 days ago by dusko
terminal - Using printf with escape sequences? - Unix & Linux Stack Exchange
Do you know that printf does not support hex backslash escapes? Your code is not portable as it relies on non-POSIX features.
xterm  terminal  cli  unix  reference 
3 days ago by dusko
ANSI Codes and Colorized Terminals
In terms of digital representation ANSI and ASCII are different sets of characters, ASCII using only 7 bits for representing a character and ANSI using 8 bits.
ansi  ascii  reference  xterm  terminal  shell  console  cli  unix 
3 days ago by dusko
The TTY demystified
Occasionally, you may come across a UNIX system where the backspace key doesn't work. This happens when the terminal emulator transmits a backspace code (either ASCII 8 or ASCII 127) which doesn't match the erase setting in the TTY device. To remedy the problem, one usually types stty erase ^H (for ASCII 8) or stty erase ^? (for ASCII 127). But please remember that many terminal applications use readline, which puts the line discipline in raw mode. Those applications aren't affected.
terminal  unix  commandline  cli  console  computing  it  history  sysadmin  x11  xorg  xterm 
4 days ago by dusko
Unprintable ACSCII characters and TTYs
What happens when typing special "control sequences" like <ctrl-h>, <ctrl-d> etc.?

For convenience, "^X" means "<Ctrl-X>" in the following (ignoring the fact that you usually might use the lower case x).

About a possible origin of the "^"-notation, see also an article in a.f.c, <62097@bbn.BBN.COM> (local copy).
ascii  ansi  xterm  terminal  cli  x11  xorg  unix 
5 days ago by dusko
Text File formats – ASCII Delimited Text – Not CSV or TAB delimited text
See http://en.wikipedia.org/wiki/Unit_separator and
http://en.wikipedia.org/wiki/Delimiter#ASCII_Delimited_Text

In summary ASCII Delimited Text is using the last 4 control characters (28-31) for their purpose as field and record delimiters and not using CSV (Comma Separated Values)
csv  tsv  ascii  data  programming  plaintext  text  terminal  cli  reference 
5 days ago by dusko
Things Every Hacker Once Knew | Lobsters
feoh (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_ysbnmg)

Now this article I can get behind! While I often find Mr. Raymond’s opinion pieces objectionable and occasionally out and out wrong, but in my view his work really shines when he strives to educate, and this article is a great example.

I wish there were a bit more depth on UUCP, but overall - great article. Thanks for posting it.

. . .

Dutch feoh (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_kxffor)

My sentiments exactly. I stopped visiting his sites a few years ago; the signal to bombast ratio was just too low for me. If it weren’t for postings on aggregators, I’d miss great articles like this.

. . .

Screwtape (Jan 27, 2017)
(https://lobste.rs/s/qph9hd/things_every_hacker_once_knew#c_e5jnti)

A TTY-related fact that wasn’t mentioned in the article:

To control text-formatting on an ANSI-compatible terminal (or emulator), you can send it terminal control sequences like \e[1m to enable bold or whatever. Paper-based terminals didn’t have control-sequences like that, but people still figured out ways to do formatting. For example, if you printed a letter, then sent backspace (Ctrl-H, octet 0x08) and printed the same letter again, it would be printed with twice as much ink, making it look “bold”. If you printed a letter, then sent backspace and an underscore, it would look underlined.

The original Unix typesetting software took full advantage of this trick. If you told it to output a document (say, a manpage) to your terminal (as opposed to the expensive typesetting machine in the corner), it would use the BS trick to approximate the intended formatting.

This worked great, up until the invention of video display terminals, where the backspace trick just replaced the original text, instead of adding to it. So people wrote software to translate the backspace-trick into ANSI control codes... software like less(1).
unix  terminal  shell  console  commandline  cli  ascii  ansi  it  computing  history  reference  rs232serialport 
5 days ago by dusko
Things Every Hacker Once Knew | Hacker News
bogomipz on Jan 27, 2017 [-]
>"It becomes immediately obvious why, eg, ^[ becomes escape. Or that the alphabet is just 40h + the ordinal position of the letter (or 60h for lower-case). Or that we shift between upper & lower-case with a single bit."

I am not following, can you explain why ^[ becomes escape. Or that the alphabet is just 40h + the ordinal position? Can you elaborate? I feel like I am missing the elegance you are pointing out.

soneil on Jan 27, 2017 [-]
If you look at each byte as being 2 bits of 'group' and 5 bits of 'character';

00 11011 is Escape
10 11011 is [

So when we do ctrl+[ for escape (eg, in old ansi 'escape sequences', or in more recent discussions about the vim escape key on the 'touchbar' macbooks) - you're asking for the character 11011 ([) out of the control (00) set.

Any time you see \n represented as ^M, it's the same thing - 01101 (M) in the control (00) set is Carriage Return.

Likewise, when you realise that the relationship between upper-case and lower-case is just the same character from sets 10 & 11, it becomes obvious that you can, eg, translate upper case to lower case by just doing a bitwise or against 64 (0100000).

And 40h & 60h .. having a nice round number for the offset mostly just means you can 'read' ascii from binary by only paying attention to the last 5 bits. A is 1 (00001), Z is 26 (11010), leaving us something we can more comfortably manipulate in our heads.

I won't claim any of this is useful. But in the context of understanding why the ascii table looks the way it does, I do find four sets of 32 makes it much simpler in my head. I find it much easier to remember that A=65 (41h) and a=97 (61h) when I'm simply visualizing that A is the 1st character of the uppercase(40h) or lowercase(60h) set.
unix  terminal  shell  console  commandline  cli  ascii  ansi  it  computing  history 
5 days ago by dusko
Back to the Future: Using a DEC VT220 from 1983 | iSticktoit.net
Where is the freakin‘ Esc key!?

That is the one thing that buggs me: As vi user, I heavily depend on the ESC key, but the VT220 doesn’t have one. In VT100 mode, using F11 is quite simple, but you’ll miss out on the enhancements made in the VT220. CTRL-3 is the only way to generate a raw ESC character there. As many other people have done before me, I remapped ESC to jj (http://vim.wikia.com/wiki/Avoid_the_escape_key) or TAB in vim.
vt100  vi  terminal  console  shell  commandline  cli  xterm  x11  xorg  computing  it  history  unix  vim  traditionalvi 
6 days ago by dusko
vt220 ESC key -- how to, if it doesn't? - Google Groups
> A used vt220 we just acquired does not send ESC when the
> usual function key (F11?) is pressed, despite our best
> "there's-got-to-be-a-way-right?" efforts with the setup menus.

There are (I think) three ways:

(1) Get rid of all brain-damaged software that thinks that hooking to
the escape key is a good idea. ESC is for computer->terminal
interactions, not for fucking around to make a 'neato keen'
program that won't work on _the_ industry standard ASCII terminal.

(2) Press <ctrl> and '[' simultaneously.

(3) [not verified] Set the terminal to 'vt100' mode; the F11 key will
then work.
vt100  terminal  xterm  x11  xorg  cli  unix  it  computing  history 
6 days ago by dusko
Convert maildir to mbox
So how did I convert the maildir to mbox? I used formail which is provided by procmail.

for i in maildir/cur/*;do formail -I "Status: RO" <"$i" >>mbox;done
for i in maildir/new/*;do formail -I Status: <"$i" >>mbox;done

You will want to do that for each maildir (don’t forget the .Subfolder directories). And remember each “folder” or maildir would be a different mbox file. So if you wanted to save sent mail as well …

for i in maildir/.Sent/cur*;do formail -I "Status: RO" <"$i" >>sent;done
for i in maildir/.Sent/new/*;do formail -I Status: <"$i" >>sent;done
mailserver  email  reference  howto  terminal  cli  shell  unix  script  sysadmin 
8 days ago by dusko
tmux - Making vim use the alternate screen - Super User
Confirm this as follows (remember that ^[ must be entered as a control character, e.g. Ctrl-v followed by Escape):

less /etc/hosts # should use alternate screen (desired)

less -X /etc/hosts # should leave it's output on screen (undesired)

echo -n "^[[?1049h"; less -X /etc/hosts; echo -n "^[[?1049l"
# should use alternate screen (desired)

If that last command gives the desired behaviour with less. Try the same approach with vim:

echo -n "^[[?1049h"; vim /etc/hosts; echo -n "^[[?1049l"
# should use alternate screen (desired)
xterm  terminal  tmux  screen  vim  vi  cli  x11  xorg  unix  script  reference  howto 
8 days ago by dusko
linux - Using the "alternate screen" in a bash script - Stack Overflow
For C console application:

ncurses

Wikipedia:

ncurses (new curses) is a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner.

less uses this library.

A hello world program from here, to compile it in gcc, flag -lncurses is needed.

#include <ncurses.h>

int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */

return 0;
}
xterm  terminal  unix  bsd  linux  x11  xorg  cli  reference 
13 days ago by dusko
How to make Less indicate location in percentage - Stack Overflow
man -P 'less -s -M +Gg' man

This can be effected permanently by putting

export MANPAGER='less -s -M +Gg'

in one of your shell configuration files (above syntax is for Bash and ZSH). Now, for example, man man displays the percentage as you wanted!
Warning

You should not put the +Gg in the LESS variable! For example, doing

export LESS='-M +Gg'

will cause problems when reading very large files. For example,

yes | LESS='-M +Gg' less

does not work very well.
unix  commandline  cli  terminal  shell  reference  tips 
14 days ago by dusko
True Colour (16 million colours) support in various terminal applications and terminals · GitHub
Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

Plain ASCII
ANSI escape codes: 16 color codes with bold/italic and background
256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
24-bit true color: "888" colors (aka 16 milion)

...

Terminals that parse ANSI color sequences, but approximate them to 256 palette

xterm (but doing it wrong: "it uses nearest color in RGB color space, with a usual false assumption about orthogonal axes")
terminal  xterm  shell  cli  colour  reference  ansi  ascii 
14 days ago by dusko
ANSI Escape Codes
ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

Ctrl-Key: ^[
Octal: \033
Unicode: \u001b
Hexadecimal: \x1b
Decimal: 27

Followed by the command, usually delimited by opening square bracket ([) and optionally followed by arguments and the command itself.

Arguments are delimeted by semi colon (;).
ansi  ascii  commandline  cli  shell  terminal  xterm  x11  xorg  reference 
14 days ago by dusko
Backup script with tar | The FreeBSD Forums
...

Depending on the filesystem I think you should also seriously look into dump(8) and restore(8). There are some serious advantages over using those two instead of a tarball.

For example (the main reason I personal favor it): support for incremental backups as well as interactive restores. When I need a file from a dump dump (some pun intended ;)) I merely use restore with the -i parameter. I then use the normal commands I'm used to for navigating through a Unix filesystem (cd, ls, etc.) and when I found the file I need I tag it and start the restore.

That beats having to think about using tar correctly to dig up one specific file (or a directory, or..).

Maybe food for thought?

Obviously: this only works when you're using UFS. When using ZFS then you shouldn't be using tar in the first place in my opinion, because there are much better (and more efficient) ways than this.

...

There are some, not so obvious, caveats when using ZFS's send/receive. The most important one is not being able to restore the files to non-ZFS fileystems (at least not without using a ZFS intermediate). The same could be said for dump/restore (it only works on UFS). In this respect a tar(1) archive is more general and can be unpacked on most, if not all, systems. As with pretty much all things UNIX, there's more than one way to skin a cat.
backup  shell  script  tar  freebsd  zfs  reference  cli  unix 
15 days ago by dusko
What's the correct way to use ANSI escape sequences to edit terminal content "in place"? - Unix & Linux Stack Exchange
The behavior on \e[2J differs across terminals. Some, e.g. Xterm clear the screen as you expect.
xterm  terminal  cli  ansi  ascii  x11  xorg  tips 
15 days ago by dusko
Alternate screen buffer in Xterm/FreeBSD - Google Groups
...
As Tom Dickey already mentioned, \e[?1049 better reflects the combined
save-cursor, clear-screen and change-to-alternate operations.
xterm  terminal  cli  x11  xorg 
15 days ago by dusko
#2633 (Subshell don't save the output of the commands (ctrl+o clear the terminal)) – Midnight Commander
@Zmiter, as correctly identified by @fjoe:

The problem is that "ti" and "te" capabilities are missing in FreeBSD xterm (they are specified only for TERM=xterm-clear).

So there are 3 possibilities: (1) FreeBSD fixes xterm, (2) FreeBSD carries a patch for mc, or (3) we integrate the patch and make sure it's active only on FreeBSD (Andrew has just proposed such a patch).
xterm  terminal  cli  x11  xorg  freebsd 
15 days ago by dusko
FreeBSD SSH terminal windows - Super User
...
Replace :tc=xterm-new: with :tc=xterm-clear: so that it says:

xterm-256color|xterm alias 3:\
:Co#256:pa#32767:\
:AB=\E[48;5;%dm:AF=\E[38;5;%dm:tc=xterm-clear:

Then run:

cap_mkdb -f /usr/share/misc/termcap /etc/termcap
xterm  terminal  cli  x11  xorg  freebsd 
15 days ago by dusko
TERM=xterm lacking smcup and rmcup (alternate screen) - Google Groups
Hello
I want to criticize an approach taken in FreeBSD regarding the
alternate screen. It's not available in newcons. One person wrote
that's because Tekken doesn't have such feature, and newcons
implements Tekken.

That's maybe fine. However, newcons doesn't have it's own termcap. It
uses TERM=xterm, which normally has rmcup and smcup. Some smart person
thus decided to remove those codes from TERM=xterm. You see what this
leads to? No alternate screen on X11.

Why doesn't newcon create it's own termcap entry? Why nobody cares
about trashed xterm screens when fullscreen applications are exiting.
In my software I've wrote a special function to handle FreeBSD nuance (https://github.com/psprint/zsh-cmd-architect/blob/master/zca#L65-L81):

---- snip ----
# Reason for this function is that on some systems
# smcup and rmcup are not knowing why left empty
_zca_alternate_screen() {
[ "$_zca_has_terminfo" -ne "1" ] && return
[[ "$1" = "1" && -n "$terminfo[smcup]" ]] && return
[[ "$1" = "0" && -n "$terminfo[rmcup]" ]] && return

case "$TERM" in
*rxvt*)
[ "$1" = "1" ] && echo -n $'\x1b7\x1b[?47h'
[ "$1" = "0" ] && echo -n $'\x1b[2J\x1b[?47l\x1b8'
;;

By: Sebastian Gniazdowski
06/01/2016
xterm  terminal  cli  x11  xorg  freebsd 
15 days ago by dusko
Xterm 'alt screen' behavior - Google Groups
It's all designed to work together; if you are using the termcap-only version of titeInhibit, it does indeed not work well, since titeInhibit cannot modify the terminfo to get rid of the ^[[2J.
xterm  terminal  cli  x11  xorg  reference  tips 
15 days ago by dusko
unix - What commands can I use to reset and clear my terminal? - Super User
Use the right tool for each job:

Use clear to clear the terminal window.

Use reset to reset your terminal when it gets messed up by control sequences.

Use cat only when you want to stream a whole lot of data from one place to another uninterrupted.

Use a pager program such as less or most to view pages of output.

Use tail -f /var/log/foo.log /var/log/bar.log to watch several different log files.

With GNU tail, the -F option is better because it can continue following the file even when a new file appears in its place, as is common for log files.
unix  terminal  cli  x11  xorg  xterm  bsd  linux  freebsd 
16 days ago by dusko
vim - TERM=(linux|xterm) vi in an xterm or the AAABBBBBBCCDDD-problem - Unix & Linux Stack Exchange
$ infocmp -1 linux | grep smkx
$ infocmp -1 xterm | grep smkx
smkx=\E[?1h\E=,
$ infocmp -1 konsole | grep smkx
smkx=\E[?1h\E=,
vi  traditionalvi  vim  xterm  x11  xorg  cli  terminal 
16 days ago by dusko
How to clear the screen after exit vim - Stack Overflow
(From comp.editors, by Juergen Weigert, in reply to a question)

:> Another question is that after exiting vim, the screen is left as it :> was, i.e. the contents of the file I was viewing (editing) was left on :> the screen. The output from my previous like "ls" were lost, :> ie. no longer in the scrolling buffer. I know that there is a way to :> restore the screen after exiting vim or other vi like editors, :> I just don't know how. Helps are appreciated. Thanks. : :I imagine someone else can answer this. I assume though that vim and vi do :the same thing as each other for a given xterm setup.

They not necessarily do the same thing, as this may be a termcap vs. terminfo problem. You should be aware that there are two databases for describing attributes of a particular type of terminal: termcap and terminfo. This can cause differences when the entries differ AND when of the programs in question one uses terminfo and the other uses termcap (also see +terminfo).

In your particular problem, you are looking for the control sequences ^[[?47h and ^[[?47l. These switch between xterms alternate and main screen buffer. As a quick workaround a command sequence like
echo -n "^[[?47h"; vim ... ; echo -n "^[[?47l"
may do what you want.

(My notation ^[ means the ESC character, further down you'll see that the databases use \E instead).
xterm  x11  xorg  vi  traditionalvi  vim  commandline  cli  terminal  tips  reference 
16 days ago by dusko
Why doesn't the screen clear when running vi? - XTerm FAQ
This refers to the __"alternate screen"__ feature, which has been used in its __termcap__ file since 1988. On various systems, this feature may have been removed, although it has always been in the xterm sources.
xterm  x11  xorg  traditionalvi  vi  commandline  cli  terminal  tips  reference 
16 days ago by dusko
« earlier      
per page:    204080120160

related tags

android  ansi  applemacosx  archive  ascii  authentication  automation  awk  backup  bash  bhyve  blog  book  bsd  build  c  c.h.i.p.  calendar  centos  chart  cheatsheet  checklist  cli  clipart  clone  cloning  cloud  coding  colour  commandline  computing  config  configurationmanagement  console  cron  csh  csv  data  dataanalysis  database  dd  devops  diagram  disasterrecovery  dns  documentation  dotfiles  dragonflybsd  dump  ebook  ed  editor  electronics  emacs  email  encryption  ex  finance  fonts  free  freebsd  games  go  graph  grep  gtd  hardware  history  howto  html  http  humour  images  imap  infographics  internet  iscsi  it  java  javascript  journal  keyboard  ksh  kvm  latex  ldap  learning  lifehack  lifemanagement  linux  log  lvm  mac  mail  mail(1)  mailserver  mailx  maps  mariadb  markdown  markup  media  mh  monitoring  mta  mutt  mysql  netbsd  netcat  networking  nmh  notebook  openbsd  opensource  pdf  performance  perl  photos  php  pictures  plaintext  pomodoro  postmaster  postscript  presentation  printing  privacy  productivity  programming  projectmanagement  python  qemu  raspberrypi  reading  recovery  reference  regex  research  restore  rhel  rs232serialport  rsnapshot  rsync  ruby  samba  screen  script  security  sed  sendmail  server  sh  shell  smtp  snapshot  software  spam  ssh  ssl  staticsitegenerator  storage  svg  sync  sysadmin  tar  tcpdump  tcsh  technicalwriting  terminal  tex  text  texteditor  timemanagement  timetracking  tips  tls  tmux  tool  traditionalvi  tsv  tutorial  unicode  unix  utf8  versioncontrol  vi  vim  virtualization  visualization  vm  vmware  vpn  vt100  web  webbrowser  webdevelopment  windowmanager  windows  wm  wordpress  writing  x11  xorg  xterm  zfs  zimbra  zsh 

Copy this bookmark:



description:


tags: