diff options
-rw-r--r-- | .config/nvim/lua/helpers/autocmds.lua | 18 | ||||
-rw-r--r-- | .config/nvim/lua/plugins/lastplace.lua | 11 |
2 files changed, 11 insertions, 18 deletions
diff --git a/.config/nvim/lua/helpers/autocmds.lua b/.config/nvim/lua/helpers/autocmds.lua index bf2c325..7461090 100644 --- a/.config/nvim/lua/helpers/autocmds.lua +++ b/.config/nvim/lua/helpers/autocmds.lua | |||
@@ -109,24 +109,6 @@ vim.api.nvim_create_autocmd({ "VimResized" }, { | |||
109 | end, | 109 | end, |
110 | }) | 110 | }) |
111 | 111 | ||
112 | -- go to last loc when opening a buffer | ||
113 | vim.api.nvim_create_autocmd("BufReadPost", { | ||
114 | group = augroup("last_loc"), | ||
115 | callback = function(event) | ||
116 | local exclude = { "gitcommit" } | ||
117 | local buf = event.buf | ||
118 | if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then | ||
119 | return | ||
120 | end | ||
121 | vim.b[buf].lazyvim_last_loc = true | ||
122 | local mark = vim.api.nvim_buf_get_mark(buf, '"') | ||
123 | local lcount = vim.api.nvim_buf_line_count(buf) | ||
124 | if mark[1] > 0 and mark[1] <= lcount then | ||
125 | pcall(vim.api.nvim_win_set_cursor, 0, mark) | ||
126 | end | ||
127 | end, | ||
128 | }) | ||
129 | |||
130 | -- close some filetypes with <q> | 112 | -- close some filetypes with <q> |
131 | vim.api.nvim_create_autocmd("FileType", { | 113 | vim.api.nvim_create_autocmd("FileType", { |
132 | group = augroup("close_with_q"), | 114 | group = augroup("close_with_q"), |
diff --git a/.config/nvim/lua/plugins/lastplace.lua b/.config/nvim/lua/plugins/lastplace.lua new file mode 100644 index 0000000..72e5c7f --- /dev/null +++ b/.config/nvim/lua/plugins/lastplace.lua | |||
@@ -0,0 +1,11 @@ | |||
1 | return { | ||
2 | { | ||
3 | "ethanholz/nvim-lastplace", | ||
4 | |||
5 | opts = { | ||
6 | lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, | ||
7 | lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, | ||
8 | lastplace_open_folds = true, | ||
9 | }, | ||
10 | } | ||
11 | } | ||