summaryrefslogtreecommitdiff
path: root/lua/talha
diff options
context:
space:
mode:
Diffstat (limited to 'lua/talha')
-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 0366b03..814a837 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