About: Restore cursor to file position in previous editing session   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

Here is something for your vimrc which will allow you to restore your cursor position in a file over several editing sessions. This technique uses the viminfo option, so be sure to have viminfo enabled with reasonable options (it is enabled by default): If you are on Unix, the viminfo example above is probably fine as is (but check up on Vim's help for viminfo to see if you like the settings above). For Windows you will need to change the "n" suboption to something like: set viminfo='10,\"100,:20,%,nc:\\some\\place\\under\\Windows\\_viminfo This tip is an improved version of the example given for [

AttributesValues
rdfs:label
  • Restore cursor to file position in previous editing session
rdfs:comment
  • Here is something for your vimrc which will allow you to restore your cursor position in a file over several editing sessions. This technique uses the viminfo option, so be sure to have viminfo enabled with reasonable options (it is enabled by default): If you are on Unix, the viminfo example above is probably fine as is (but check up on Vim's help for viminfo to see if you like the settings above). For Windows you will need to change the "n" suboption to something like: set viminfo='10,\"100,:20,%,nc:\\some\\place\\under\\Windows\\_viminfo This tip is an improved version of the example given for [
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 79(xsd:integer)
Category
  • Usage
Author
  • Charles E Campbell
Complexity
  • intermediate
Created
  • 2001(xsd:integer)
ID
  • 80(xsd:integer)
NEXT
  • 81(xsd:integer)
Rating
  • 518(xsd:integer)
abstract
  • Here is something for your vimrc which will allow you to restore your cursor position in a file over several editing sessions. This technique uses the viminfo option, so be sure to have viminfo enabled with reasonable options (it is enabled by default): " Tell vim to remember certain things when we exit " '10 : marks will be remembered for up to 10 previously edited files " "100 : will save up to 100 lines for each register " :20 : up to 20 lines of command-line history will be remembered " % : saves and restores the buffer list " n... : where to save the viminfo files set viminfo='10,\"100,:20,%,n~/.viminfo If you are on Unix, the viminfo example above is probably fine as is (but check up on Vim's help for viminfo to see if you like the settings above). For Windows you will need to change the "n" suboption to something like: set viminfo='10,\"100,:20,%,nc:\\some\\place\\under\\Windows\\_viminfo Afterwards, add the main function that restores the cursor position and its autocmd so that it gets triggered: function! ResCur() if line("'\"") <= line("$") normal! g`" return 1 endif endfunction augroup resCur autocmd! autocmd BufWinEnter * call ResCur() augroup END This tip is an improved version of the example given for [help last-position-jump]. It fixes a problem where the cursor position will not be restored if the file only has a single line.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software