You are not logged in.

#1 2005-03-19 20:00:06

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

my vimrc

hey, just because I love this crap, here's my vimrc... points of interest are the "highlight end of line blanks" and the insert mode ":wq" wrapper...

set nocompatible
behave xterm

syntax on
set bs=2
set ts=3
set sw=3
set tw=78
set et
set nu
set nowrap
set history=50
set ruler
set rulerformat=%55(%{strftime('%e-%b-%Y %I:%M %p')} [%5l,%-6(%c%V%)] %P%)
set incsearch
set autoindent
set hlsearch
set ww=<,>,[,]

"let &guioptions = substitute(&guioptions, "T", "", "g")
"let &guioptions = substitute(&guioptions, "t", "", "g")
"set guifont=courier_new:h10

if has("autocmd")
    filetype plugin indent on
    augroup vimrcFunctions
        au!
        autocmd FileType text setlocal textwidth=78
        autocmd BufReadPost * if line("'"")>0 && line("'"")<=line("$")|exe "normal g`""|endif
        autocmd Syntax * syn match Error /s+$| +zet/
        autocmd FileType c,cpp  set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
    augroup END
endif

iab LASTMOD <c-r>="Last Modified: ".strftime("%a %b %d %H:%M:%S %Y")<cr>

function! InsertWQWrapper()
    silent! :wq
endfunction
iab wq <bs><esc>:call InsertWQWrapper()<cr>

function! InsertTabWrapper(direction)
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ 'k'
        return "<tab>"
    elseif a:direction == "backward"
        return "<c-p>"
    else
        return "<c-n>"
    endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper("forward")<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper("backward")<cr>

"dated backup of file
noremap ;s :up|saveas! %:p:r-<c-r>=strftime("%y%m%d")<cr>-bak.<c-r>=expand("%:e")<cr>|3sleep|e #<cr>

"set wmh=0
nmap _ <c-w>-
nmap + <c-w>+
map <c-h> <c-w>h<c-w>_
map <c-j> <c-w>j<c-w>_
map <c-k> <c-w>k<c-w>_
map <c-l> <c-w>l<c-w>_

colorscheme desert

Offline

#2 2005-03-19 20:45:55

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: my vimrc

set nocompatible      " We're running Vim, not Vi!
filetype on           " Enable fieltype detection
filetype indent on    " Enable filetype-specific indenting
filetype plugin on    " Enable filetype-specific plugins
 
"searching related"
set ignorecase        "Ignore case in searches --opposite is: set noic
"set incsearch        "highlight word while searching
set nohls             "does not highlight searches
set smartcase         "unless they contain upper-case letters
 
"indexting related"
set noexpandtab       "Don't want tabs replaced with spaces
"set expandtab
set ts=2              "tab stop
set softtabstop=2     "use the same value as shiftwidth
set shiftwidth=2      "use 4 spaces when using autoindent/cindent
set smarttab          "smart tabs??
set autoindent        "Autoindentation
set smartindent
"set nosi             "turn off smart indenting
set wrap              "wrap
set bs=2              "allow backspacing of lines
 
"display"
set title             "Put title in title bar
syntax on             "Enable syntax highlighting
set showmatch         "show matching parenthesis,brackets,etc
set showcmd           "show current uncompleted command
set showmode          "show current mod (ie insert or not)
set ttyfast           "Smoother changes
 
"misc"
"set noerrorbells      "no beeps
set visualbell        "visual bell instead of beeping
set nobackup          "no backup copies..
set nomodeline        "don't have files trying to override this .vimrc
set nostartofline     "don't jump cursor around, stay in current column
set backspace=2       " Allow backspace to back over lines
set shell=bash
"set number           "show line numbers
 
"Set some colors"
"hi Normal                                      ctermfg=black           ctermbg=white
"hi Comment                                     ctermfg=lightgreen
"hi Function                            ctermfg=lightred
"hi Statement                           ctermfg=lightblue
"hi Include                                     ctermfg=lightblue
"hi htmlSpecialChar     ctermfg=yellow
"hi Define                                      ctermfg=lightblue
"hi Constant                            ctermfg=magenta
"hi Special                                     ctermfg=white
"hi Type                                                ctermfg=lightblue

heh. alot of mine is commented out..sometimes a wild hair will work its way up my arse, and I will uncomment some of them for a while..but most of the time this works for me..

NOTE: set title causes problems on some machines. I comment that out if I get the issue popping up..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-03-19 21:17:14

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: my vimrc

My .vimrc:



Impressive, eh?! (And, I am a vim user)

Offline

#4 2005-03-19 21:53:09

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

hah! there's some default settings I just hate... I need to have "whichwrap=<,>,[,]" because I'm so used to that... FYI it allows you to hit left at the beginning of a line and go to the end of the line above, and vice versa

Offline

#5 2005-03-19 23:44:38

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: my vimrc

ooh. cool phrak. I added it to mine too!
big_smile


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#6 2005-03-20 00:00:30

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: my vimrc

set syntax=on
set tabstop=2
set shiftwidth=2
set expandtab
map <F11>   :wqa<C-M>
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <F6> <C-W>j<C-W>_
map <F7> <C-W>k<C-W>_
map <F12>   :q!<C-M>
set wmh=0
set ic
map <F8>  :w<C-M>
set ttyfast
set title
command WQ wq
command Wq wq
set incsearch
set ignorecase smartcase
set showmode
set nowrap
map <Space> <End>
source /home/iphitus/.vim/desert.vim

and ive got a whole pile of python specific plugins too.

Offline

#7 2005-03-21 21:58:50

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

wow... gotta check these out tongue

so map allows me to map F keys to vi commands?

Offline

#8 2005-03-21 22:02:59

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: my vimrc

dadexter wrote:

wow... gotta check these out tongue

so map allows me to map F keys to vi commands?

IIRC it can technically be any key/key combo

Offline

#9 2005-03-21 22:06:48

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

well... gotta try that when I get home...

map F12 to VimIRC or something tongue

Offline

#10 2005-03-21 22:15:28

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

yeah... and there's some different things to, like "imap" is for insert mode only.... "noremap" means "map this key and let nothing else map to it"... then you can combine those to "inoremap" too - there's others.. vmap? nmap?

Offline

#11 2005-03-21 22:32:27

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

I need to read on that... so I can create some kick ass configs for vi

Offline

#12 2005-03-21 22:50:29

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

currently my vimrc looks like this (out of memory since I forgot to start sshd):

colorscheme elflord

Offline

#13 2005-03-21 23:46:22

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: my vimrc

Weird... mine's the longest even though I don't even use vim anymore except for su editing sometimes.

:noremap d h
:noremap h j
:noremap t k
:noremap n l
:noremap k d
:noremap l n
:noremap j t
:noremap d h
:noremap h j
:noremap t k
:noremap n l
:inoremap  A
:inoremap  
:set scrolloff=2
":colorscheme darkblue
":set guifont=Terminal 44
:set background=dark
:set noexpandtab
:set tabstop=4
:set shiftwidth=4
:set autoindent
:set indentkeys=o,O,*<Return>,<>>,{,}
:set foldcolumn=2
:set wildmode=list:longest,full
:set textwidth=78
" HTML abreviations
:abbreviate htmlintro <?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
<title>Dusty Phillips</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
</body>
</html>tO
:abbrev <c <code</code>7da
:abbrev <e <em</em>5da
:abbrev <s <strong</strong>9da
:abbrev <p <p></p>4da
tA
:abbrev <l <li</li>5da
" Java abbreviations
:abbreviate aal addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
}});O
:abbreviate aauthor @author Dusty Phillips [dusty@buchuki.com]
:hi Folded term=standout ctermfg=4 ctermbg=0

