junegunn / junegunn/fzf.vim

Modification for getting :Lines work in vim 7.0

Open
#298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- Category
- [ ] Question
- [ ] Bug
- [x] Suggestion
- OS
- [x] Linux
- [x] macOS
- [x] Windows
- [ ] Etc.
- Vim
- [x] Vim
- [ ] Neovim

For the next few months at least, I'll be using vim 7.0 that comes with RHEL5 for one of the systems I help maintain. I was configuring fzf.vim and noticed that `:Lines` wasn't jumping to the line I selected. After troubleshooting the issue, I figure out that map([list], ...) [used in s:buffer_lines()] doesn't support v:key as an index into the array in vim 7.0. The function can be rewritten to work with vim 7.0 as folows

```vim
function! s:buffer_lines()
let lines=[]
let lineno=0
for line in getline(1, "$")
let lines += [printf(s:yellow(" %4d ", "LineNr")."\t%s", l:lineno+1, line)]
let lineno += 1
endfor
return l:lines
endfunction
```

I'm not asking you to merge this in as the default since vim 7.0 is pretty old. But I thought since I had figured it out, I might as well post it in case anyone else wanted `:Lines` functionality with an older vim.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.