summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authortalha <talha@talhaamir.xyz>2024-01-03 00:46:34 +0500
committertalha <talha@talhaamir.xyz>2024-01-03 00:46:34 +0500
commite101b978d77ddbce2060c1a8ba898b873a8ed535 (patch)
tree4d0de4ba124be440471a68a0694d3a805c6c017f /lua
parent7e1c16b7aefbb253e391dc5b8361621142772e3d (diff)
parentdb929434fa2f29e5674a5f24d71901b4fa458363 (diff)
Merge branch 'main' of ta_git:/var/www/git/nvim
Diffstat (limited to 'lua')
-rw-r--r--lua/talha/autocmds.lua19
-rw-r--r--lua/talha/init.lua1
-rw-r--r--lua/talha/packer.lua2
-rw-r--r--lua/talha/set.lua2
4 files changed, 22 insertions, 2 deletions
diff --git a/lua/talha/autocmds.lua b/lua/talha/autocmds.lua
new file mode 100644
index 0000000..a892fa2
--- /dev/null
+++ b/lua/talha/autocmds.lua
@@ -0,0 +1,19 @@
+local autocmd_group = vim.api.nvim_create_augroup("Custom auto-commands", { clear = true })
+
+vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ pattern = { "*.py" },
+ desc = "Auto-format python files after saving",
+ callback = function()
+ local filename = vim.api.nvim_buf_get_name(0)
+ vim.cmd(":silent !autopep8 -i " .. filename)
+ vim.cmd(":silent !isort " .. filename)
+ end,
+ group = autocmd_group,
+})
+
+vim.api.nvim_create_autocmd({ "CursorHold" }, {
+ desc = "reload the file on changes",
+ command = "checktime",
+ group = autocmd_group,
+})
+
diff --git a/lua/talha/init.lua b/lua/talha/init.lua
index 2babaca..5dabc12 100644
--- a/lua/talha/init.lua
+++ b/lua/talha/init.lua
@@ -1,4 +1,5 @@
require("talha.remap")
require("talha.set")
require("talha.functions")
+require("talha.autocmds")
diff --git a/lua/talha/packer.lua b/lua/talha/packer.lua
index eea7520..7b97acf 100644
--- a/lua/talha/packer.lua
+++ b/lua/talha/packer.lua
@@ -15,6 +15,8 @@ return require('packer').startup(function(use)
-- colorschemes
use { "ellisonleao/gruvbox.nvim" }
+ use {"bluz71/vim-nightfly-colors"}
+ use {"dasupradyumna/midnight.nvim"}
use { "theprimeagen/harpoon" }
diff --git a/lua/talha/set.lua b/lua/talha/set.lua
index 404b1d8..d4b995e 100644
--- a/lua/talha/set.lua
+++ b/lua/talha/set.lua
@@ -24,9 +24,7 @@ op.cursorline = true
op.scrolloff = 8
--- autoreload a file after inactivity
op.autoread = true
-vim.api.nvim_command([[au CursorHold * checktime]])
op.updatetime = 50