(I see some escape chars didn't copy properly. Too bad)

Offline

#14 2005-03-22 00:03:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

yeah, yours is long due to abbreviations... I used to keep some around... like

iab if( if()<cr>{<cr>}

along with some motion crap I cant recall to put the cursor back to  "if(<here>)"

Offline

#15 2005-03-22 00:21:57

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: my vimrc

yeah, the abbreviations, and remapping the home row to use Dvorak keys instead of Qwerty.  In JEdit I hold down the alt key and use dhtn for cursor movement...

Offline

#16 2005-03-22 00:30:32

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

let me try to understand this...

What do lines like :abbreviation do exactly?

Offline

#17 2005-03-22 00:47:31

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: my vimrc

dadexter wrote:

let me try to understand this...

What do lines like :abbreviation do exactly?

they allow you to type short texts for long texts. for example, if I have:

:abbreviate dgp Dusty G Phillips

in my .vimrc (or on a command line in vim), every time I type

dgp<space>

it will automatically expand to:

Dusty G Phillips

saving me a lot of keystrokes.

Try

:help abbreviate

in a vim window for more info.

Dusty

Offline

#18 2005-03-22 00:55:33

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Offline

#19 2005-03-22 14:39:28

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

ok let me see... played with this a bit last night

.vimrc

colorscheme elflord

filetype plugin on
set shellslash
set grepprg=grep -nH $*
filetype indent on
set sw=2
set iskeyword+=:

map <F2>    :w<C-M>
map <F11>   :wq<C-M>
map <F12>   :q!<C-M>

:abbreviate sig Martin Lefebvre^Memail: dadexter@gmail.com^Mweb: https://sigterm.homeunix.com

source /home/dadexter/.viabbrv

.viabbrv

:ab cc #include <stdio.h>^M^Mint main(int argc, char **argv) {^M^M  return 0;^M}
:ab php_sqlq $query = "SELECT * FROM ";^M$results = mysql_query($query) or die(mysql_error());^M

:ab pkgbuild pkgname=^Mpkgver=^Mpkgrel=1^Mpkgdesc=""^Murl=""^Mlicense=""^Mdepends=()^Mmakedepends=()^Mconflicts=()^Mreplaces=()^Mbackup=()^Minstall=^Msource=($pkgname-$pkgver.tar.gz)^Mmd5sums=()^M^Mbuild() {^Mcd $startdir/src/$pkgname-$pkgver^M./configure --prefix=/usr^Mmake^Mmake DESTDIR=$startdir/pkg install^M}^M

I just had to make one for a PKGBUILD template tongue

Offline

#20 2005-03-22 15:45:20

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

two things:
a) you can use "<cr>" instead of "^M" to insert a carraige return... it's slightly more portable...
b) with your mappings, you can add <esc> in front of them, so they work in insert mode as well

