Fedora Account System
Red Hat Associate
Red Hat Customer
Currently, the system vimrc file at /etc/vimrc contains the following autocommand: " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif This autocommand does not check for certain file types like whether the buffer is a Git commit message, so it jumps to the last cursor position even when it shouldn't (when Vim opens a Git commit message window, one is writing a new commit, so the cursor should be at the top, not some random place in the middle of the buffer where the cursor last happened to be at the end of writing the previous commit message). Vim's :help restore-cursor has the following implementation, which I think is a lot better, as it checks for these file types before jumping to the last cursor position: augroup RestoreCursor autocmd! autocmd BufReadPost * \ let line = line("'\"") \ | if line >= 1 && line <= line("$") && &filetype !~# 'commit' \ && index(['xxd', 'gitrebase'], &filetype) == -1 \ && !&diff \ | execute "normal! g`\"" \ | endif augroup END I've been working around this issue by deleting the autocommand, with something like: if exists('#fedora#BufReadPost *') autocmd! fedora BufReadPost * endif It might also be worth thinking about not including this autocommand at all; the better implementation is already in defaults.vim so users can source that file if they want this feature, and I was able to find at least one person who didn't want this and couldn't figure out how to disable it: https://unix.stackexchange.com/questions/559328/is-there-a-vimrc-setting-that-will-cause-vim-to-open-files-at-the-first-line Reproducible: Always Steps to Reproduce: 1. Make some changes to a file in a git repository, stage the changes, and then type git commit at the command line. (Make sure $EDITOR is vim so that Vim opens up for writing the commit message.) 2. Move the cursor around. 3. Type :q to abort the commit message. 4. Type git commit again. Actual Results: The cursor is not at position 1,1. Expected Results: The cursor should be at position 1,1. Additional Information: Tested on Vim 9.1.1818 on Fedora 42, using the vim-X11 package.
Hi Issa, thank you for reporting the issue and the pointer! Looking into the state you described, I will update the system vimrc - remove the current Fedora autocommand and include the one from Vim project, because letting adding the autocommand or sourcing default.vim on users would cause disruption for them - they would have to set something which they did not have to, which should not happen based on decision made by preference. I'll try to get to it next week.
I'm going to land fixed vimrc in the new update I'll build today - however the fix won't be applied on systems where user already changed /etc/vimrc, so such cases have to be handled via 'rpmconf'.
FEDORA-2025-1980bf1f93 (vim-9.1.1888-1.fc43) has been submitted as an update to Fedora 43. https://bodhi.fedoraproject.org/updates/FEDORA-2025-1980bf1f93
FEDORA-2025-42efe01f7d (vim-9.1.1888-1.fc42) has been submitted as an update to Fedora 42. https://bodhi.fedoraproject.org/updates/FEDORA-2025-42efe01f7d
FEDORA-2025-99ae55302d (vim-9.1.1888-1.fc41) has been submitted as an update to Fedora 41. https://bodhi.fedoraproject.org/updates/FEDORA-2025-99ae55302d
FEDORA-2025-1980bf1f93 has been pushed to the Fedora 43 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-1980bf1f93` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-1980bf1f93 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2025-42efe01f7d has been pushed to the Fedora 42 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-42efe01f7d` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-42efe01f7d See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2025-99ae55302d has been pushed to the Fedora 41 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-99ae55302d` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-99ae55302d See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2025-1980bf1f93 (vim-9.1.1888-1.fc43) has been pushed to the Fedora 43 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2025-99ae55302d (vim-9.1.1888-1.fc41) has been pushed to the Fedora 41 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2025-42efe01f7d (vim-9.1.1888-1.fc42) has been pushed to the Fedora 42 stable repository. If problem still persists, please make note of it in this bug report.