Question: Here is my code which sorts the string on the basis of frequency of chars.

```cpp
string frequencySort(string s) {
        unordered_map<char,int> umap;

        for (int i=0 ; i<s.size() ; i++) 
            umap[s[i]]++ ;

        sort (s.begin() , s.end() , [umap] (char a , char b) {
            if (umap[a] == umap[b]) return a>b ;
            return umap[a]>umap[b] ;
        }) ;

        return s ;
    }

```

I'm getting this error:

```none
Line 11: Char 21: error: no viable overloaded operator[] for type 'const unordered_map<char, int>'
            if (umap[c] == umap[d]) return a>b ;
                ~~~~^~
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unordered_map.h:984:7: note: candidate function not viable: 'this' argument has type 'const unordered_map<char, int>', but method is not marked const
      operator[](const key_type& __k)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unordered_map.h:988:7: note: candidate function not viable: 'this' argument has type 'const unordered_map<char, int>', but method is not marked const
      operator[](key_type&& __k)
      ^

```

Answer: 
Configuring Vim is not the kind of one-time task you start on Monday at 2:00PM and finish at 4:00PM. Configuring Vim is something that is done as you go, as your needs and proficiency evolve, and something you learn to do as part of your learning process… just as you are supposed to learn how to provision your VM so that it has everything you need when you start it.

> 
> It's very painful to config vim.
> 
> 
> 

It is not. The language is as simple as it gets (`set optionname=value`) and very thoroughly documented.

> 
> My working language is C/C++ under linux.
> 
> 
> 

Then you may have some specific needs you may want to ask about?

> 
> Every time I start a new VM, I need config vim.
> 
> 
> 

Not if you know how to provision a VM or configure Vim. Both things require a bit of learning.

> 
> If I google vim config, there could be hundred of configurations for it.
> 
> 
> 

Why would you do that? You are supposed to configure your tools to suit your needs, not use other people's config. It is *your* Vim config.

> 
> It's really frustrating I need spend a few hours or more to config a editor tool like vim and also I cannot aggregate my little vim config knowledge.
> 
> 
> 

No, you don't need to spend a few hours or more to config Vim. What you need is to spend a few months learning to use it (and configure it) before using it in a professional setting.

1. If you didn't already, do `$ vimtutor` as many times as needed to get the basics right.
2. As instructed at the end of vimtutor, level up to the user manual `:help user-manual`. It will guide you progressively through *every* feature, from basic to advanced. This not a novel, go at your own pace, skip chapters, come back to them later, and, most importantly, experiment along the way.
3. Keep an eye on anti-patterns and inefficient actions, find improvements, practice. Rinse. Repeat.

Case in point, chapter 7.2 of `$ vimtutor` tells you how to make your settings permanent.
I have my `.vim` folder under version control (includes vimrc), so all I need to do is `git clone --recursive path-to-repo ~/.vim` and my vim is configured for me anywhere, just the way I love it.