Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Some people use a mapping that turns search highlighting off and on, but I don’t like that solution. It means I have to remember to turn it back on later once I’ve probably already forgotten about the original search.

:nohlsearch removes highlighting, doesn't modify search history, and also doesn't disable highlighted search. It will still highlight matches for the next search.

  > nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:let @/=''<CR> 
I'm curious why not just use `ViB:sort`?

> When I press return, create a new line at the same indentation level as the current one. Don’t try to be clever and adjust the indent of new line in any fashion.

  set autoindent nosmartindent nocindent
Wrap it in a filetype line if you like.


> I'm curious why not just use `ViB:sort`?

Because we use LessCSS[1] which lets you nest selectors:

    body {
        color: #151515;
        background-color: white;
        
        a {
            color: red;
        }
    }
When I sort the "body" properties I don't want it to break up the stuff nested under it.

I'll give the indent settings a try, thanks!

[1]: http://lesscss.org/




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: