Thursday, December 29, 2016

Re: Vim ... after new line start at possition and after start

On 2016-12-29, Martin Lindkvist wrote:
> Hello guys,
> I have tried to figure this out now for a while and is getting crazy.
>
> I need vim to put the marker 7spaces in when i push enter for a new line.
>
> _______|text goes here...
>
> And i need vim to start counting the tabs from that position as well.
>
> _______|<-tab-><-tab-><-tab->
>
> For now i get it to make tabs 4space but then the tabs after the marker gets placed 1 space wrong.
> like so.
> _______| <tb><tb><tb>
> <tb><tb> <tb><tb><tb>
>
>
> This is because i am programming cobol :/ and the first 7 chars is used for other things than code.
>
>
>
> I want it to be as this:
> _______|<return>
> _______|
>
> _______|some text <return>
> _______|
>
>
> for now i have this :
> set tabstop=4
> set expandtab
> set shiftwidth=4
> set autoindent
> set colorcolumn=7
>
> But it makes the first tabs to start at one space wrong
>
> Here is some cobol if you see my problem better that way :)
> ##########
> IDENTIFICATION DIVISION.
> * This is a comment
> 000001 PROGRAM-ID. YOUR-PROGRAM-NAME.
> 000002 DATA DIVISION.
> FILE SECTION.
> WORKING-STORAGE SECTION.
> PROCEDURE DIVISION.
> MAIN-PROCEDURE.
> DISPLAY "Hello world"
> STOP RUN.
> END PROGRAM YOUR-PROGRAM-NAME.
> ##########

If you have 'tabstop' set to 4, and you open a new line with the
cursor in the first column, column 1, then typing Tab once will
move the cursor to column 5 and typing Tab again will move it to
column 9. It looks like you want to begin typing code at column 8.
To do that using tabs, you will need to set 'tabstop' to 7.

Alternatively, you could use the indent/cobol.vim plugin that comes
with Vim. It will take care of proper COBOL indentation for you.
Just have

filetype indent on

somewhere in your ~/.vimrc. See ":help filetype-indent-on".

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment