How to insert a character when editing a file using ISPF Edit via TN3270? - mainframe

The editor in mvs3.8 TK4- is very different from the editors that I have used in Windows and Linux. I am trying to figure out how to insert a character between two characters in the editor. For example:
//HERC01C JOB (COBOL),
If i want to insert an O after C to //HERC01CO JOB (COBOL), the only ways i can do are by backspacing from the end of the line upto C and type everything after that again; or by moving all the characters to a position to the right using )1 command and the typing over everything form the beginning till C. Is there a way to add O here after C so that it will insert O and automatically move all the characters after that one place to the right?

I am presuming you are using the ISPF editor
enter nulls on in the command line. This will convert trailing spaces to nulls
if the line is full, you will need to split it
position cursor where you want to enter the new character
Make sure you are in insert mode the insert key swaps between insert and over-write modes.
Type the character.

Related

How to use space without deleting text when editing a dataset

I am editing datasets on a mainframe via x3270. However I cannot figure out how to move text forward, I simply just want to be able to move text forward when pressing space without deleting any characters. How?
If the line you are trying to shift has trailing spaces then I would expect you to be able to insert spaces with no issues. If for some reason you have hex data such as X'0A' in your data then this could prevent you being able to insert. For instance
/* data */ hi
65488A8456044448844444
1C041310C1A00008900000
In the above you could not insert anywhere prior to the X'0A'. However you could insert in front of 'hi'. Check the hex values on the line where you are trying to insert characters.
I read elsewhere that there is a setting in x3270 to let x3270 treat trailing blanks as nulls, thus enabling the insertion of characters even when ISPF editor is set to nulls off. Look at x3270 menu "Options -> Toggle -> Blank Fill". See here x3270 blank fill
If this setting is not enabled, then x3270 is behaving as expected with respect to trailing spaces and insert mode: You can't shift trainling blanks. You need to set nulls on in ISPF editor command line. See NULLS ISPF editor command. Note that this setting is per ISPF editor profile. ISPF editor keeps one profile per RECFM and low level qualifier.

Commenting several lines in vim not working

All the instructions I see say pretty much the same thing here
What's a quick way to comment/uncomment lines in Vim?
First, go to the first line you want to comment, press CtrlV. This will put the editor in the VISUAL BLOCK mode.
Then using the arrow key and select until the last line
Now press ShiftI, which will put the editor in INSERT mode and then press #. This will add a hash to the first line.
Then press Esc (give it a second), and it will insert a # character on all other selected lines.
When I pretty shift+I, the multiple highlighting of lines disappears, and all that happens is that it goes into regular insert mode at the first line only. When I type something, it's only typed on the first line.
I feel that there is a step missing, but I can't figure out what.

How to remove text from before a cursor to start of line in visual mode in vim?

I've recently begun challenging myself in VIM and slow to get around still. Suppose I have the following:
1 ewdawdawdeditor you can scroll the
1 page, move the cursor, delete lines, insert
2 characters, and more, while seeing the
3 results of your edits as you make them.
My cursor is on 1,1 and after vfe its on 1,10.
How can I delete the text before the cursor to the beginning of the line without pressing hd?
If your goal is to simply select from the beginning of the line up to but not including the first "e", you can use vte instead of vfe. Then you can press d to delete.
Alternatively, you can delete without entering visual mode with dte.
To the extent of my knowledge, I don't think there is a way to delete everything in a visual mode selection excluding the last character.
If the cursor is somewhere at the middle of a line and you want to delete from the the beginning until the cursor just go with :
d^
If you really want to go visual before deletion, you can use :
v^d

Is it possible to simultaneously get the contents of a visual selection into a register and replace all the characters?

Consider the following text file.
Replace and yank this portion Ignore this portion
Suppose I have visually selected the part that says Replace and yank this portion.
I can take one of the following actions at this point.
I can use y to yank the contents into a register, but this destroys the visual selection.
I can use rx to replace each of the characters with an x, but this also destroys the visual selection.
Is it possible to simultaneously put the visual selection into a register and replace each of the characters in the visual selection with an x?
That is, I'm looking for a sequence of commands that result in the selected text being in a register, and each character in the selected text replaced by x. I'm not picky about which register.
Immediately after posting this question, I realized that all I needed was to be able to re-select the text that was just selected.
A quick Google search led to using gv for re-selection.
Thus, the final command sequence to achieve the desired effect is ygvrx. This will first yank the sequence into the register, re-select the previous selection, and then replace the characters.
Visually select the text and press c for change. Type the text you want and press <esc>. The text that was there before (in this case Replace and yank this portion) is now in your "" register, so you can just hit p as soon as you want to paste it.
type :h reg to see a list of all registers and what text you have inside them.

Vim select the ends of multiple lines (block mode, but where the ending column varies)

Is there any way in vim that I can select the end of all these lines? (I'm only showing the end of the lines in these screenshots).
In block mode I can get them all if the bottom line is longer than the rest, but if the bottom line is shorter, the longer lines are truncated.
EDIT | I guess I can just pad out the bottom line with spaces before I select, then delete the spaces later.
Put your cursor on the top-left character you want to be part of the block.
Enter block selection mode with ctrl+v
Select to the end of the line with $ (this is the step you're missing; if you move to the end of the first line using $ then the selection will extend to the end of subsequent lines as well)
Move down 3 lines with 3j
There's more information in the Vim documentation's section on visual mode which you can read online, or just type :help v_$ in Vim.
Click somewhere (anywhere) in the first line you wish to append text to.
Press Control + V.
Press Down to create an arbitrary vertical block selection that spans the desired lines.
Press $ to expand the visual block selection to the ends of every line selected.
Press Shift + A to append text to every selected line.
Type the text you want to append.
Press Escape and the text will be appended across the selected lines.
Alternately, you can set the virtualedit (:h 'virtualedit') setting so that, any time you're in visual block mode, you can move the cursor around even past the ends of lines. E.g. :set virtualedit=block.
If you're looking to select the very last character of every line, like if you want to add something after the quotes at the end of each line, you can do the following:
Put your cursor over the very last character (in this example, the last quote on the first line)
Enter block mode: control + V
Move down to select as many lines as you want to change.
Insert at the end of the line: shift + A
Type what you want to add and then exit Visual mode
You text should now be inserted at the end of each selected line!
Hope this is helpful to others like me searching for an answer similar, but not exactly the same, as the above.
I don't know if is a new thing. But if you press $ two times (instead one) the block goes to the end of all lines without creating extra spaces).
Tested on nvim 0.7.2.

Resources