diff --git a/nvim/lua/settings/autocommands.lua b/nvim/lua/settings/autocommands.lua index 3004eb6..d6c6d63 100644 --- a/nvim/lua/settings/autocommands.lua +++ b/nvim/lua/settings/autocommands.lua @@ -12,3 +12,4 @@ vim.cmd([[highlight BufferInactive guifg=#888888 guibg=#131a24]]) vim.cmd([[highlight BufferInactiveMod guifg=#dbc074 guibg=#131a24]]) vim.cmd([[highlight BufferInactiveSign guifg=#719cd6 guibg=#131a24]]) +vim.cmd([[highlight LspInlayHint guibg=#192330]]) diff --git a/nvim/lua/settings/barbar.lua b/nvim/lua/settings/barbar.lua index aeaa723..ae9db9c 100644 --- a/nvim/lua/settings/barbar.lua +++ b/nvim/lua/settings/barbar.lua @@ -40,4 +40,3 @@ end) nvim_tree_events.subscribe("TreeClose", function() bufferline_api.set_offset(0) end) - diff --git a/nvim/lua/settings/cmp.lua b/nvim/lua/settings/cmp.lua index 4db2277..2c4a430 100644 --- a/nvim/lua/settings/cmp.lua +++ b/nvim/lua/settings/cmp.lua @@ -1,151 +1,151 @@ local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then - return + return end local snip_status_ok, luasnip = pcall(require, "luasnip") if not snip_status_ok then - return + return end require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) luasnip.config.set_config({ - history = true, + history = true, delete_check_events = "TextChanged", - updateevents = "TextChanged,TextChangedI", - enable_autosnippets = true, - ext_opts = { - [require("luasnip.util.types").choiceNode] = { - active = { - virt_text = { { - Snippet = "", - "Snippet", - } }, - }, - }, - }, + updateevents = "TextChanged,TextChangedI", + enable_autosnippets = true, + ext_opts = { + [require("luasnip.util.types").choiceNode] = { + active = { + virt_text = { { + Snippet = "", + "Snippet", + } }, + }, + }, + }, }) require("luasnip/loaders/from_vscode").lazy_load() local check_backspace = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") end --   פּ ﯟ   some other good icons local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", } -- find more here: https://www.nerdfonts.com/cheat-sheet cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = cmp.mapping.scroll_docs(-1), - [""] = cmp.mapping.scroll_docs(1), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if luasnip.expand_or_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { - "i", - "s", - }), - }, - view = { - { entries = "native" }, - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - vim_item.menu = ({ - nvim_lsp = "[LSP]", - luasnip = "[Snippet]", - buffer = "[Buffer]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - { name = "buffer" }, - }, - window = { - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - }, - experimental = { - ghost_text = true, - }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping.scroll_docs(-1), + [""] = cmp.mapping.scroll_docs(1), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if luasnip.expand_or_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + view = { + { entries = "native" }, + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }, + window = { + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, + }, + experimental = { + ghost_text = true, + }, }) diff --git a/nvim/lua/settings/dap.lua b/nvim/lua/settings/dap.lua index bc43988..7c9a983 100644 --- a/nvim/lua/settings/dap.lua +++ b/nvim/lua/settings/dap.lua @@ -1,12 +1,12 @@ local dap = require("dap") dap.adapters.codelldb = { - type = "server", - port = "${port}", - executable = { - -- CHANGE THIS to your path! - command = "/home/dashie/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb", - args = { "--port", "${port}" }, - }, + type = "server", + port = "${port}", + executable = { + -- CHANGE THIS to your path! + command = "/home/dashie/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb", + args = { "--port", "${port}" }, + }, } local rust_dap = vim.fn.getcwd() @@ -14,111 +14,111 @@ local filename = "" for w in rust_dap:gmatch("([^/]+)") do filename = w end dap.configurations.rust = { - { - type = "codelldb", - request = "launch", - program = function() - return rust_dap .. "/target/debug/" .. filename - end, - --program = '${fileDirname}/${fileBasenameNoExtension}', - cwd = "${workspaceFolder}", + { + type = "codelldb", + request = "launch", + program = function() + return rust_dap .. "/target/debug/" .. filename + end, + --program = '${fileDirname}/${fileBasenameNoExtension}', + cwd = "${workspaceFolder}", stopOnEntry = true, - terminal = "integrated", - }, + terminal = "integrated", + }, } dap.configurations.cpp = { - { - type = "codelldb", - request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file") - end, - --program = '${fileDirname}/${fileBasenameNoExtension}', - cwd = "${workspaceFolder}", - terminal = "integrated", - }, + { + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file") + end, + --program = '${fileDirname}/${fileBasenameNoExtension}', + cwd = "${workspaceFolder}", + terminal = "integrated", + }, } dap.configurations.c = dap.configurations.cpp require("dapui").setup({ - icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, - mappings = { - -- Use a table to apply multiple mappings - expand = { "", "<2-LeftMouse>" }, - open = "o", - remove = "d", - edit = "e", - repl = "r", - toggle = "t", - }, - -- Expand lines larger than the window - -- Requires >= 0.7 - expand_lines = vim.fn.has("nvim-0.7") == 1, - -- Layouts define sections of the screen to place windows. - -- The position can be "left", "right", "top" or "bottom". - -- The size specifies the height/width depending on position. It can be an Int - -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while - -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) - -- Elements are the elements shown in the layout (in order). - -- Layouts are opened in order so that earlier layouts take priority in window sizing. - layouts = { - { - elements = { - -- Elements can be strings or table with id and size keys. - { id = "scopes", size = 0.25 }, - "breakpoints", - "stacks", - "watches", - }, - size = 40, -- 40 columns - position = "left", - }, - { - elements = { - "repl", - "console", - }, - size = 0.25, -- 25% of total lines - position = "bottom", - }, - }, - controls = { - -- Requires Neovim nightly (or 0.8 when released) - enabled = true, - -- Display controls in this element - element = "repl", - icons = { - pause = "", - play = "", - step_into = "", - step_over = "", - step_out = "", - step_back = "", - run_last = "↻", - terminate = "□", - }, - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "" }, - }, - }, - windows = { indent = 1 }, - render = { - max_type_length = nil, -- Can be integer or nil. - max_value_lines = 100, -- Can be integer or nil. - }, + icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + -- Expand lines larger than the window + -- Requires >= 0.7 + expand_lines = vim.fn.has("nvim-0.7") == 1, + -- Layouts define sections of the screen to place windows. + -- The position can be "left", "right", "top" or "bottom". + -- The size specifies the height/width depending on position. It can be an Int + -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while + -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) + -- Elements are the elements shown in the layout (in order). + -- Layouts are opened in order so that earlier layouts take priority in window sizing. + layouts = { + { + elements = { + -- Elements can be strings or table with id and size keys. + { id = "scopes", size = 0.25 }, + "breakpoints", + "stacks", + "watches", + }, + size = 40, -- 40 columns + position = "left", + }, + { + elements = { + "repl", + "console", + }, + size = 0.25, -- 25% of total lines + position = "bottom", + }, + }, + controls = { + -- Requires Neovim nightly (or 0.8 when released) + enabled = true, + -- Display controls in this element + element = "repl", + icons = { + pause = "", + play = "", + step_into = "", + step_over = "", + step_out = "", + step_back = "", + run_last = "↻", + terminate = "□", + }, + }, + floating = { + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, + }, + }, + windows = { indent = 1 }, + render = { + max_type_length = nil, -- Can be integer or nil. + max_value_lines = 100, -- Can be integer or nil. + }, }) require("mason-nvim-dap").setup({ - ensure_installed = { - "codelldb", - "bash-debug-adapter", - "firefox-debug-adapter", - "js-debug-adapter", - "node-debug2-adapter", - }, + ensure_installed = { + "codelldb", + "bash-debug-adapter", + "firefox-debug-adapter", + "js-debug-adapter", + "node-debug2-adapter", + }, }) diff --git a/nvim/lua/settings/dashboard.lua b/nvim/lua/settings/dashboard.lua index 5cb71d8..d08da71 100644 --- a/nvim/lua/settings/dashboard.lua +++ b/nvim/lua/settings/dashboard.lua @@ -1,30 +1,30 @@ local status_ok, alpha = pcall(require, "alpha") if not status_ok then - return + return end local dashboard = require("alpha.themes.dashboard") dashboard.section.header.val = { -[[ _______ ___ _______. __ __ __ _______ ]], -[[| \ / \ / || | | | | | | ____|]], -[[| .--. | / ^ \ | (----`| |__| | | | | |__ ]], -[[| | | | / /_\ \ \ \ | __ | | | | __| ]], -[[| '--' | / _____ \ .----) | | | | | | | | |____ ]], -[[|_______/ /__/ \__\ |_______/ |__| |__| |__| |_______|]] + [[ _______ ___ _______. __ __ __ _______ ]], + [[| \ / \ / || | | | | | | ____|]], + [[| .--. | / ^ \ | (----`| |__| | | | | |__ ]], + [[| | | | / /_\ \ \ \ | __ | | | | __| ]], + [[| '--' | / _____ \ .----) | | | | | | | | |____ ]], + [[|_______/ /__/ \__\ |_______/ |__| |__| |__| |_______|]] } dashboard.section.buttons.val = { - dashboard.button("f", " Find file", ":Telescope find_files "), + dashboard.button("f", " Find file", ":Telescope find_files "), dashboard.button("b", " Open File Browser", ":Telescope file_browser"), - dashboard.button("e", " New file", ":ene startinsert "), - dashboard.button("p", " Find project", ":Telescope project "), - dashboard.button("r", " Recently used files", ":Telescope oldfiles "), - dashboard.button("t", " Zoxide", ":Telescope zoxide list "), - dashboard.button("c", " Configuration", ":e ~/.config/nvim/init.lua "), - dashboard.button("q", " Quit Neovim", ":qa"), + dashboard.button("e", " New file", ":ene startinsert "), + dashboard.button("p", " Find project", ":Telescope project "), + dashboard.button("r", " Recently used files", ":Telescope oldfiles "), + dashboard.button("t", " Zoxide", ":Telescope zoxide list "), + dashboard.button("c", " Configuration", ":e ~/.config/nvim/init.lua "), + dashboard.button("q", " Quit Neovim", ":qa"), } local function footer() - return "dashie@dashie.org" + return "dashie@dashie.org" end dashboard.section.footer.val = footer() diff --git a/nvim/lua/settings/devicons.lua b/nvim/lua/settings/devicons.lua index 3aea2da..25b8c1c 100644 --- a/nvim/lua/settings/devicons.lua +++ b/nvim/lua/settings/devicons.lua @@ -1,22 +1,22 @@ -local status_ok , _ = pcall (require, "nvim-web-devicons") +local status_ok, _ = pcall(require, "nvim-web-devicons") if not status_ok then - return + return end -require'nvim-web-devicons'.setup { - -- your personnal icons can go here (to override) - -- you can specify color or cterm_color instead of specifying both of them - -- DevIcon will be appended to `name` - override = { - zsh = { - icon = "", - color = "#428850", - cterm_color = "65", - name = "Zsh" - } - }; +require 'nvim-web-devicons'.setup { + -- your personnal icons can go here (to override) + -- you can specify color or cterm_color instead of specifying both of them + -- DevIcon will be appended to `name` + override = { + zsh = { + icon = "", + color = "#428850", + cterm_color = "65", + name = "Zsh" + } + }; - default = true; + default = true; } - -require'nvim-web-devicons'.get_icons() + +require 'nvim-web-devicons'.get_icons() diff --git a/nvim/lua/settings/indentline.lua b/nvim/lua/settings/indentline.lua index 47a603f..a0b4852 100644 --- a/nvim/lua/settings/indentline.lua +++ b/nvim/lua/settings/indentline.lua @@ -1,17 +1,17 @@ local status_ok, indent_blankline = pcall(require, "indent_blankline") if not status_ok then - return + return end vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } vim.g.indent_blankline_filetype_exclude = { - "help", - "startify", - "dashboard", - "packer", - "neogitstatus", - "NvimTree", - "Trouble", + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", } vim.g.indentLine_enabled = 1 -- vim.g.indent_blankline_char = "│" @@ -22,30 +22,30 @@ vim.g.indent_blankline_show_first_indent_level = true vim.g.indent_blankline_use_treesitter = true vim.g.indent_blankline_show_current_context = true vim.g.indent_blankline_context_patterns = { - "class", - "return", - "function", - "def", - "method", - "^if", - "^else", - "^else if", - "^elif", - "^while", - "jsx_element", - "^for", - "^object", - "^table", - "block", - "arguments", - "if_statement", - "else_clause", - "jsx_element", - "jsx_self_closing_element", - "try_statement", - "catch_clause", - "import_statement", - "operation_type", + "class", + "return", + "function", + "def", + "method", + "^if", + "^else", + "^else if", + "^elif", + "^while", + "jsx_element", + "^for", + "^object", + "^table", + "block", + "arguments", + "if_statement", + "else_clause", + "jsx_element", + "jsx_self_closing_element", + "try_statement", + "catch_clause", + "import_statement", + "operation_type", } -- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59 vim.wo.colorcolumn = "99999" @@ -62,13 +62,13 @@ vim.wo.colorcolumn = "99999" -- vim.opt.listchars:append "eol:↴" indent_blankline.setup({ - show_end_of_line = true, - space_char_blankline = " ", - show_current_context = true, - show_current_context_start = true, - -- char_highlight_list = { - -- "IndentBlanklineIndent1", - -- "IndentBlanklineIndent2", - -- "IndentBlanklineIndent3", - -- }, + show_end_of_line = true, + space_char_blankline = " ", + show_current_context = true, + show_current_context_start = true, + -- char_highlight_list = { + -- "IndentBlanklineIndent1", + -- "IndentBlanklineIndent2", + -- "IndentBlanklineIndent3", + -- }, }) diff --git a/nvim/lua/settings/keymaps.lua b/nvim/lua/settings/keymaps.lua index d7c1afa..f0d96d3 100644 --- a/nvim/lua/settings/keymaps.lua +++ b/nvim/lua/settings/keymaps.lua @@ -12,7 +12,7 @@ keymap("n", "", ':lua require("dap").close() :lua require("dapui").togg -- file tree keymap("n", "t", ":ToggleTerm", opts) -keymap("n", "n", ':lua require("nvim-tree").toggle()', opts) +keymap("n", "f", ':lua require("nvim-tree").toggle()', opts) -- tab switching keymap("n", "", ":BufferPrev", opts) @@ -39,9 +39,8 @@ vim.keymap.set("n", "z", ":lua require('telescope').extensions.zoxide.li -- trouble keymap("n", "", "TroubleToggle", term_opts) require("trouble").setup({ - action_keys = { - --remove the fucking stupid keymap amk - open_tab = {}, - }, + action_keys = { + --remove the fucking stupid keymap amk + open_tab = {}, + }, }) - diff --git a/nvim/lua/settings/lsp.lua b/nvim/lua/settings/lsp.lua index 22c08be..21a2fc0 100644 --- a/nvim/lua/settings/lsp.lua +++ b/nvim/lua/settings/lsp.lua @@ -1,62 +1,95 @@ local status_ok, _ = pcall(require, "lspconfig") if not status_ok then - return + return end require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, }) require("mason-lspconfig").setup({ - ensure_installed = { - "cssls", -- css - "html", -- html - "clangd", -- cpp / c - "sumneko_lua", -- lua - "pyright", -- python - "cmake", -- cmake - "bashls", -- shell - "ansiblels", -- ansible + ensure_installed = { + "cssls", -- css + "html", -- html + "clangd", -- cpp / c + "sumneko_lua", -- lua + "pyright", -- python + "cmake", -- cmake + "bashls", -- shell + "ansiblels", -- ansible "marksman", -- markdown "asm_lsp", -- assembly - }, - automatic_installation = true, + "tsserver", -- js and ts + }, + automatic_installation = true, }) local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) capabilities.textDocument.completion.completionItem.snippetSupport = true -- LSP +-- require("lsp-format").setup {} +require("lsp-inlayhints").setup() local on_attach = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - local optslsp = { noremap = false, silent = true, buffer = bufnr } + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + local optslsp = { noremap = false, silent = true, buffer = bufnr } + -- require("lsp-format").on_attach(client) + require("lsp-inlayhints").on_attach(client, bufnr) end require("mason-lspconfig").setup_handlers({ - function(server_name) -- default handler (optional) - require("lspconfig")[server_name].setup({ - capabilities = capabilities, - on_attach = on_attach, + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + on_attach = on_attach, vim.lsp.diagnostic.on_publish_diagnostics, { - -- Disable virtual_text - virtual_text = true, - } + -- Disable virtual_text + virtual_text = true, + } - }) - end, + }) + end, + ['tsserver'] = function() + require('lspconfig').tsserver.setup { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + } + }, + capabilities = capabilities, + on_attach = on_attach, + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = true, + } + } + end, }) -require("lsp-format").setup {} - -local on_attach = function(client) - require("lsp-format").on_attach(client) -end -- special server setups require("clangd_extensions").setup() @@ -67,13 +100,3 @@ require("rust-tools").setup({ loadOutputiDirs = false, } }) -require("typescript").setup({ - disable_commands = false, -- prevent the plugin from creating Vim commands - debug = false, -- enable debug logging for commands - go_to_source_definition = { - fallback = true, -- fall back to standard LSP definition on failure - }, - server = { -- pass options to lspconfig's setup method - on_attach = on_attach, - }, -}) diff --git a/nvim/lua/settings/nvim-tree.lua b/nvim/lua/settings/nvim-tree.lua index efcbc64..0871601 100644 --- a/nvim/lua/settings/nvim-tree.lua +++ b/nvim/lua/settings/nvim-tree.lua @@ -12,230 +12,230 @@ if not config_status_ok then end nvim_tree.setup { -- BEGIN_DEFAULT_OPTS - auto_reload_on_write = true, - create_in_closed_folder = false, - disable_netrw = false, - hijack_cursor = false, - hijack_netrw = true, - hijack_unnamed_buffer_when_opening = false, - ignore_buffer_on_setup = false, - open_on_setup = true, - open_on_setup_file = true, - open_on_tab = true, - ignore_buf_on_tab_change = {}, - sort_by = "name", - root_dirs = {}, - prefer_startup_root = false, - sync_root_with_cwd = false, - reload_on_bufenter = false, - respect_buf_cwd = false, - on_attach = "disable", -- function(bufnr). If nil, will use the deprecated mapping strategy - remove_keymaps = false, -- boolean (disable totally or not) or list of key (lhs) - view = { - adaptive_size = false, - centralize_selection = false, + auto_reload_on_write = true, + create_in_closed_folder = false, + disable_netrw = false, + hijack_cursor = false, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = false, + ignore_buffer_on_setup = false, + open_on_setup = true, + open_on_setup_file = true, + open_on_tab = true, + ignore_buf_on_tab_change = {}, + sort_by = "name", + root_dirs = {}, + prefer_startup_root = false, + sync_root_with_cwd = false, + reload_on_bufenter = false, + respect_buf_cwd = false, + on_attach = "disable", -- function(bufnr). If nil, will use the deprecated mapping strategy + remove_keymaps = false, -- boolean (disable totally or not) or list of key (lhs) + view = { + adaptive_size = false, + centralize_selection = false, + width = 30, + hide_root_folder = false, + side = "right", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + -- @deprecated + mappings = { + custom_only = false, + list = { + -- user mappings go here + }, + }, + float = { + enable = false, + open_win_config = { + relative = "editor", + border = "rounded", width = 30, - hide_root_folder = false, - side = "right", - preserve_window_proportions = false, - number = false, - relativenumber = false, - signcolumn = "yes", - -- @deprecated - mappings = { - custom_only = false, - list = { - -- user mappings go here - }, + height = 30, + row = 1, + col = 1, + }, + }, + }, + renderer = { + add_trailing = false, + group_empty = true, + highlight_git = false, + full_name = false, + highlight_opened_files = "none", + root_folder_modifier = ":~", + indent_width = 2, + indent_markers = { + enable = false, + inline_arrows = true, + icons = { + corner = "└", + edge = "│", + item = "│", + bottom = "─", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + bookmark = "", + folder = { + arrow_closed = "", + arrow_open = "", + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", }, - float = { - enable = false, - open_win_config = { - relative = "editor", - border = "rounded", - width = 30, - height = 30, - row = 1, - col = 1, - }, + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "★", + deleted = "", + ignored = "◌", }, }, - renderer = { - add_trailing = false, - group_empty = true, - highlight_git = false, - full_name = false, - highlight_opened_files = "none", - root_folder_modifier = ":~", - indent_width = 2, - indent_markers = { - enable = false, - inline_arrows = true, - icons = { - corner = "└", - edge = "│", - item = "│", - bottom = "─", - none = " ", - }, - }, - icons = { - webdev_colors = true, - git_placement = "before", - padding = " ", - symlink_arrow = " ➛ ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = "", - symlink = "", - bookmark = "", - folder = { - arrow_closed = "", - arrow_open = "", - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "", - }, - git = { - unstaged = "✗", - staged = "✓", - unmerged = "", - renamed = "➜", - untracked = "★", - deleted = "", - ignored = "◌", - }, - }, - }, - special_files = { "cargo.toml", "makefile", "readme.md", "readme.md" }, - symlink_destination = true, + }, + special_files = { "cargo.toml", "makefile", "readme.md", "readme.md" }, + symlink_destination = true, + }, + hijack_directories = { + enable = true, + auto_open = true, + }, + update_focused_file = { + enable = true, + update_root = false, + ignore_list = {}, + }, + ignore_ft_on_setup = {}, + system_open = { + cmd = "", + args = {}, + }, + diagnostics = { + enable = false, + show_on_dirs = false, + debounce_delay = 50, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + filters = { + dotfiles = false, + custom = {}, + exclude = {}, + }, + filesystem_watchers = { + enable = true, + debounce_delay = 50, + }, + git = { + enable = true, + ignore = true, + show_on_dirs = true, + timeout = 400, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", }, - hijack_directories = { + }, + open_file = { + quit_on_open = false, + resize_window = true, + window_picker = { enable = true, - auto_open = true, - }, - update_focused_file = { - enable = true, - update_root = false, - ignore_list = {}, - }, - ignore_ft_on_setup = {}, - system_open = { - cmd = "", - args = {}, - }, - diagnostics = { - enable = false, - show_on_dirs = false, - debounce_delay = 50, - icons = { - hint = "", - info = "", - warning = "", - error = "", + chars = "abcdefghijklmnopqrstuvwxyz1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, }, }, - filters = { - dotfiles = false, - custom = {}, - exclude = {}, - }, - filesystem_watchers = { - enable = true, - debounce_delay = 50, - }, - git = { - enable = true, - ignore = true, - show_on_dirs = true, - timeout = 400, - }, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - restrict_above_cwd = false, - }, - expand_all = { - max_folder_discovery = 300, - exclude = {}, - }, - file_popup = { - open_win_config = { - col = 1, - row = 1, - relative = "cursor", - border = "shadow", - style = "minimal", - }, - }, - open_file = { - quit_on_open = false, - resize_window = true, - window_picker = { - enable = true, - chars = "abcdefghijklmnopqrstuvwxyz1234567890", - exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "nofile", "terminal", "help" }, - }, - }, - }, - remove_file = { - close_window = true, - }, - }, - trash = { - cmd = "gio trash", - require_confirm = true, - }, - live_filter = { - prefix = "[FILTER]: ", - always_show_folders = true, - }, - log = { - enable = false, - truncate = false, - types = { - all = false, - config = false, - copy_paste = false, - dev = false, - diagnostics = false, - git = false, - profile = false, - watcher = false, - }, - }, - } + }, + remove_file = { + close_window = true, + }, + }, + trash = { + cmd = "gio trash", + require_confirm = true, + }, + live_filter = { + prefix = "[FILTER]: ", + always_show_folders = true, + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + dev = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, + }, +} -- nvim-tree is also there in modified buffers so this function filter it out local modifiedBufs = function(bufs) - local t = 0 - for k,v in pairs(bufs) do - if v.name:match("NvimTree_") == nil then - t = t + 1 - end + local t = 0 + for k, v in pairs(bufs) do + if v.name:match("NvimTree_") == nil then + t = t + 1 end - return t + end + return t end vim.api.nvim_create_autocmd("BufEnter", { - nested = true, - callback = function() - if #vim.api.nvim_list_wins() == 1 and + nested = true, + callback = function() + if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil and - modifiedBufs(vim.fn.getbufinfo({bufmodified = 1})) == 0 then - vim.cmd "quit" - end + modifiedBufs(vim.fn.getbufinfo({ bufmodified = 1 })) == 0 then + vim.cmd "quit" end + end }) diff --git a/nvim/lua/settings/options.lua b/nvim/lua/settings/options.lua index 61acc01..c260241 100644 --- a/nvim/lua/settings/options.lua +++ b/nvim/lua/settings/options.lua @@ -1,28 +1,28 @@ local options = { - clipboard = "unnamedplus", - mouse = "n", - fileencoding = "utf-8", - relativenumber = true, + clipboard = "unnamedplus", + mouse = "n", + fileencoding = "utf-8", + relativenumber = true, cursorline = false, number = true, - smartindent = true, - smartcase = true, - showmode = true, - termguicolors = true, - ignorecase = true, - showtabline = 2, - timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds) - undofile = true, -- enable persistent undoi updatetime = 300, -- faster completion (4000ms default) - writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited - expandtab = true, -- convert tabs to spaces - shiftwidth = 2, -- the number of spaces inserted for each indentation - tabstop = 2, -- insert 2 spaces for a tab - scrolloff = 8, - sidescrolloff = 8, - spell = true, + smartindent = true, + smartcase = true, + showmode = true, + termguicolors = true, + ignorecase = true, + showtabline = 2, + timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds) + undofile = true, -- enable persistent undoi updatetime = 300, -- faster completion (4000ms default) + writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited + expandtab = true, -- convert tabs to spaces + shiftwidth = 2, -- the number of spaces inserted for each indentation + tabstop = 2, -- insert 2 spaces for a tab + scrolloff = 8, + sidescrolloff = 8, + spell = true, syntax = "off", - spelllang = "en_us", - mousemodel = "popup_setpos", + spelllang = "en_us", + mousemodel = "popup_setpos", shell = "/usr/bin/zsh" } @@ -34,5 +34,5 @@ vim.g.mapleader = " " vim.keymap.set("n", "", "", { silent = true, noremap = false }) for k, v in pairs(options) do - vim.opt[k] = v + vim.opt[k] = v end diff --git a/nvim/lua/settings/pairs.lua b/nvim/lua/settings/pairs.lua index ddbd181..502be27 100644 --- a/nvim/lua/settings/pairs.lua +++ b/nvim/lua/settings/pairs.lua @@ -1,36 +1,36 @@ -- Setup nvim-cmp. local status_ok, npairs = pcall(require, "nvim-autopairs") if not status_ok then - return + return end local Rule = require('nvim-autopairs.rule') npairs.setup({ - check_ts = true, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - fast_wrap = { - map = "", - chars = { "{", "[", "(", "<", '"', "'"}, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + fast_wrap = { + map = "", + chars = { "{", "[", "(", "<", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, }) -npairs.add_rule(Rule("<",">")) +npairs.add_rule(Rule("<", ">")) local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then - return + return end cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) diff --git a/nvim/lua/settings/plugins.lua b/nvim/lua/settings/plugins.lua index 2a41e79..67e07fb 100644 --- a/nvim/lua/settings/plugins.lua +++ b/nvim/lua/settings/plugins.lua @@ -49,13 +49,12 @@ Plug('sudormrfbin/cheatsheet.nvim') -- cheatsheet for keymaps Plug('jvgrootveld/telescope-zoxide') -- zoxide integration Plug('ThePrimeagen/harpoon') -- harpoonman Plug 'folke/trouble.nvim' -- provides warning/error explanation tab -Plug('akinsho/toggleterm.nvim',{ ["tag"] = "*" }) -- better terminal integration +Plug('akinsho/toggleterm.nvim',{ ["tag"] = "*" }) -- better terminal integration Plug("iamcco/markdown-preview.nvim", -- markdown preview { ["do"] = "cd app && yarn install" }) Plug('p00f/clangd_extensions.nvim') -- clangd_extensions -Plug('jose-elias-alvarez/typescript.nvim') -- typescript extensions -Plug('kdarkhan/rust-tools.nvim') -- rust extensions +Plug('kdarkhan/rust-tools.nvim') -- rust extensions +Plug('lvimuser/lsp-inlayhints.nvim') -- inlay hints Plug('preservim/tagbar') -- tags on the right -Plug('lukas-reineke/lsp-format.nvim') vim.call("plug#end") diff --git a/nvim/lua/settings/project.lua b/nvim/lua/settings/project.lua index 10fc2e8..88ec927 100644 --- a/nvim/lua/settings/project.lua +++ b/nvim/lua/settings/project.lua @@ -1,6 +1,6 @@ local tele_status_ok, telescope = pcall(require, "telescope") if not tele_status_ok then - return + return end telescope.load_extension("project") @@ -10,10 +10,10 @@ require('telescope').setup { project = { base_dirs = { '~/dev/src', - {'~/dev/src2'}, - {'~/dev/src3', max_depth = 4}, - {path = '~/dev/src4'}, - {path = '~/dev/src5', max_depth = 2}, + { '~/dev/src2' }, + { '~/dev/src3', max_depth = 4 }, + { path = '~/dev/src4' }, + { path = '~/dev/src5', max_depth = 2 }, }, hidden_files = true, -- default: false theme = "dropdown", diff --git a/nvim/lua/settings/telescope.lua b/nvim/lua/settings/telescope.lua index 40bdf1a..92a8492 100644 --- a/nvim/lua/settings/telescope.lua +++ b/nvim/lua/settings/telescope.lua @@ -1,4 +1,3 @@ - local t = require("telescope") local z_utils = require("telescope._extensions.zoxide.utils") diff --git a/nvim/lua/settings/treesitter.lua b/nvim/lua/settings/treesitter.lua index f6162fc..e611e90 100644 --- a/nvim/lua/settings/treesitter.lua +++ b/nvim/lua/settings/treesitter.lua @@ -1,37 +1,37 @@ local status_ok, _ = pcall(require, "nvim-treesitter.configs") if not status_ok then - return + return end require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" - ensure_installed = { - "latex", - "c", - "cpp", - "rust", - "lua", - "haskell", - "java", - "javascript", - "typescript", - "python", - "html", - "css", - "yaml", - "bash", - "json", - "c_sharp", - }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, + -- A list of parser names, or "all" + ensure_installed = { + "latex", + "c", + "cpp", + "rust", + "lua", + "haskell", + "java", + "javascript", + "typescript", + "python", + "html", + "css", + "yaml", + "bash", + "json", + "c_sharp", + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, }) local status_ok2, _ = pcall(require, "spellsitter") if not status_ok2 then - return + return end require("spellsitter").setup()