diff --git a/.config/nvim/lua/config/plugins/init.lua b/.config/nvim/lua/config/plugins/init.lua index de97660..c668b23 100644 --- a/.config/nvim/lua/config/plugins/init.lua +++ b/.config/nvim/lua/config/plugins/init.lua @@ -1,122 +1,130 @@ return { - "hashivim/vim-terraform", - "pierreglaser/folding-nvim", - "tjdevries/colorbuddy.vim", - "wbthomason/packer.nvim", - "jose-elias-alvarez/nvim-lsp-ts-utils", - "jjo/vim-cue", - "ckipp01/stylua-nvim", + "hashivim/vim-terraform", + "pierreglaser/folding-nvim", + "tjdevries/colorbuddy.vim", + "wbthomason/packer.nvim", + "jose-elias-alvarez/nvim-lsp-ts-utils", + "jjo/vim-cue", + "ckipp01/stylua-nvim", - { - "numToStr/Comment.nvim", - keys = { - { "", "(comment_toggle_linewise_current)" }, - { "", "(comment_toggle_linewise_visual)", mode = "v" }, - }, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - }, - config = function() - require("Comment").setup({ - pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), - }) - end, - }, + { + "SmiteshP/nvim-navic", + config = function() + vim.g.navic_silence = true + require("nvim-navic").setup({ separator = " ", highlight = true, depth_limit = 5 }) + end, + }, - { - "L3MON4D3/LuaSnip", - config = function() - require("luasnip/loaders/from_vscode").lazy_load() - end, - }, + { + "numToStr/Comment.nvim", + keys = { + { "", "(comment_toggle_linewise_current)" }, + { "", "(comment_toggle_linewise_visual)", mode = "v" }, + }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + }) + end, + }, - { - "lewis6991/gitsigns.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = function() - require("gitsigns").setup({ - numhl = true, - signs = { - add = { hl = "GitSignsAdd", text = "▌", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { - hl = "GitSignsChange", - text = "▌", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", - }, - delete = { - hl = "GitSignsDelete", - text = "▖", - numhl = "GitSignsDeleteNr", - linehl = "GitSignsDeleteLn", - }, - topdelete = { - hl = "GitSignsDelete", - text = "▘", - numhl = "GitSignsDeleteNr", - linehl = "GitSignsDeleteLn", - }, - changedelete = { - hl = "GitSignsChange", - text = "~", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", - }, - }, - }) - end, - }, + { + "L3MON4D3/LuaSnip", + config = function() + require("luasnip/loaders/from_vscode").lazy_load() + end, + }, - { - "lukas-reineke/indent-blankline.nvim", - branch = "master", - event = "VeryLazy", - init = function() - vim.g.indent_blankline_char = "│" - vim.g.indent_blankline_space_char = "⬝" - vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" } - -- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'} - vim.g.indent_blankline_buftype_exclude = { "help", "terminal" } - vim.g.indent_blankline_filetype_exclude = { "text", "markdown" } - -- vim.g.indent_blankline_show_end_of_line = true - vim.g.indent_blankline_show_first_indent_level = true - vim.g.indent_blankline_show_trailing_blankline_indent = true - vim.g.indent_blankline_char_highlight_list = - { "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" } - require("indent_blankline").setup({}) - end, - }, + { + "lewis6991/gitsigns.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("gitsigns").setup({ + numhl = true, + signs = { + add = { hl = "GitSignsAdd", text = "▌", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { + hl = "GitSignsChange", + text = "▌", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + delete = { + hl = "GitSignsDelete", + text = "▖", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + topdelete = { + hl = "GitSignsDelete", + text = "▘", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + changedelete = { + hl = "GitSignsChange", + text = "~", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + }) + end, + }, - { - "ray-x/go.nvim", - config = function() - require("go").setup({ - comment_placeholder = "", - icons = { breakpoint = "🧘", currentpos = "🏃" }, - dap_debug_gui = false, - }) - vim.cmd("autocmd FileType go nmap c :lua require('go.comment').gen()") - vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") - vim.cmd("autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)") - end, - }, + { + "lukas-reineke/indent-blankline.nvim", + branch = "master", + event = "VeryLazy", + init = function() + vim.g.indent_blankline_char = "│" + vim.g.indent_blankline_space_char = "⬝" + vim.g.indent_blankline_space_char_highlight_list = { "IndentSpace" } + -- vim.g.indent_blankline_char_list = {'|', '¦', '┆', '┊'} + vim.g.indent_blankline_buftype_exclude = { "help", "terminal" } + vim.g.indent_blankline_filetype_exclude = { "text", "markdown" } + -- vim.g.indent_blankline_show_end_of_line = true + vim.g.indent_blankline_show_first_indent_level = true + vim.g.indent_blankline_show_trailing_blankline_indent = true + vim.g.indent_blankline_char_highlight_list = + { "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" } + require("indent_blankline").setup({}) + end, + }, - { - "onsails/lspkind-nvim", - config = function() - require("lspkind").init({}) - end, - }, + { + "ray-x/go.nvim", + config = function() + require("go").setup({ + comment_placeholder = "", + icons = { breakpoint = "🧘", currentpos = "🏃" }, + dap_debug_gui = false, + }) + vim.cmd("autocmd FileType go nmap c :lua require('go.comment').gen()") + vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") + vim.cmd("autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)") + end, + }, - { - url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - config = function() - require("lsp_lines").setup() - vim.diagnostic.config({ - virtual_text = false, - }) - end, - }, + { + "onsails/lspkind-nvim", + config = function() + require("lspkind").init({}) + end, + }, + + { + url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + config = function() + require("lsp_lines").setup() + vim.diagnostic.config({ + virtual_text = false, + }) + end, + }, } diff --git a/.config/nvim/lua/config/plugins/lsp-config.lua b/.config/nvim/lua/config/plugins/lsp-config.lua index c83c037..565749b 100644 --- a/.config/nvim/lua/config/plugins/lsp-config.lua +++ b/.config/nvim/lua/config/plugins/lsp-config.lua @@ -45,8 +45,8 @@ function M.config() vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end - local on_attach = function() - -- require("folding").on_attach() + local function on_attach(client, bufnr) + require("nvim-navic").attach(client, bufnr) end -- simple setups -- @@ -86,8 +86,8 @@ function M.config() }) lspconfig.sumneko_lua.setup({ - on_attach = function() - on_attach() + on_attach = function(client, bufnr) + on_attach(client, bufnr) vim.cmd([[autocmd BufWritePre lua require'stylua-nvim'.format_file()]]) end, settings = { diff --git a/.config/nvim/lua/config/plugins/lualine.lua b/.config/nvim/lua/config/plugins/lualine.lua index b18c74c..a16d912 100644 --- a/.config/nvim/lua/config/plugins/lualine.lua +++ b/.config/nvim/lua/config/plugins/lualine.lua @@ -1,36 +1,50 @@ local M = { - "nvim-lualine/lualine.nvim", - dependencies = { "kyazdani42/nvim-web-devicons" }, - event = "VeryLazy", + "nvim-lualine/lualine.nvim", + dependencies = { "kyazdani42/nvim-web-devicons" }, + event = "VeryLazy", } local function clock() - return os.date("%H:%M") + return os.date("%H:%M") end function M.config() - local lualine = require("lualine") + local lualine = require("lualine") - lualine.setup({ - options = { - globalstatus = true, - theme = "onelight", - component_separators = { left = "╲", right = "╱" }, - section_separators = { left = "", right = "" }, - }, - sections = { - lualine_c = { - { - "filename", - path = 1, - file_status = true, - }, - }, - lualine_x = { "filetype" }, - lualine_y = { "location", "progress" }, - lualine_z = { clock }, - }, - }) + lualine.setup({ + options = { + globalstatus = true, + theme = "onelight", + component_separators = { left = "╲", right = "╱" }, + section_separators = { left = "", right = "" }, + }, + sections = { + lualine_c = { + { + "filename", + path = 1, + file_status = true, + }, + { + function() + local navic = require("nvim-navic") + local ret = navic.get_location() + return ret:len() > 2000 and "navic error" or ret + end, + cond = function() + if package.loaded["nvim-navic"] then + local navic = require("nvim-navic") + return navic.is_available() + end + end, + color = { fg = "#d66622" }, + }, + }, + lualine_x = { "filetype" }, + lualine_y = { "location", "progress" }, + lualine_z = { clock }, + }, + }) end return M