The ultimate Vim setup

Surely everyone must know Vim, in my opinion the best text editor for GNU / Linux. The first few times I used Vim I found it very complicated, but since I manage the dedicated server of my personal blog, it has become my default editor, even for programming, in this article we will see how to apply the final configuration for Vim thanks to a repository that I found in GitHub.

As is usual in the world of free software, Vim It has a great capacity for configuration and customization. So I decided to search the web for configurations that would make the task of programming easier and I came across a repository in GitHub created by Amix, during 8 years. has been using and modifying Vim to get a vimrc definitive. You can find the repository in question here!, let's see how to install it.

In the installation process it will be necessary to use Go, if you are not used to this program you can take a look at this command cheat sheet for git

Basic version or "Awesome" version

It is possible to choose between two versions, a basic that will not install any plugin, or another much more complete that will Vim a very powerful editor.

To install the basic one, just run the following command:

$ git clone git: //github.com/amix/vimrc.git ~ / .vim_runtime $ sh ~ / .vim_runtime / install_basic_vimrc.sh

And for the advanced or “Awesome"

git clone git: //github.com/amix/vimrc.git ~ / .vim_runtime sh ~ / .vim_runtime / install_awesome_vimrc.sh

El vimrc for version "Awesome" It is as follows:

set runtimepath + = ~ / .vim_runtime source ~ / .vim_runtime / vimrcs / basic.vim source ~ / .vim_runtime / vimrcs / filetypes.vim source ~ / .vim_runtime / vimrcs / plugins_config.vim source ~ / .vim_runtime / vimr source ~ / .vim_runtime / vimr source ~ / .vim_runtime / vimr source vim try source ~ / .vim_runtime / my_configs.vim catch endtry

To add our own configurations we have to edit the file ~ / .vim_runtime / my_configs.vim.

Edit the default settings

At installation the default color scheme is set to peaksea, it is possible to change the colors used to highlight the syntax by Vim editing the file ~ / .vim_runtime / my_configs.vim and adding the following line:

colorscheme peaksea

Must be replaced peaksea by any of these other 3 color schemes:

  • solarized
  • pyte
  • ir_black

Possible issues with the transparent background

It is possible that when installing this configuration for Vim we lose the transparent background of the terminal and we see vim in the following way:

The ultimate Vim setup

To solve the problem it is necessary to add the following lines to the file ~ / .vim_runtime / my_configs.vim:

hi NonText ctermfg = 18 ctermbg = NONE cterm = NONE hi Normal ctermfg = 16 ctermbg = NONE cterm = NONE hi Special ctermfg = Yellow ctermbg = NONE hi Comment ctermfg = DarkYellow ctermbg = NONE hi Constant ctermfg = Blue ctermbg = NONEfg hi Yellow ctermbg = NONE hi LineNr ctermfg = DarkGrey ctermbg = NONE hi PreProc ctermfg = Green ctermbg = NONE hi Statement ctermfg = Cyan ctermbg = NONE hi Type ctermfg = Cyan ctermbg = NONE hi Error ctermfg = Red ctermbg Magenta NONEf Identifier ctermbg = Ctermbg Mnta NONEf Identifier = NONE hi SpecialKey ctermfg = Cyan ctermbg = NONE hi NonText ctermfg = Blue ctermbg = NONE hi Directory ctermfg = Blue ctermbg = NONE hi MoreMsg ctermfg = Green ctermbg = NONE hi Red Title ctermfg = Magenta ctermbg = NONE ctermf WarningMs = hi DiffDelete ctermfg = Blue ctermbg = NONE

Which removes the black background (ctermbg = NONE) of all keywords in the programming language and sites where there is no text (NonText).

These parameters are based on the color scheme peaksea, I have simply modified the attribute ctermbg to set the background color to none. If you choose another color scheme you will have to find its default configuration, copy and paste it in your configuration setting ctermbg a NONE

Other modifications

I personally like to highlight the current line with the following appearance:

hi CursorLine guifg = NONE guibg = # 121212 gui = NONE ctermfg = NONE ctermbg = NONE cterm = BOLD hi CursorColumn guifg = NONE guibg = # 121212 gui = NONE ctermfg = NONE ctermbg = NONE cterm = BOLD

After applying all these changes, Vim looks like this:

The ultimate Vim setup21

Conclusion

This has been my first article as a contributor to FromLinux, I hope you have found it useful. Did you know this configuration for Vim ?. What customizations have you made? Leave a comment !.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

