소스 검색

neovim changes

Noah Vogt 6 일 전
부모
커밋
fa086e83d0
4개의 변경된 파일166개의 추가작업 그리고 79개의 파일을 삭제
  1. 5 0
      dot-config/nvim/init.vim
  2. 26 10
      dot-config/nvim/lua/indent-blankline.lua
  3. 113 40
      dot-config/nvim/lua/treesitter.lua
  4. 22 29
      dot-config/nvim/lua/whichkey.lua

+ 5 - 0
dot-config/nvim/init.vim

@@ -30,5 +30,10 @@ source $XDG_CONFIG_HOME/nvim/keys/tex-macros.vim
 " get autocommands
 source $XDG_CONFIG_HOME/nvim/general/auto.vim
 
+" fix black (python formatter)
+let g:black_virtualenv = ''
+let g:black_use_virtualenv = 0
+
+
 " disalbe automatic identation (should be at the end???)
 filetype indent off

+ 26 - 10
dot-config/nvim/lua/indent-blankline.lua

@@ -1,12 +1,28 @@
--- uncomment below to show whitespace characters
+local status, ibl = pcall(require, "ibl")
+if not status then
+    print("IBL not found")
+    return
+end
 
---vim.opt.list = true
---vim.opt.listchars:append("space:⋅")
---vim.opt.listchars:append("eol:↴")
-
-require("indent_blankline").setup {
-    -- highlight the indentation guide of the current context
-    show_current_context = true,
-    -- underline the starting line of the block
-    show_current_context_start = false,
+local hooks = require "ibl.hooks"
+local highlight = {
+    "RainbowRed",
+    "RainbowYellow",
+    "RainbowBlue",
+    "RainbowOrange",
+    "RainbowGreen",
+    "RainbowViolet",
+    "RainbowCyan",
 }
+
+hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
+    vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
+    vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
+    vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
+    vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
+    vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
+    vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
+    vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
+end)
+
+ibl.setup { indent = { highlight = highlight } }

+ 113 - 40
dot-config/nvim/lua/treesitter.lua

