Linux gvim vs vim

50,015

Solution 1

if you are asking the difference between vim and gvim... there are some (personal opinions):

color support

vim runs in terminal, if you set up your terminal correctly, vim supports 256 (or 88) colors. however gvim can support from 000000 - FFFFFF colors.

difficulty of some key mappings

again, depending on the terminal you used. some key mapping may be difficult to achieve. E.g. I wanted to map insert mode alt-i/j/k/l in my vim, I tried a lot, unfortunately, so far it doesn't work for me. But in gvim it is much easier.

gvim is easier to be started by other GUI applications

(plugins may needed) like browser or other IDEs

Gvim needs X

You can start vim as long as you can get a terminal. even tty or pts. But with Gvim you have to have GUI installed.

with vim you can get benefit from ctrl-Z

if you want to test your codes in shell/terminal, or execute some shell commands during your editing. In vim you can just ctrl-z to back to terminal do what you want, and fg back to vim. With Gvim, you cannot do that.

it is great work with vim in tmux/screen

When you are in gvim, you have that single window, switching to other program/application is not as easy (read comfortable) as vim in tmux/screen.

There may be more, but at this point I just think of those. Personally 90% time I use vim.

Solution 2

On some systems, gvim is just vim -g: you can edit a file in a GVim window from your shell with $ vim -g filename or simply $ gvim filename.

On other systems, like RedHat IIRC, vim and gvim are two different executables built at the same time with the same features: you can edit a file in a GVim window from your shell with $ gvim filename.

Either way, you should try to get your hands on a more recent build because 7.2.411 is almost exactly four years old and quite a lot happened in the mean time.

Share:
50,015

Related videos on Youtube

Rudy01
Author by

Rudy01

Updated on July 05, 2022

Comments

  • Rudy01
    Rudy01 almost 2 years

    is there a difference between gvim and vim on a linux machine ?

    I installed an enhanced version of VIM editor which includes recent enhancements:

    vim-enhanced-2:7.2.411-1.8.el6(x86_64)

    And after installation, I could see .viminfo and .vimrc in my home directory. I even made changes on .vimrc and intentionally put some wrong codes in there and it errored out. So, I know for sure that it is calling .vimrc upon invoking vim. I also had a .vimrc from past for GVIM, and I copied that file into this new .vimrc, and again there is no complain.

    So far so good.

    But now, when I open VIM, it opens the file in the terminal! And it is not opening a new window for GVIM. But I can see that it has almost all of GVIM capabilities!

    How could I make this open in a separate window when I open a file?

    • Conspicuous Compiler
      Conspicuous Compiler about 10 years
      Normally vim opens a command line program and gvim opens a GUI program (often an alias for a binary e.g. vim-gnome). Did you use to have it so that vim would open a GUI program? Also, check :help ex in vim to get an idea of the different aliases vim has for starting up.
    • Kent
      Kent about 10 years
      what is the question? you want to know the diff between gvim and vim? or want to get a gvim window if you type vim foo.txt ?
  • Amadan
    Amadan about 10 years
    The benefit of last two points (Ctrl-Z and tmux) is entirely subjective. When I'm in terminal-only I'll use them; but often I'll use a terminal and MacVim (gVim), and Command-Tab (Alt-Tab) between them - which is, for me, easier than both tmux navigation and Ctrl-Z/fg.
  • Kent
    Kent about 10 years
    @Amadan . yes they are subjective. I have most time x env but tmux for me is more convenient than alt tab
  • Sridhar Sarnobat
    Sridhar Sarnobat over 8 years
    I also can't get map <M-k> dd to work in vim while map <M-Down> dd works.
  • IvRRimUm
    IvRRimUm over 7 years
    Wow, i didn't know about ctrl+Z and fg, this thing is pretty big deal, as i close and open vim to run commands pretty oftenly(when ssh in server). And yes, i use tmux too.