Блог пользователя bitcyber

Автор bitcyber, история, 4 года назад, По-английски

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!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 3   Проголосовать: нравится +2 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    how to compile and execute the cpp file?

    • »
      »
      »
      4 года назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      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 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Thnx

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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 года назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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).