text editing in ubuntu

Mohamad Faizul mypiju at gmail.com
Wed Aug 5 19:12:37 UTC 2009


Hal Burgiss wrote:
> On Tue, Aug 04, 2009 at 03:24:58PM +0200, Odd wrote:
>   
>> I have to agree with Chris Jones. Stay away from vim or any variant of
>> it. It's exactly the type of editor you're _not_ looking for.
>> Perhaps mped would be a better editor for you.
>>     
>
> I'll strongly agree with Tim, that [g]vim is a great, great tool for many
> things including html editing. The biggest issue is that a default, bare metal
> install of vim has no configuration whatsoever and is awkward as hell for
> people who have not had the pleasure before. Simple things become very
> difficult. I have often wondered why distros don't include a simple, default
> .vimrc that mimics something like gedit just to get people over the first few
> hours of hell. 
>
> Once you find out the few things that drive you crazy and then realize there
> is a one line config setting for those to make vim do whatever you want, life
> gets much easier and you have a great, powerful tool. There is nothing to stop
> gvim from behaving just like gedit, or whatever editor you want. Of course,
> you also have all the raw power of [g]vim also.
>
> A simple, sane ~/.vimrc that starts vim in insertmode, and has shortcut keys
> for saving/quiting:
>
> set insertmode				" starts vi/vim/gvim in insert mode
> set nocompatible			" nix on vi compatibility
> set ignorecase				" ignore case on seaches
> set backspace=2			" allow backspace over everything
> set textwidth=78			" text will wrap at col. 78, disable with 0
> set backup				" automatically makes backup -- "~"
> set backupdir=/tmp				" where ~ files wind up.
> set mouse=a				" mouse, always 
> set whichwrap=b,s,<,>,[,]	" move past end of line with cursor keys
> set autoindent				" indent to match previous line
> set hlsearch				" Switch on search pattern highlighting.
> set go=eagrt				" Gui Options for menu, scrollbars, Toolbar (T), Tab t, etc
> 						" Menu on, Autoselect, Grey non-selectable 
>                               " menu items, Righthand scrollbar
> set wrap                      " wrap long lines
> set linebreak                 " break only on a space
> set gdefault                  " replace all matches on line
> set incsearch                 " highlight search item, b4 command is finished
>
> set ttymouse=xterm2           " better mouse handling
> syntax on
>
> map! <F7> # <left><left><down>
>
> autocmd BufRead *.sh,*.xml,*.vim,*.c,*.h,*.tcl,*htm*,.vimrc,*.php,*phtml,*.js,*.css,*.conf set textwidth=0 nowrap
> autocmd BufRead *.c,*.h,*.tcl,*htm*,*.php,*phtml,*.js set number
> autocmd BufRead *.php,*.js,*.phtml map! <F7> /**
> <space>*
> */
> <up><up><right><space><space>
>
> " return to same point in file.
> au BufReadPost *  if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
>
>
> " key mappings ...                   
> " ==========================================================================
>
> " start from scratch ...
> "imapc
> vmapc
>
> :if $TERM !~ "linux" 
>    
>    map <C-End> 
mzG<ESC>
>    map <C-Home> 
mzgg<ESC>
>
>    vmap <C-End> 
mzG<ESC>
>    vmap <C-Home> 
mzgg<ESC>
>
> :endif
>
>
> " ALT-C, copy to clipboard ....
> " Mon 04/10/00 11:22:53 AM
> vmap c "*y
> vmap <M-c> "*y
>
>
> " ALT-D, delete 1 line
> map! d :d<CR>
> map! <M-d> :d<CR>
>
> " ALT-P, paste from clipboard ...
> map! p P
> map! <M-p> P
>
>
> " ALT-R, reread current file, ie start over ....
> map! r 
me:e!<CR>
`e<right>
> map! <M-r> 
me:e!<CR>
`e<right>
>
>
> " ALT-T, cut to clipboard ...
> vmap t d
> vmap <M-t> d
> map <M-t> x
>
>
> " ALT-U, undo ....
> map! u u
> map! <M-u> u
> map u u
> map <M-u> u
> map <C-z> ^Ou
> map <C-z> ^Ou
>
>
> " ALT-X, enter EX (command) mode ...
> map! x :
> map! <M-x> :
> map <ESC>x :
> map <ESC><M-x> :
> vmap <M-x> <ESC>:
>
> """"""" Function Keys ....
> " F2 is search .... Save cursor position.
> map! <F2> 
mz<insert><C-Right>/
> map <F2> mz<insert><C-Right>/
>
> " CTRL-F2 is search/replace all .... Save cursor position.
> map! [12^ 
mz<insert>:%s//<Left>
> map! <C-F2> 
mz<insert>:%s//<Left>
> map! O1;5Q 
mz<insert>:%s//<Left>
>
> " F3, exit w/o saving ...
> nmap <F3> q!
> map! <F3> 
:q!<CR>
> map  <F3> :q!<CR>
> vmap <F3> <ESC>:q!
> " 2009-06-16 MS compat.
> map <C-q> q!
> map! <C-q> 
:q!<CR>
> map  <C-q> :q!<CR>
> vmap <C-q> <ESC>^O:q!
>
> "Alt F3, exit All tabs w/o saving ...
> nmap <M-F3> qa!
> map! <M-F3> 
:qa!<CR>
> map  <M-F3> :qa!<CR>
> vmap <M-F3> <ESC>:qa!
>
> " F4, save and then exit
> map! <F4> 
:wq<CR>
> map <F4> :wq<CR>
> vmap <F4> <ESC>:wq<CR>
>
> "ALT F4, save and then exit ALL
> map! <M-F4> 
:wqa<CR>
> map <M-F4> :wqa<CR>
> vmap <M-F4> <ESC>:wqa<CR>
>
> " F5 reflow text
> "map Q gq<CR>
> map! <F5> gq<CR>
>
> " F7 is specially mapped for a comment char -- see above
>
> " abbreviations ...
> " ====================================================================== 
>
> " date/time macros, etc ...
>
> iab ddate <C-R>=strftime( "%m/%d/%y" )<left>
> iab adate <C-R>=strftime( "%Y-%m-%d" )<left>
> iab tdate <C-R>=strftime( "%a %m/%d/%y %r" )<left>
>
> "==== eof .vimrc
>
>   
nano or ee also great




More information about the ubuntu-users mailing list