Editing Vim

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
Vim is a text editor based off the classic [[Documentation/devtools/maemo5/vi|vi editor]]. It is different from other text editors in that it has different modes of operation. You can learn about vim through [http://www.google.com/search?q=vim+tutorial various websites].
+
Vim is a text editor based off the classic vi editor. It is different from other text editors in that it has different modes of operation. You can learn about vim through various websites.
-
Vim is a very capable editor for mobile devices because of its low footprint and efficiency of key strokes.
+
Vim is a very capable editor for mobile devices because of its low footprint and effeciency of key strokes.
-
 
+
-
== Installation ==
+
-
Vim can be installed from the [[Extras|extras repository]].
+
== Configuration ==
== Configuration ==
-
Vim can be configured through the <code>~/.vimrc</code> file. Here are some items that make it easier to use vim on the [[Nokia N900|N900]].
+
Vim can be configured through the ~/.vimrc file. Here are some items that make it easier to use vim on the n900.
<pre>
<pre>
-
" Map the comma key to colon
+
# Map the comma key to colon
map , :
map , :
-
 
+
# Press jk while in insert mode to press escape
-
" Press jj while in insert mode to press escape
+
inoremap jk <esc>
-
inoremap jj <esc>
+
-
 
+
-
 
+
-
" CTRL+Up to page up, CTRL+Down to page down
+
-
map <c-up> <c-u>
+
-
map <c-down> <c-d>
+
-
 
+
-
 
+
-
" Use 256 colors
+
-
set t_Co=256
+
-
 
+
-
" Ctrl-Space (layout switcher) does nothing
+
-
imap <Nul> <Nop>
+
-
map <Nul> <Nop>
+
-
vmap <Nul> <Nop>
+
-
cmap <Nul> <Nop>
+
-
nmap <Nul> <Nop>
+
</pre>
</pre>
-
 
-
== Finger scrolling ==
 
-
 
-
Add the following to your <code>~/.vimrc</code> to enable scrolling by dragging the screen.
 
-
 
-
<pre>
 
-
" Drag scrolling. Taken from the ez_scroll vim script
 
-
" http://www.vim.org/scripts/script.php?script_id=3141
 
-
 
-
func! MScroll()
 
-
  let l:done=0
 
-
  let l:n = -1
 
-
  let l:w0 = line("w0")
 
-
  let l:last = line("$")
 
-
  while done!=1
 
-
    let l:g = getchar()
 
-
    if l:g != "\<LeftDrag>"
 
-
      let done = 1
 
-
    else
 
-
      if l:n == -1
 
-
        let l:n = v:mouse_lnum
 
-
        let l:fln = v:mouse_lnum
 
-
      else
 
-
        let l:new = l:w0 - v:mouse_lnum + l:n
 
-
        if l:new<1
 
-
          let l:new = 1
 
-
        endif
 
-
 
-
        let l:diff = -v:mouse_lnum + l:n
 
-
        let l:nd = line("w$")
 
-
        if l:nd+l:diff>l:last
 
-
          let l:new = l:last - winheight(0) + 1
 
-
          if l:new<1
 
-
            let l:new = 1
 
-
          endif
 
-
        end
 
-
 
-
        let l:wn = "normal ".string(l:new)."zt"
 
-
        if (l:n != v:mouse_lnum)
 
-
          exec(l:wn)
 
-
          redraw
 
-
        endif
 
-
        let l:w0 = line("w0")
 
-
        let l:n = v:mouse_lnum + l:diff
 
-
      endif
 
-
    endif
 
-
  endwhile
 
-
  :call cursor(v:mouse_lnum,v:mouse_col)
 
-
endfunc
 
-
:set mouse=a
 
-
:noremap <silent> <LeftMouse> :call MScroll()<CR>
 
-
:noremap <LeftRelease> <Nop>
 
-
:noremap <LeftDrag> <Nop>
 
-
</pre>
 
-
 
-
 
-
[[Category:Software]]
 

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)
Retrieved from "http://wiki.maemo.org/Vim"