ahmadexe's blog

By ahmadexe, history, 3 days ago, In English

Sublime randomly stops indenting on new line and cursor starts pointing onto first character of the line instead of continuing indent. Since I am using a snippet, when I press tab to reintroduce the indentation, the tab actually moves my cursor to the end. (see video) https://www.youtube.com/watch?v=2jljt4HbwGc (issue on 29 sec) Happens on line 14

This behavior happens randomly. Also with simple declarations and even calling out functions. No idea why it happens. I don’t have much idea with indentation settings, please let me know which configuration is right one for C++ competitive programming

Here is my sublime preferences file

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
3 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Yes sometimes the cursor skipping to end of file frustates me too

»
3 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

for eg. If you use three placeholders like $1, $2, and $3, the last one should be $0. This happens because it’s trying to find the last placeholder, which is actually $0. Let me know if it works!

»
3 days ago, # |
  Vote: I like it 0 Vote: I do not like it

If you use brackets in your loops it will work fine like this:

    for(int i =0; i < n; i++) { 
        cin >> a[i]; 
    } // pressing enter takes you 
    // here

Or you can press enter once after your for loop declaration, like this: (For this I believe you should have smart_indent = on)

    for(int i =0 ; i < n; i++) //pressing enter here takes you to here1
        // [here1]
        cin >> a[i]; //pressing enter here would take you to here2
    //[here2]

Or if you stop having one-line for-loops the problem goes away lol

This indent problem only happens in the line after the next line of loop declaration (with smart indent off) and occurs in the line after the loop declaration (with smart indent on)

i too face the same problem im just used to it now lol. i automatically press tab once after one-line loops

  • »
    »
    16 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, thanks for your tips. I have turned smart indent back on Now it has resolved my aforementioned issue. But as you stated, it does mess up my indentation after for loops in a single line. So, will do something like this from now on:

    for (int i = 0; i < n; i++) 
        cin >> a[i];