@@ -1,5 +1,10 @@
-require'nvim-treesitter.configs'.setup {
-    ensure_installed = {
+-- 1. Use the configs module if it exists, otherwise use the new core
+local ok, configs = pcall(require, "nvim-treesitter.configs")
+
+if ok then
+    -- If you are on a version that still has configs
+    configs.setup({
+        ensure_installed = {
         "c",
         "lua",
         "java",
@@ -16,49 +21,117 @@ require'nvim-treesitter.configs'.setup {
         "regex",
         "toml",
         "yaml"
-    },
+        },
+        highlight = { enable = true },
+    })
+else
+    -- THE NEW WAY: If configs is missing, use the internal install module
+    local install = require('nvim-treesitter.install')
+    
+    -- This replaces ensure_installed
+    install.prefer_git = true
+    -- To install specific parsers via code:
+    -- require('nvim-treesitter.command').smart_install({ "lua", "python" })
+    
+    -- Enable highlighting globally the new Neovim way
+    vim.api.nvim_create_autocmd('FileType', {
+        callback = function()
+            local lang = vim.treesitter.language.get_lang(vim.bo.filetype)
+            if lang then
+                pcall(vim.treesitter.start)
+            end
+        end,
+    })
+end
+-- local ts = require('nvim-treesitter')
 
-  -- Install parsers synchronously (only applied to `ensure_installed`)
-  sync_install = false,
+-- -- 1. Manually install parsers (replaces ensure_installed)
+-- ts.install({
+--         "c",
+--         "lua",
+--         "java",
+--         "python",
+--         "bash",
+--         "html",
+--         "css",
+--         "javascript",
+--         "bibtex",
+--         "cmake",
+--         "cpp",
+--         "latex",
+--         "perl",
+--         "regex",
+--         "toml",
+--         "yaml"
+-- })
 
-  highlight = {
-    enable = true,
+-- -- 2. Enable Highlighting (Now done via Neovim API, not Treesitter setup)
+-- vim.api.nvim_create_autocmd('FileType', {
+--   callback = function()
+--     pcall(vim.treesitter.start)
+--   end,
+-- })
+-- require'nvim-treesitter.configs'.setup {
+--     ensure_installed = {
+--         "c",
+--         "lua",
+--         "java",
+--         "python",
+--         "bash",
+--         "html",
+--         "css",
+--         "javascript",
+--         "bibtex",
+--         "cmake",
+--         "cpp",
+--         "latex",
+--         "perl",
+--         "regex",
+--         "toml",
+--         "yaml"
+--     },
 
-    disable = {"rust"},
+--   -- Install parsers synchronously (only applied to `ensure_installed`)
+--   sync_install = false,
 
-    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-    -- Using this option may slow down your editor, and you may see some duplicate highlights.
-    additional_vim_regex_highlighting = false,
-    },
+--   highlight = {
+--     enable = true,
 
-    refactor = {
-        highlight_definitions = {
-            enable = true,
-            -- Set to false if you have an `updatetime` of ~100.
-            clear_on_cursor_move = false,
-        },
+--     disable = {"rust"},
 
-        highlight_current_scope = { 
-            -- very annonying per default, maybe has its use when its unclear
-            enable = false
-        },
+--     -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
+--     -- Using this option may slow down your editor, and you may see some duplicate highlights.
+--     additional_vim_regex_highlighting = false,
+--     },
 
-        smart_rename = {
-            enable = true,
-            keymaps = {
-                smart_rename = "grr",
-            },
-        },
+--     refactor = {
+--         highlight_definitions = {
+--             enable = true,
+--             -- Set to false if you have an `updatetime` of ~100.
+--             clear_on_cursor_move = false,
+--         },
 
-        navigation = {
-            enable = true,
-            keymaps = {
-                goto_definition = "gnd",
-                list_definitions = "gnD",
-                list_definitions_toc = "gO",
-                goto_next_usage = "<A-n>",
-                goto_previous_usage = "<A-p>",
-            },
-        },
-    },
-}
+--         highlight_current_scope = { 
+--             -- very annonying per default, maybe has its use when its unclear
+--             enable = false
+--         },
+
+--         smart_rename = {
+--             enable = true,
+--             keymaps = {
+--                 smart_rename = "grr",
+--             },
+--         },
+
+--         navigation = {
+--             enable = true,
+--             keymaps = {
+--                 goto_definition = "gnd",
+--                 list_definitions = "gnD",
+--                 list_definitions_toc = "gO",
+--                 goto_next_usage = "<A-n>",
+--                 goto_previous_usage = "<A-p>",
+--             },
+--         },
+--     },
+-- }

+ 22 - 29
dot-config/nvim/lua/whichkey.lua

@@ -20,45 +20,38 @@ require("which-key").setup {
   },
   -- add operators that will trigger motion and text object completion
   -- to enable all native operators, set the preset / operators plugin above
-  operators = { gc = "Comments" },
-  key_labels = {
-    -- override the label used to display some keys. It doesn't effect WK in any other way.
-    -- For example:
-    -- ["<space>"] = "SPC",
-    -- ["<cr>"] = "RET",
-    -- ["<tab>"] = "TAB",
-  },
+  -- operators = { gc = "Comments" },
   icons = {
     breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
     separator = "➜", -- symbol used between a key and it's label
     group = "+", -- symbol prepended to a group
   },
-  popup_mappings = {
-    scroll_down = '<c-d>', -- binding to scroll down inside the popup
-    scroll_up = '<c-u>', -- binding to scroll up inside the popup
-  },
-  window = {
-    border = "none", -- none, single, double, shadow
-    position = "bottom", -- bottom, top
-    margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
-    padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
-    winblend = 0
-  },
+  -- popup_mappings = {
+  --   scroll_down = '<c-d>', -- binding to scroll down inside the popup
+  --   scroll_up = '<c-u>', -- binding to scroll up inside the popup
+  -- },
+  -- window = {
+  --   border = "none", -- none, single, double, shadow
+  --   position = "bottom", -- bottom, top
+  --   margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
+  --   padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
+  --   winblend = 0
+  -- },
   layout = {
     height = { min = 4, max = 25 }, -- min and max height of the columns
     width = { min = 20, max = 50 }, -- min and max width of the columns
     spacing = 3, -- spacing between columns
     align = "left", -- align columns left, center or right
   },
-  ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
-  hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
+  -- ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
+  -- hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
   show_help = true, -- show help message on the command line when the popup is visible
-  triggers = "auto", -- automatically setup triggers
-  triggers_blacklist = {
-    -- list of mode / prefixes that should never be hooked by WhichKey
-    -- this is mostly relevant for key maps that start with a native binding
-    -- most people should not need to change this
-    i = { "j", "k" },
-    v = { "j", "k" },
-  },
+  -- triggers = "auto", -- automatically setup triggers
+  -- triggers_blacklist = {
+  --   -- list of mode / prefixes that should never be hooked by WhichKey
+  --   -- this is mostly relevant for key maps that start with a native binding
+  --   -- most people should not need to change this
+  --   i = { "j", "k" },
+  --   v = { "j", "k" },
+  -- },
 }