47 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   elav said

    I was one of those who hated VIM, I said it was a text editor for Pulpos .. but for some time now I use it more than Nano (the other editor, not the eNano from our community) xDD

    1.    Alexander Mayor said

      It happened to me a bit like you, seeing that Vim was somewhat more complicated, I used Nano, until I made an effort to get used to Vim and it became my default editor. Cheers!

      1.    elav said

        That's right .. by the way, a pleasure to have you here .. Welcome!

        1.    Alexander Mayor said

          Thank you, I hope I can contribute quality articles. Cheers!

    2.    elhui2 said

      I always used Vi, there I modified my COBOL scripts (my first job at 17) xD I never used another for laziness but it accommodated me very well, and they have incredible shortcuts!
      Greetings.

    3.    Manuel de la Fuente said

      Well, as far as I know they are both Nanos and they are Editors, so I still don't know which one you use ... or maybe you use both of them. xD

      1.    eliotime3000 said

        The GNU Nano is software, while the nano that is in this community is an alias of a person.

  2.   dwarf said

    Stop using my pussy name, it is spent xD

    1.    elav said

      The eNano with Windows XP .. WTF?

      1.    dwarf said

        I was in the uni uu

        1.    Angel Isaac Pizano said

          Excuses! You went to the dark side! XD
          And regarding the post ... I think I should learn to use Vim o_o

          1.    eliotime3000 said

            I'm on both Windows Vista and Debian Wheezy, so don't complain if I comment with Google Chrome 30 (actually, it's Chromium 30) with Vista.

        2.    eliotime3000 said

          I know that feel, bro.

    2.    eliotime3000 said

      For a reason, when I talk about GNU Nano, I write GNU Nano (not just nano because of the ambiguity generated by your alias).

  3.   Leo said

    Only those who are worthy enough can use Vim (which I don't include myself).
    He is re-complicated, but it is obvious that he is a better editor, everyone speaks highly of him.

  4.   abimaelmartell said

    I have been using VIM for a while, here is my config that I use in Ubuntu and OSX
    https://github.com/abimaelmartell/dotfiles

  5.   Rots87 said

    I do not understand vim ... I have tried but I always return to nano the lack of habit I suppose but it costs me 🙁

    1.    elav said

      Believe me, when you adapt it becomes indispensable. That being able to copy / move / change text, delete or edit text in a column ... well, when you don't have a VIM graphical interface it's great ... and even with a graphical interface it's great 😀

      1.    petercheco said

        When there is no environment the best is MC (Midnight commander)

      2.    Giskard said

        I do all that at Geany. I don't see why learn complicated things. I have always thought that it is the software that must adapt to human beings and not the other way around. But hey, the world is free ... for the moment.

        1.    RAW-Basic said

          How about? .. ..I have to disagree with your comment .. ..it does not seem fair to me that you think in a generalized way that a certain software does not adapt to ´human beings´ .. ..simply because the needs and perspective of each one ... varies, and in some cases a lot ...

          For some the best is the nano editor, I don't support it even for the slightest change .. ..some like geany, ninjaIDE, eclipse .. and I prefer one or the other depending on the case .. ..other emacs, I Saw..

          Things that seem difficult to learn, although not always, usually have their benefits .. ..for high volumes of data in a file, and I mean really high (TBs) .. some editors won't even let you open it .. .. and with Vi I could not only open it ... but I could do complex handling through regular expressions ...

          Just my opinion .. .. I hope you understand ..

          1.    Giskard said

            Let's see, in almost all the editors I have used you save with Ctrl + S (Save) and exit with Ctrl + Q (Quit). And you move with the convenient arrow keys that have little arrows. Tell me how is it done in vim? 😉
            I understand your opinion, calm down.

          2.    RAW-Basic said

            Em .. ..simple .. ..to move you can do it both with the little arrows .. as with the 'HJKL' keys .. normal in vi-like ..

            To save and exit ': wq' .. 😉

            Give it a chance to learn how to use vim .. ..with but try it for a week .. just using vim .. ..when you learn the tools, the speed it provides is immense ..

  6.   Yukiteru said

    I will have to try it with an open mind, because the truth is that the times that I have invoked him to do some editing it just makes me desperate, and I end up using nano.

  7.   freebsddick said

    I happy with emacs

    1.    eliotime3000 said

      In that I support you, since GNU Emacs is practically a Swiss army knife when it comes to editing texts and scripts. If you want to google or manage your mail. Emacs with a couple of plugins can do it well.

    2.    pandev92 said

      I happy with monodevelop

      TROLLING OFF

  8.   RAW-Basic said

    Wenas .. ..first of all, great that you have decided to contribute .. and even more so with such a post .. ..thank you very much !! ..

    I've been looking for something similar for a long time .. to start using Vim more often .. ..although I always used Vi .. ..for large projects, the ideal is to have a good config and settle into Vim .. .. again, thank you .. ..and we keep reading .. 😉

  9.   eliotime3000 said

    You would have to install Vim before making a blind judgment. For now I am using GNU Nano and GNU Emacs.

  10.   David Gómez said

    The setup is great Alejandro… However, the color schemes are terrible. I don't know if you suddenly know where you can find more attractive color schemes. I personally really like Textmate's Twilight scheme.

    1.    Alexander Mayor said

      If you don't like any of the color schemes that come in the repository, you can try to install any other, or modify the colors to your liking by editing the ctermfg values.

      hi NonText ctermfg = 18 ctermbg = NONE cterm = NONE
      hi Normal ctermfg = 16 ctermbg = NONE cterm = NONE
      hi Special ctermfg = Yellow ctermbg = NONE
      hi Comment ctermfg = DarkYellow ctermbg = NONE
      hi Constant ctermfg = Blue ctermbg = NONE
      hi Number ctermfg = Yellow ctermbg = NONE
      hi LineNr ctermfg = DarkGrey ctermbg = NONE
      hi PreProc ctermfg = Green ctermbg = NONE
      hi Statement ctermfg = Cyan ctermbg = NONE
      hi Type ctermfg = Cyan ctermbg = NONE
      hi Error ctermfg = Red ctermbg = NONE
      hi Identifier ctermfg = Magenta ctermbg = NONE
      hi SpecialKey ctermfg = Cyan ctermbg = NONE
      hi NonText ctermfg = Blue ctermbg = NONE
      hi Directory ctermfg = Blue ctermbg = NONE
      hi MoreMsg ctermfg = Green ctermbg = NONE
      hi Title ctermfg = Magenta ctermbg = NONE
      hi WarningMsg ctermfg = Red ctermbg = NONE
      hi DiffDelete ctermfg = Blue ctermbg = NONE

      Greetings.

  11.   Ender fletcher said

    How are you. good article. It would be good to post something on how to take advantage of this config. For those users not as expert in vim as me 🙂

  12.   juank said

    Very interesting and grateful, it improves the use of vim a lot, but how do you put the numbers of the lines? It is the only thing that I have not been able to achieve.

    Thanks for the input

    1.    David said

      : set number

      1.    RAW-Basic said

        Abbreviated ': set nu' .. ..and to remove it ': set nonu' 😉

    2.    Alexander Mayor said

      I use this:

      : set not compatible ruler laststatus = 2 showcmd showmode number

      And to highlight the current line you need: set cursorline.

      I forgot, greetings.

  13.   kik1n said

    Vim, the best weapon for a Linux & Unix user. Best of all, you can customize vim, mine is a C / C ++ IDE, NERDTree.

  14.   seachello said

    Good contribution!

    Without being an expert user and without getting all the juice that vim has, I have gotten quite used to it and use it as the main editor. I think the best way to get used to it, since it can get desperate at first, is to do the tutorial that comes with the program (use the "vimtutor" command). So I did and it helped me. While reading the tutorial you use vim at the same time.

  15.   Ezekiel said

    Hello community, I use vim and like many of you I find it an indispensable tool for my work. I wanted to provide a very useful tip to handle the installation of plugins. The tool is called "pathogen". This plugin manages the paths for the different plugins, making their installation and uninstallation very easy. If you use vim, you have to use this tool. Another tip: on the vimbits.com page there are a lot of very interesting maps and settings. And for those who use Python, I recommend the python-mode plugin. I hope it serves them as it does me.
    Let's use Linux.
    : )

  16.   Dante Mdz. said

    I haven't used Vim yet, it's making me very curious. I have to try it, but now!

  17.   Mauricio said

    I agree with a lot here.

    I remember that the first days I tried to use vim and I always left it, because it seemed difficult to use it, until one day I started to feel like it and I could understand a little how it works.

    From there, it became my favorite text editor, when I have to edit a file quickly on the console.

    By the way, good article.

    1.    Alexander Mayor said

      Thanks, I'm glad it was an interesting article.

      Greetings.

  18.   Dry0Gut said

    ... the post is very good, I really like vim I use it to program because to configure arch I have always had some difficulties but it is a matter of practice. This post as of today is not out of date.

    Regards!!!

  19.   Dry0Gut said

    How about, I have the problem that this link is broken, someone could tell me which one is working now. At the moment I am testing some that you recommend but I would like to know your opinion… Thank you !!

    Regards!!!

  20.   Dry0Gut said

    source ~ / .vim_runtime / vimrcs / plugins_config.vim

  21.   Dry0Gut said

    … I had problems with the yankring plugin log file when trying to create the yankring_history_v2.txt log file. Any idea that you can provide me with how to solve it ...

    Regards!!

  22.   Anonymous said

    I like your blog.
    I just want to tell you that you have the links to the broken images.