bitcyber's blog

By bitcyber, history, 5 years ago, In English

Hello guys! I hope everyone is doing good and am a novice to Codeforces.

I have used the various editor for my software development and finally decided to stick to Vim for its simplicity and speed. I want to know what are you guys using (.vimrc configuration/plugins) for vim, especially for C++ competitive environment. If somebody can also help me to run a clang compiler for C++ code in Vim editor itself than It will be very helpful.

Looking forward to receiving responses from all of you guys!

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
Rev. 3   Vote: I like it +2 Vote: I do not like it

I use tmwilliamlin168 .vimrc. Which is linked here: Vimrc I don't use any plugins but you can use as you like. For compiling, press and for executing press I also use some of my own things like brace-auto completion. My addons are here:

set autoindent set smartindent

inoremap { {} inoremap { {}O inoremap {{ { inoremap {} {} inoremap " "" inoremap ' '' inoremap ( () inoremap [ []

These are for autoindenting, smartindenting and brace completions. Feel free to use as you wish! Hoped that this helped. BTW I don't know about a clang compiler. I use mingw which is here: Mingw Compiler

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    how to compile and execute the cpp file?

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Once you have setup the vimrc, all you have to do is press F9 and then wait until it is done. It will say something like Hit any key to close this window. Then press F10 and you can input your data.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thnx

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        But this is annoying to compile first and then run your program. Can we change something in vimrc file so that it will do both the things at the same time i.e compile and run at same time

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Put

          autocmd filetype cpp nnoremap <F5> :w <bar> !g++ -std=c++17 -O2 -Wall % -o %:r && %:r.exe <CR>
          

          in your vimrc. Wait a few seconds, then you can put in your input.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Where to put this .vimrc file? I am on windows and I already have the _vimrc file.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Make a new _vimrc file according to your needs outside the Vim folder and replace it with already present _vimrc file. I have done the same and it works.If you try to overwrite the existing file, it doesn't work(At least mine didn't).