Skip to content

Commit

Permalink
docs(Autocommands): Remember cursor postion
Browse files Browse the repository at this point in the history
Former users of Vim may have become accustomed to the editors remembering the cursor position

This commit adds an example to the documentation to provide similar functionality.
  • Loading branch information
tfemby authored Feb 4, 2024
1 parent 741711d commit f0512c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/configuration/autocommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ lvim.autocommands = {
}
}
```

A popular feature of Vim is to remember the cursor position. You can achieve similar functionality with the following:

```lua
lvim.autocommands = {
{
"BufWinEnter",
{
-- Remember cursor position
pattern = "*",
command = 'silent! normal! g`"zv',
},
}
}
```

0 comments on commit f0512c2

Please sign in to comment.