[arch-general] VIM history
Hi, while I was on Fedora, whenever I opened a file using vim, the next time I open it, it used to open at the same line where I closed it. What is the setting to enable this feature ? Its a big pain in the a$$ to scroll through the file every time I want to find the line. -- Nilesh Govindarajan Site & Server Adminstrator www.itech7.com
On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan <lists@itech7.com>wrote:
Hi, while I was on Fedora, whenever I opened a file using vim, the next time I open it, it used to open at the same line where I closed it.
What is the setting to enable this feature ? Its a big pain in the a$$ to scroll through the file every time I want to find the line.
-- Nilesh Govindarajan Site & Server Adminstrator www.itech7.com
Add this to your .vimrc " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). " Also don't do it when the mark is in the first line, that is the default " position when opening a file. autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif
On 02/12/2010 12:08 PM, gt wrote:
On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan<lists@itech7.com>wrote:
Hi, while I was on Fedora, whenever I opened a file using vim, the next time I open it, it used to open at the same line where I closed it.
What is the setting to enable this feature ? Its a big pain in the a$$ to scroll through the file every time I want to find the line.
-- Nilesh Govindarajan Site& Server Adminstrator www.itech7.com
Add this to your .vimrc
" When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). " Also don't do it when the mark is in the first line, that is the default " position when opening a file. autocmd BufReadPost * \ if line("'\"")> 1&& line("'\"")<= line("$") | \ exe "normal! g`\"" | \ endif
Thanks :) -- Nilesh Govindarajan Site & Server Adminstrator www.itech7.com
On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan<lists@itech7.com>wrote:
Hi, while I was on Fedora, whenever I opened a file using vim, the next time I open it, it used to open at the same line where I closed it.
What is the setting to enable this feature ? Its a big pain in the a$$ to scroll through the file every time I want to find the line.
--
Or add the following to .vimrc or /etc/vimrc: runtime vimrc_example.vim to enable other features that you are probably used to
On 02/12/2010 02:48 PM, Matěj Týč wrote:
On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan<lists@itech7.com>wrote:
Hi, while I was on Fedora, whenever I opened a file using vim, the next time I open it, it used to open at the same line where I closed it.
What is the setting to enable this feature ? Its a big pain in the a$$ to scroll through the file every time I want to find the line.
--
Or add the following to .vimrc or /etc/vimrc: runtime vimrc_example.vim to enable other features that you are probably used to
Yeah this is a lot better :) -- Nilesh Govindarajan Site & Server Adminstrator www.itech7.com
On Fri, Feb 12, 2010 at 11:16 AM, Nilesh Govindarajan <lists@itech7.com> wrote:
Or add the following to .vimrc or /etc/vimrc: runtime vimrc_example.vim to enable other features that you are probably used to
Yeah this is a lot better :)
I started by just including it with runtime. But finally I find it nicer to use /usr/share/vim/vim72/vimrc_example.vim as a base for the ~/.vimrc config file. That way the config might also be more portable between systems.
participants (4)
-
gt
-
Matěj Týč
-
Nilesh Govindarajan
-
Xavier Chantry