Register
It is currently Sun Aug 30, 2015 1:59 pm

Vi and Vim the .vimrc file


All times are UTC - 6 hours


Post new topic Reply to topic  [ 9 posts ] 
Author Message
 PostPosted: Tue Aug 15, 2006 12:51 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 681
Location: Des Moines, Iowa
Here is my .vimrc file... Works pretty good for what i do..... :)

Code:
" Switch syntax highlighting on, when the terminal has colors
  syntax on
" Also switch on highlighting the last used search pattern.
  set hlsearch
" Turn on line numbers
  set nu
" Turn on auto indention features. Use ESC to exit indention.
  set ai



Top
 Profile WWW  
 PostPosted: Mon Sep 04, 2006 4:09 am   
User avatar

Joined: Sat Sep 02, 2006 10:19 am
Posts: 13
Location: United Kingdom
All useful settings. I love the syntax high-lighting in vim and I don't think I could work half as well without it. Something to be aware of is that vim assumes you are working on a console with a light background. If your console colour scheme has a dark background you may want to add this.

Code:
set background=dark


It changes the syntax high-light colours to use lighter colours and making them contrast better with a dark background. You can also set it to light if you have a light console.

Code:
set background=light


Cheers


Top
 Profile WWW ICQ  
 PostPosted: Mon Sep 04, 2006 7:59 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 681
Location: Des Moines, Iowa
Thanks ;)

Good tips :)


Top
 Profile WWW  
 PostPosted: Mon Aug 19, 2013 12:37 pm   
User avatar

Joined: Fri Jul 22, 2011 5:39 pm
Posts: 47
make any file with a shebang 700 with
Code:
au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent !chmod 700 <afile>


Top
 Profile WWW  
 PostPosted: Wed Sep 18, 2013 2:39 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 681
Location: Des Moines, Iowa
Ahh necroposting... :) oh well, interesting to see how my .vimrc file has changed over the years... :D
Code:
> cat .vimrc
syntax on
set showmatch
set bg=dark
set incsearch
set tabstop=4
set shiftwidth=4
set expandtab
set nocompatible
command Preview :!firefox %<CR>
colorscheme desert


Top
 Profile WWW  
 PostPosted: Sat Dec 28, 2013 5:37 am   
User avatar

Joined: Sat Dec 11, 2010 5:27 pm
Posts: 15
Location: NSW, Australia
Love the word "necroposting"!!

Of clourse REAL programmers use nano

<:-P


Top
 Profile  
 PostPosted: Tue Jan 14, 2014 11:04 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 681
Location: Des Moines, Iowa
lol ... nano.. well, it isn't the worst editor I've ever used... :)

vim rules for me anyway. So many shortcuts you can use, and you can create your own.
I've created my own wrapper for RCS , and it uses vim, I'm not a fan of git really (i know i know, blasphemy)...


Top
 Profile WWW  
 PostPosted: Sat Aug 29, 2015 2:22 am   

Joined: Wed Aug 12, 2015 1:08 pm
Posts: 1
Hi,

Given below are some settings I use in my vimrc. I primarily work on Windows and use GVim many times.

It should work on Linux as well. Hope it helps.

Code:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Setting options start.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Make vim not compatible with Vi
set nocompatible
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set syntax on
syntax on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set filetype related settings
filetype plugin indent on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set Numbers
set nu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Dont crazy indent copy-pasted stuff in terminal vim.
"Hit <F2> when in insert mode and paste. Hit <F2> again when done.
set pastetoggle=<F2>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Allow to open a new file even when I have unwritten changes in the existing file.
"Also, undo buffers and marks are preserved while the buffer is open.
set hidden
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Ignore case while searching
set ignorecase
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Highlight as I type the words while searching.
set incsearch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"If I Search/SEArch/sEaRcH etc , then highlight Search/SEArch/sEaRcH
"else highlight the word search without any regard for case.
set smartcase
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Make cursor jump to the matching bracket.
set showmatch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set Autoindent
set autoindent
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Do smart autoindenting when starting a new line.
"Generally enabled after setting autoindent
set smartindent
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Show the line and column number of the cursor position, separated by a comma.
"Displays Top/Bot/File %
set ruler
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Disable beeping
set noerrorbells
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Flash the screen (visual bell)
set visualbell
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Show the mode (Insert/Visual etc) in the lower left corner of the screen.
set showmode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Show the command I am running.
set showcmd
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable mouse in "a"ll aspects
set mouse=a
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set history and undolevels
set history=1000
set undolevels=1000
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Tab completion cycle-through shows up in the statusline
set wildmenu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set backspace to behave better
set backspace=2
set backspace=indent,eol,start
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Change the current working directory whenever you open a file, switch buffers,
"delete a buffer or open/close a window.
"Note: When this option is on some plugins MAY NOT work.
set autochdir
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Damian Conway's clever hack.
"Make the color column visible only when the line actually crosses over.
"Please note - Does not seem to work with Centos (7.2) vim.
set colorcolumn=0
call matchadd('ColorColumn', '\%81v', 100)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set encodings
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
set termencoding=utf-8
scriptencoding utf-8
setglobal fileencoding=utf-8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set swap, backup and undo directories.
"NOTE - You have to create these yourself.
"Vim will NOT create them automatically.
"Set swapfiles directory
"set directory=$HOME/.vim/vimswap//

"Set backup files directory
"set backupdir=$HOME/.vim/vimbkup//

"Set undo directory
"set undodir=$HOME/.vim/vimundo//
""Note - You have to create the directories first. Vim wont create them for you.
"Otherwise, you can just set vim to NOT have any of these. Just uncomment the
"set directory/set backupdir/set undodir options above and comment the following.
set nobackup
set noswapfile
set noundofile

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set command to clear registers.
function! ClearRegisters()
   let regs='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-="*+'
   let i=0
   while (i<strlen(regs))
      exec 'let @'.regs[i].'=""'
      let i=i+1
   endwhile
endfunction
command! ClearRegisters call ClearRegisters()
"end of function and the command to clear registers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set $ to appear when you type cw etc.
set cpoptions+=$
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set Virtual Edit
set virtualedit=all
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set list chars
set listchars=tab:>>,eol:+,nbsp:&
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set terminal to 512 colours. Not helpful at all in Windows command console.
set t_Co=512
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Always show statusline
set laststatus=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set statusline options
set statusline=\ %F\ »\ %h%m%r\ %y%=\ %n\ »\ %-10.(%l,%c%V%)\ →\ %P
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Show a → when long lines wrap over
set showbreak=→
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"End of Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


Top
 Profile  
 PostPosted: Sat Aug 29, 2015 7:45 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 188
Real programmers use nano?

Well, nano == NotAnEditorNO
You see, this unprogram is just for kiddies not even managed it to master basic spelling rules and basic grammer pattern.

Code:
rename nano lalalalilo


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP