vim

Today I had some time... i decided to dedicate it to study some vim.

Now after few hours of reading, I announce vim to be my favorite text editor.

It's so flexible.... uhhhh

How could i live without it so long????
 
I don't think words can express this....
but reading usr_01.txt to usr_04.txt is a thing i advise...

so many great features, so many ways to combine commands, so easy to do this and that..... i'm shocked

Tomorrow i'm removing [my so far default editor] geany, and never use le again (I used to like it)
 
Here you can find some minor tricks, that I posted on a forum we have, to get an even better vim experience ..
The whole post is in spanish, but I think the examples are pretty simple to follow .. In case you need help on understanding what they mean, just mail me o sen a PM :)

By the way ... I never leave without this ones on my .vimrc:

Code:
set textwidth=0    " Don't wrap words by default 
set ruler    " Show the line and column numbers of the cursor 
set nu    " Show line numbers
set ts=4       "Tab space == 4 whitespaces
set sw=4    
set et 
colorscheme murphy

Regards

PS: press "i", then ctrl+v and then press esc to get "^[" .. the scape sequence .. :)
 
killasmurf86 said:
I don't think words can express this....
but reading usr_01.txt to usr_04.txt is a thing i advise...

so many great features, so many ways to combine commands, so easy to do this and that..... i'm shocked

Tomorrow i'm removing [my so far default editor] geany, and never use le again (I used to like it)

Okay. Now you really have me curious, killasmurf86! Thank you, I've got some reading to do. :) I'm looking forward to this!
 
hitest said:
Okay. Now you really have me curious, killasmurf86! Thank you, I've got some reading to do. :) I'm looking forward to this!

here's my vimrc :
Code:
[B]set nocompatible[/B]
[B]syntax on[/B]
set nomodeline
[B]set backspace=indent,eol,start[/B]
set ruler
[B]set history=50[/B]
set showcmd
set incsearch
set tabstop=4
set expandtab
set shiftwidth=4
set number
set scrolloff=5
set sidescrolloff=10
set incsearch
set wrapscan
set autoindent
set title
set hlg=en
set si
set backupdir=/home/killasmurf86/.bak
set backupext=.bak
set patchmode=.orig
set writebackup
set autoread
set enc=utf-8
set noautowrite

i made parts in bold that you want in your .vimrc already, especially syntax highlighting [you really want it, lot easier to read and navigate manual]
 
Code:
set ts=4  == set tabstop=4
set sw=4  == set shiftwidth=4
set nu    == set number
set et    == set expandtab

and so forth ... ;)

mjguzik: have you read my thread?? it has nothing to do with what you posted :s
 
gnemmi said:
Code:
set ts=4  == set tabstop=4
set sw=4  == set shiftwidth=4
set nu    == set number
set et    == set expandtab

The set number thing is kinda debatable. I can imagine that people like it, but personally I don't.

One other thing: if you don't like the way vim's auto-indentation works with C code, disabling the indentexpr variable (:set indentexpr=) might make your life easier.

Alphons
 
I like "set nu" ...

Take this code .. main.c

Code:
  1 #include<stdio.h>
  2
  3 int main(){
  4
  5 /* a comment in here ... */
  6
  7     int a = 1;
  8     char something{} = "Something to print";
  9
 10     printf("%s :%d\n", something, a);
 11
 12     return 0;
 13 }
 14

compile it and, of course ... it won't ... I forgot my finger pressing the "shift" key while I typed "[]" on line "8" ...

Code:
[gonzalo@inferna ~]% gcc -Wall -pedantic -O2 -o test main.c
main.c: In function 'main':
main.c:8: warning: ISO C forbids nested functions
main.c:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
main.c:8: error: expected expression before '=' token
main.c:10: error: 'something' undeclared (first use in this function)
main.c:10: error: (Each undeclared identifier is reported only once
main.c:10: error: for each function it appears in.)

now .. just issue:

Code:
[gonzalo@inferna ~]% vim +8 main.c

and vim will open main.c and position the cursor on line 8, all at once ...

"set nu" helps me get a visual check on whether the cursor jumped straight to line 8 or not :)

It might seem trivial in this example .. but on 670 lines of perl voodoo .. it really helps :D

Regards
 
gnemmi said:
I like "set nu" ...
[snip]
now .. just issue:
Code:
[gonzalo@inferna ~]% vim +8 main.c

Like I said: I can imagine that you like it and you give a good example of why you do, but personally I don't like it that much because all those line numbers are a tad too cluttering/distracting for my taste. I'd rather just "set ruler". But hey, to each his own and I'm sure some people will look at your example and go: "Hey, that's kinda neat!" I just won't be one of them, that's all.

Happy coding,

Alphons
 
cajunman4life said:
As an alternative to "set nu", I have the following:

nmap <C-N><C-N> :set invnumber<CR>

So if I want line numbers, I press ctrl+n twice. To get rid of them again, ctrl+n twice again.

<SouthPark>You know, I think I learned something today.</SouthPark>

Alphons
 
gnemmi said:
Code:
[gonzalo@inferna ~]% vim +8 main.c

and vim will open main.c and position the cursor on line 8, all at once ...

"set nu" helps me get a visual check on whether the cursor jumped straight to line 8 or not :)

It might seem trivial in this example .. but on 670 lines of perl voodoo .. it really helps :D

Even better is, when you have a Makefile in the working directory. You type :make and if you get an error, vim directly goes to the line where the error was found.
 
Back
Top