Skip Navigation

User banner
Posts
17
Comments
214
Joined
2 yr. ago

  • You can set the tabstop with less -x*n*. But ok I see what you mean. I still stand by my point though. If termux doesn't support setting tabstops and it's an issue, then it's a bug in termux, not a reason to level down your formatting standard.

  • I personally favor code readability over patch readability. But I reckon this is a matter of preference so I can understand how you might not like that.

  • What's your point ? You can use vim on termux and set the tabsize to whatever you want for example.

  • I agree that it's hard, but not impossible. This usually boils down to how Nazi people are when merging code. In a corporate environment, nobody gives a damn so yeah you gotta use whatever you want because there are already different indentation systems within the same file anyway :)

    But hey, you gotta live by the changes you want to see happen, so I personally put a lot of effort in formatting my code regardless.

  • I understand your point of view. Personally I either copy the previous line and replace the arguments there, or insert X number of space using the repetition feature of my editor. It also has a feature that will align multiple cursors together with the "farthest" one using space, which is a killer feature for me! (See this presentation video @1:40).

  • You might not understand how to do it properly so here's the idea:

    Tabs will let you reach the indentation level of the current block, then from here, you'll use spaces to align stuff property. Here's an example, where >••• are tabs (I'm exaggerating alignment for the sake of the example) :

     
        
    >•••if (condition1 == true
    >••• || condition2 != false)
    >•••{
    >•••>•••struct ident people[] = [
    >•••>•••>•••{
    >•••>•••>•••>•••.name   = "bob",
    >•••>•••>•••>•••.pubkey = "value1",
    >•••>•••>•••},
    >•••>•••>•••{
    >•••>•••>•••>•••.name   = "alice",
    >•••>•••>•••>•••.pubkey = "value2",
    >•••>•••>•••}
    >•••>•••];
    >•••>•••secureConnection(people[0].name, people[0].pubkey,
    >•••>•••                 people[1].name, people[1].pubkey,
    >•••>•••                 CRYPTO_ALGO_DEFAULT);
    >•••}
    
      

    As you can see, everything will stay correctly aligned as long as it's within the same block.

  • To each their own indeed. But my rule of thumb is: only use tabs when there's no other character before it (aka, start of line).

  • When I talk about alignment it's not about function arguments, but values, "=" signs and such. You simply cannot use tabs for that because alignment must be fixed and indentation independent:

     
        
    CreateOrderRequest(
        user,
        productDetails     => order.detail,
        pricingCalculator  => DEFAULT_CALCULATOR,
        order              => order.internalNumber)
    
      
  •  
        
    struct Ident arr = [
    {
    .id
    = 0,
    .name
    = "Bob",
    .pubkey
    = "",
    .privkey
    = ""
    },
    {
    .id
    = 1,
    .name
    = "Alice",
    .pubkey
    = "",
    .privkey
    = ""
    }
    ];
    
      
  • Or just set tabsize to 9, that's the point :)

  • Tabs for indent, spaces for alignment. This is the way, I can't believe people are still fighting that ?

  • Because other people might have restricted environment which might not suit their preference is not a good reason to level it down IMO.

    Also, I think 9 is the best size for indent (matter of preference), do you think I should switch to space so everyone can enjoy this wonderful view I have ?

  • Protip, set the LESS environment variable to define the default options.

  • That's what the POSIX spec is for. BSD and GNU commands may differ, but they both support what's specified by POSIX. By limiting your calls to it, you can write portable script with no problem (I've been doing that for the last few years without issue).

  • Forgot a word sorry. I said pressing TAB or Alt+I are the same thing. But I was mistaken, it's tab and Ctrl+I.

  • I think pressing TAB sends Alt+I to the terminal so yeah.

  • You mean

     
        
    cd a
    pushd b
    pushed c
    popd
    popd
    
    
      

    Right ?

    Depending on your shell, pushd/popd might not be an option. For a similar functionality, I like to use a subshell which is portable across all shells:

     
        
    cd a
    $SHELL
    cd b
    cd c
    # do work here
    ^D
    # you're back in "a"
    
    
      
  • Disabling it is fine indeed, but I saw many comments advising to block outbound traffic, so I warned against that.