Offline

#21 2005-03-22 18:59:46

dadexter
Member
From: Dorval, QC, Canada
Registered: 2004-09-07
Posts: 274
Website

Re: my vimrc

thanks... I'll try it out

Offline

#22 2005-03-25 16:06:41

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

oh, a new goodie:

vnoremap <BS> d

allows backspace to delete a selection of text in visual mode....

Offline

#23 2005-04-27 17:24:24

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

another goody - recent vim tip:

"windows style - ctrl+shift enters visual mode
nmap <c-s-left>  vbge<space>
nmap <c-s-right> vew<bs>
nmap <c-s-down>  v<down>
nmap <c-s-up>    v<up>
imap <c-s-left>  _<esc>mz"_xv`z<bs>obge<space>
imap <c-s-right> _<esc>my"_xi<s-right><c-o><bs>_<esc>mz"_xv`yo`z
imap <c-s-down>  _<esc>mz"_xv`zo`z<down><right><bs><bs>
imap <c-s-up>    _<esc>mz"_xv`z<up>o`z<bs>o
vmap <c-s-left>  bge<space>
vmap <c-s-right> ew<bs>
vmap <c-s-down>  <down>
vmap <c-s-up>    <up>

this is because using "behave=mswin" forces shift+<direction> to enter "select" mode (can't perform operations as in visual mode)

Offline

#24 2005-04-28 14:09:10

(mez)
Member
From: North Wales, UK
Registered: 2005-04-16
Posts: 15

Re: my vimrc

Some very cool ideas here; seeing this thread inspired me to overhaul my vimrc. Here's what I've got so far:

" my ~/.vimrc file, 27.04.05

"""""""""" general options """"""""""

set nocompatible                " turn off vi quirks
filetype plugin indent on       " filetype dependent indenting and plugins
syntax on                       " turn on syntax highlighting
set backspace=indent,eol,start  " proper backspace behaviour
set nobackup                    " don't create annoying backups
set nostartofline               " keep cursor in same column when moving
set number                      " turn line numbers on
set showmode                    " show whether in insert, visual mode etc
set showmatch                   " indicate matching parentheses, braces etc
set tabstop=4                   " sets up 4 space tabs
set shiftwidth=4                " use 4 spaces when text is indented
set expandtab                   " insert spaces instead of tabs
set softtabstop=4               " do the right thing when deleting indents
set autoindent                  " indents line to the line above it
set guifont=Monospace 12       " font to use in gvim
set history=100                 " remember this many commands
set hlsearch                    " highlight search results
set incsearch                   " incremental search while typing
set mouse=a                     " enable mouse in all modes
set ruler                       " show line and column in status line
set showcmd                     " show partial command in status line
set ignorecase                  " ignore case in search patterns
set smartcase                   " override ignorecase if search has uppercase
set whichwrap=<,>,[,]           " cursor keys can wrap to next/previous line 
set textwidth=79                " 80 column page for ease of reading
set ttyfast                     " for fast terminals - smoother (apparently)
set hidden                      " don't have to save when switching buffers
set guioptions-=T               " no toolbar
colors nedit                    " modified so bg is only slightly off-white

"""""""""" autocommand stuff """"""""""

if has("autocmd")
    " return to last known cursor position when opening file
    autocmd BufReadPost *
         if line("'"") > 0 && line("'"") <= line("$") |
           exe "normal g`"" |
         endif
endif

"""""""""" abbreviations and remaps """"""""""

:abbreviate #! #!/usr/bin/env python

"""""""""" other stuff """"""""""

" vim.org tip 867: get help on python in vim, eg :Pyhelp os
:command -nargs=+ Pyhelp :call ShowPydoc("<args>")
function ShowPydoc(module, ...)
    let fPath = "/tmp/pyHelp_" . a:module . ".pydoc"
    :execute ":!pydoc " . a:module . " > " . fPath
    :execute ":sp ".fPath
endfunction

A couple of things:

Does anyone know how to increase the space between the line numbers and the start of the line? I surely can't be the only person who wants this, but I've searched and I can't find any mention of it.

There are loads of new colour schemes available in one zip file here: http://vim.sourceforge.net/scripts/scri … ipt_id=625

Offline

#25 2005-04-28 15:13:34

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: my vimrc

(mez): I've always wanted to mess with line number formatting, but can't seem to ever change it...

also, if you're a python coder (looking at your vimrc), you should check out python_calltips - great script for python

Offline

Board footer

Powered by FluxBB