From fc6b1e5fe5f066eee08b805bc689d48d938ea304 Mon Sep 17 00:00:00 2001
From: Bogdan Buduroiu <bogdan@buduroiu.com>
Date: Thu, 7 Nov 2024 15:25:47 +0800
Subject: [PATCH] chore: better format on save for python

---
 nvim/lazy-lock.json            |  1 +
 nvim/lua/configs/conform.lua   |  2 +-
 nvim/lua/configs/lspconfig.lua |  7 +++---
 nvim/lua/options.lua           |  6 ++---
 nvim/lua/plugins/init.lua      | 44 ++++++++++++++++++++--------------
 5 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json
index 50fe551..a020973 100644
--- a/nvim/lazy-lock.json
+++ b/nvim/lazy-lock.json
@@ -30,6 +30,7 @@
   "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
   "vim-kitty-navigator": { "branch": "master", "commit": "20abf8613aa228a5def1ae02cd9da0f2d210352a" },
   "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
+  "vim-xcode": { "branch": "main", "commit": "2adc409bd7bb58499218f4f487c825e55306e46d" },
   "volt": { "branch": "main", "commit": "43f72b49037c191eb3cfe26ba7a5574b4bfce226" },
   "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" },
   "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
diff --git a/nvim/lua/configs/conform.lua b/nvim/lua/configs/conform.lua
index 1659336..1188b58 100644
--- a/nvim/lua/configs/conform.lua
+++ b/nvim/lua/configs/conform.lua
@@ -3,7 +3,7 @@ local options = {
     lua = { "stylua" },
     css = { "prettier" },
     html = { "prettier" },
-    python = { "ruff_format" },
+    python = { "ruff_format", "ruff_fix", "ruff_organize_imports" },
     go = { "goimports", "gofmt" },
     json = { "jq" },
   },
diff --git a/nvim/lua/configs/lspconfig.lua b/nvim/lua/configs/lspconfig.lua
index 0bbc220..8cd3161 100644
--- a/nvim/lua/configs/lspconfig.lua
+++ b/nvim/lua/configs/lspconfig.lua
@@ -13,8 +13,8 @@ local servers = {
   },
   ruff = {
     lint = {
-      run = "onSave"
-    }
+      run = "onSave",
+    },
   },
   zls = {},
 
@@ -33,7 +33,7 @@ local servers = {
   ts_ls = {
     settings = {
       completions = {
-        completeFunctionCalls = true
+        completeFunctionCalls = true,
       },
     },
   },
@@ -51,4 +51,3 @@ for name, opts in pairs(servers) do
 
   require("lspconfig")[name].setup(opts)
 end
-
diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua
index 738f20b..4e5603b 100644
--- a/nvim/lua/options.lua
+++ b/nvim/lua/options.lua
@@ -1,6 +1,6 @@
-require "nvchad.options"
+require("nvchad.options")
 
 -- add yours here!
 
--- local o = vim.o
--- o.cursorlineopt ='both' -- to enable cursorline!
+local o = vim.o
+o.cursorlineopt = "both" -- to enable cursorline!
diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua
index 1d65afb..da5633f 100644
--- a/nvim/lua/plugins/init.lua
+++ b/nvim/lua/plugins/init.lua
@@ -1,7 +1,7 @@
 return {
   {
     "stevearc/conform.nvim",
-    event = 'BufWritePre',  -- uncomment for format on save
+    event = "BufWritePre", -- uncomment for format on save
     opts = require "configs.conform",
   },
 
@@ -17,9 +17,14 @@ return {
     "nvim-treesitter/nvim-treesitter",
     opts = {
       ensure_installed = {
-        "vim", "lua", "vimdoc",
-        "html", "css", "python",
-        "typescript", "go"
+        "vim",
+        "lua",
+        "vimdoc",
+        "html",
+        "css",
+        "python",
+        "typescript",
+        "go",
       },
     },
   },
@@ -28,13 +33,16 @@ return {
     cmd = { "Git", "G", "Gdiffsplit", "Gvdiffsplit", "Gwrite", "Gread", "Ggrep", "GMove", "GDelete", "GBrowse" },
     keys = {
       { "<leader>gs", "<cmd>vertical Git<cr>" },
-      desc = "Open Fugitive"
+      desc = "Open Fugitive",
     },
     opts = {
-      enabled = true
-    }
+      enabled = true,
+    },
+    dependencies = {
+      "tpope/vim-rhubarb",
+    },
   },
-  { "tpope/vim-rhubarb", opts = { enabled = true, lazy = false } },
+  { "tpope/vim-rhubarb", opts = { enabled = true } },
   {
     "folke/zen-mode.nvim",
     cmd = "ZenMode",
@@ -54,12 +62,12 @@ return {
       auto_open = false,
       warn_no_results = false,
       modes = {
-        symbols = {             -- Configure symbols mode
+        symbols = { -- Configure symbols mode
           win = {
-            type = "split",     -- split window
-            relative = "win",   -- relative to current window
+            type = "split", -- split window
+            relative = "win", -- relative to current window
             position = "right", -- right side
-            size = 0.15,        -- 30% of the window
+            size = 0.15, -- 30% of the window
           },
         },
       },
@@ -112,11 +120,11 @@ return {
       },
       -- you can enable a preset for easier configuration
       presets = {
-        bottom_search = true,         -- use a classic bottom cmdline for search
-        command_palette = true,       -- position the cmdline and popupmenu together
+        bottom_search = true, -- use a classic bottom cmdline for search
+        command_palette = true, -- position the cmdline and popupmenu together
         long_message_to_split = true, -- long messages will be sent to a split
-        inc_rename = false,           -- enables an input dialog for inc-rename.nvim
-        lsp_doc_border = false,       -- add a border to hover docs and signature help
+        inc_rename = false, -- enables an input dialog for inc-rename.nvim
+        lsp_doc_border = false, -- add a border to hover docs and signature help
       },
     },
   },
@@ -125,8 +133,8 @@ return {
     enabled = true,
     lazy = false,
     build = {
-      "cp ./*.py ~/.config/kitty/"
-    }
+      "cp ./*.py ~/.config/kitty/",
+    },
   },
   {
     "gfontenot/vim-xcode",