LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-01-2020, 05:11 AM   #1
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Rep: Reputation: 16
Question GVIM identification problem


Hi,

I have the following TCL script:

Code:
foreach bbox [get_property $var bbox] {
       set xy1 [lrange $bbox 0 1]
          set xy2 [lrange $bbox 2 3]
    ruler "\{\{${xy1}\} \{${xy2}\}\}"

}
After identification with GVIM (gg=G) The first line inside "foreach", shifted by 1 TAB and the other by 2 TABS.


Example after Identification:
Code:
foreach bbox [get_property $var bbox] {
set xy1 [lrange $bbox 0 1]
    set xy2 [lrange $bbox 2 3]
    ruler "\{\{${xy1}\} \{${xy2}\}\}"

}
The script should looks like:

Code:
foreach bbox [get_property $var bbox] {
    set xy1 [lrange $bbox 0 1]
    set xy2 [lrange $bbox 2 3]
    ruler "\{\{${xy1}\} \{${xy2}\}\}"

}

How can I fix it?

Additional question,
how can I determine where GVIM window will be open?
I want the window to be open always in the upper-left corner.


Thanks for you help

Last edited by DoME69; 04-01-2020 at 09:00 AM.
 
Old 04-01-2020, 05:30 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,992

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Additional answer:
Code:
gvim -geometry +0+0
To indentation: I think that is configurable and language specific, so first you need to be sure if the correct language is detected/selected and also probably need to be configured. See here: https://vim.fandom.com/wiki/Indenting_source_code
 
Old 04-01-2020, 06:34 AM   #3
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
I see GVIM identify the file as TCL.
I tried also to set the syntax as tcl but still, the first line after the foreach/if shifted by 1 TAB and the other by 2 TABS.

the below command also tried and not achieved good results.
Code:
autocmd FileType tcl setlocal shiftwidth=1 tabstop=1
 
Old 04-01-2020, 06:53 AM   #4
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
Isn't there a bracket mismatch in the first line?
Quote:
Originally Posted by DoME69 View Post
foreach bbox [get_property $var] bbox]
 
Old 04-01-2020, 07:20 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,992

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
for me gvim 8.0 worked as expected without any additional configuration
 
Old 04-01-2020, 09:00 AM   #6
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
I tried GVIM 8.2 and it behave the same.
Still the first line after foreach/if with 1 TAB and other with 2 TABS
 
Old 04-01-2020, 09:01 AM   #7
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by shruggy View Post
Isn't there a bracket mismatch in the first line?
Sorry, a copy problem.
fixed in the original thread.
 
Old 04-01-2020, 09:45 AM   #8
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by DoME69 View Post
How can I fix it?
I wonder (don't know tcl all that well) if it would help vim if the first accolade was on a line of its own, like
Code:
foreach bbox [get_property $var bbox]
{
It just may be that vim doesn't recognize it with IT being trailing and the closing one on its own line.
 
Old 04-02-2020, 12:32 AM   #9
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by ehartman View Post
I wonder (don't know tcl all that well) if it would help vim if the first accolade was on a line of its own, like
Code:
foreach bbox [get_property $var bbox]
{
It just may be that vim doesn't recognize it with IT being trailing and the closing one on its own line.


I tried and it behave the same

Code:
foreach bbox [get_property $var bbox] 
{ 
    puts yoyo
        puts ooo
        puts rrrr
}

The problem happen also when I'm writing script and press Enter to get a new line.
I see that the first line shifted by 1 Tab and after additional Enter it shifted by 2 Tabs.
Means, its configuration problem but how can I identify and fix it?

I tried to load gvim without any external configuration (.gvim.rc)
but still I get the same behaivor
Code:
foreach c [get_ports $kluku] {
	set a "kuku"
		set y "popo"
		set uuu "ioioi"
}
 
Old 04-02-2020, 01:20 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,992

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
I would still suggest you to check the link I posted: you will see how can it be configured, what kind of possibilities are available.
 
Old 04-02-2020, 01:54 AM   #11
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pan64 View Post
I would still suggest you to check the link I posted: you will see how can it be configured, what kind of possibilities are available.
I looked the link you sent and try some commands in interactive mode and still the same behavior.
 
Old 04-02-2020, 02:00 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,992

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Yes, but as I wrote it works for me, so most probably your configuration is different from mine. You can try a different gvim installation or reinstall too (and purge .vim*), but probably would be easier to find the reason... Unfortunately it is not that simple.
 
Old 04-02-2020, 04:45 AM   #13
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Original Poster
Rep: Reputation: 16
I already download GVIM 8.2 and it behave the same.
when loading GVIM, is it read default files from default location?

maybe I have local files that set identification.

Can you share which configuration you use?
 
Old 04-02-2020, 05:23 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,992

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Something like these:
Code:
~/.vimrc    # < file
~/.viminfo  # < file
~/.vim      # < dir
 
Old 04-02-2020, 05:42 AM   #15
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
Does setting a modeline also not work? Something like
Code:
# vim:ai sw=2 sts=2 et nocin nolisp nosi ft=tcl:
at the end of your script.

Last edited by shruggy; 04-02-2020 at 05:58 AM.
 
  


Reply

Tags
gvim, tcl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Proposed enhancement for gvim.desktop (package xap/vim-gvim). Didier Spaier Slackware 3 10-02-2016 11:48 AM
GVIM problem naveenisback Ubuntu 2 11-11-2009 10:52 PM
gvim problem RudraB Linux - Software 0 04-03-2008 06:52 AM
gvim view problem septanla Ubuntu 3 06-06-2005 11:01 PM
Problem in GVIM menu Font isarathkumar Linux - Software 0 07-11-2003 12:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration