2022-05-03 16:24:11 +00:00
|
|
|
local autocmd = vim.api.nvim_create_autocmd
|
|
|
|
|
|
|
|
-- Uncomment this if you want to open nvim with a dir
|
|
|
|
-- autocmd("BufEnter", {
|
|
|
|
-- callback = function()
|
|
|
|
-- if vim.api.nvim_buf_get_option(0, "buftype") ~= "terminal" then
|
|
|
|
-- vim.cmd "lcd %:p:h"
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
-- })
|
2021-08-22 07:49:15 +00:00
|
|
|
|
|
|
|
-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
|
2022-05-03 16:24:11 +00:00
|
|
|
-- autocmd("InsertEnter", {
|
|
|
|
-- callback = function()
|
|
|
|
-- vim.opt.relativenumber = false
|
|
|
|
-- end,
|
|
|
|
-- })
|
|
|
|
-- autocmd("InsertLeave", {
|
|
|
|
-- callback = function()
|
|
|
|
-- vim.opt.relativenumber = true
|
|
|
|
-- end,
|
|
|
|
-- })
|
2021-08-22 07:49:15 +00:00
|
|
|
|
|
|
|
-- Open a file from its last left off position
|
2022-05-03 16:24:11 +00:00
|
|
|
-- autocmd("BufReadPost", {
|
|
|
|
-- callback = function()
|
|
|
|
-- if not vim.fn.expand("%:p"):match ".git" and vim.fn.line "'\"" > 1 and vim.fn.line "'\"" <= vim.fn.line "$" then
|
|
|
|
-- vim.cmd "normal! g'\""
|
|
|
|
-- vim.cmd "normal zz"
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
-- })
|
|
|
|
|
2021-08-22 07:49:15 +00:00
|
|
|
-- File extension specific tabbing
|
2022-05-03 16:24:11 +00:00
|
|
|
-- autocmd("Filetype", {
|
|
|
|
-- pattern = "python",
|
|
|
|
-- callback = function()
|
|
|
|
-- vim.opt_local.expandtab = true
|
|
|
|
-- vim.opt_local.tabstop = 4
|
|
|
|
-- vim.opt_local.shiftwidth = 4
|
|
|
|
-- vim.opt_local.softtabstop = 4
|
|
|
|
-- end,
|
|
|
|
-- })
|