From 96705fe8092bc3438be440cb54ad7ff4072fced0 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Thu, 25 Jul 2024 20:59:11 -0500 Subject: [PATCH] gettin more nvim goodness going --- nvim/after/plugin/bufferline.lua | 4 + nvim/after/plugin/cmp.lua | 10 +++ nvim/after/plugin/cokeline.lua | 15 ++++ nvim/after/plugin/colors.lua | 3 +- nvim/after/plugin/lualine.lua | 42 +++++++++ nvim/after/plugin/signature_help.lua | 130 +++++++++++++++++++++++++++ nvim/after/plugin/supertab.lua | 2 + nvim/after/plugin/tree.lua | 44 +++++---- nvim/lua/keys.lua | 2 + nvim/lua/lsp.lua | 1 - nvim/lua/plugins.lua | 25 +++++- nvim/lua/prefs.lua | 1 + 12 files changed, 258 insertions(+), 21 deletions(-) create mode 100644 nvim/after/plugin/bufferline.lua create mode 100644 nvim/after/plugin/cmp.lua create mode 100644 nvim/after/plugin/cokeline.lua create mode 100644 nvim/after/plugin/lualine.lua create mode 100644 nvim/after/plugin/signature_help.lua create mode 100644 nvim/after/plugin/supertab.lua diff --git a/nvim/after/plugin/bufferline.lua b/nvim/after/plugin/bufferline.lua new file mode 100644 index 0000000..049de32 --- /dev/null +++ b/nvim/after/plugin/bufferline.lua @@ -0,0 +1,4 @@ +local bufferline = require("bufferline") + +bufferline.setup({ +}) diff --git a/nvim/after/plugin/cmp.lua b/nvim/after/plugin/cmp.lua new file mode 100644 index 0000000..e6b880f --- /dev/null +++ b/nvim/after/plugin/cmp.lua @@ -0,0 +1,10 @@ +-- local cmp = require("cmp") +-- +-- if cmp then +-- cmp.setup({ +-- sources = cmp.config.sources({ +-- { name = "nvim_lsp" }, +-- }) +-- }) +-- end +-- diff --git a/nvim/after/plugin/cokeline.lua b/nvim/after/plugin/cokeline.lua new file mode 100644 index 0000000..86ab02b --- /dev/null +++ b/nvim/after/plugin/cokeline.lua @@ -0,0 +1,15 @@ +-- local cokeline = require('cokeline') +-- +-- cokeline.setup({ +-- -- only show the buffer line if there are at least this many buffers +-- show_if_buffers_are_at_least = 1, +-- +-- history = { +-- enabled = true, +-- size = 4, +-- }, +-- +-- rendering = { +-- max_buffer_width = 999, +-- }, +-- }) diff --git a/nvim/after/plugin/colors.lua b/nvim/after/plugin/colors.lua index cfb21c3..feb58c3 100644 --- a/nvim/after/plugin/colors.lua +++ b/nvim/after/plugin/colors.lua @@ -6,4 +6,5 @@ background["256ctermbg"] = 'none' background["guibg"] = 'none' vim.g.jellybeans_overrides = { background = background } -vim.cmd.colorscheme("jellybeans") +-- vim.cmd.colorscheme("jellybeans") +vim.cmd.colorscheme("kanagawa") diff --git a/nvim/after/plugin/lualine.lua b/nvim/after/plugin/lualine.lua new file mode 100644 index 0000000..34b4295 --- /dev/null +++ b/nvim/after/plugin/lualine.lua @@ -0,0 +1,42 @@ +local line = require('lualine') + +line.setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/nvim/after/plugin/signature_help.lua b/nvim/after/plugin/signature_help.lua new file mode 100644 index 0000000..f1d3b3e --- /dev/null +++ b/nvim/after/plugin/signature_help.lua @@ -0,0 +1,130 @@ +local signature = require("lsp_signature") + +signature.setup({ + -- set to true to enable debug logging + debug = false, + + -- log dir when debug is on + -- default is ~/.cache/nvim/lsp_signature.log + log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", + + -- show debug line number + verbose = false, + + -- This is mandatory, otherwise border config won't get registered. + -- If you want to hook lspsaga or other signature handler, pls set to false + bind = true, + + -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); + -- set to 0 if you DO NOT want any API comments be shown + -- This setting only take effect in insert mode, it does not affect signature help in normal + -- mode, 10 by default + doc_lines = 0, + + -- max height of signature floating_window + max_height = 12, + + -- max_width of signature floating_window, line will be wrapped if exceed max_width + -- the value need >= 40 + max_width = 80, + + -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long + wrap = true, + + -- show hint in a floating window, set to false for virtual text only mode + floating_window = true, + + -- try to place the floating above the current line when possible Note: + -- will set to true when fully tested, set to false will use whichever side has more space + -- this setting will be helpful if you do not want the PUM and floating win overlap + floating_window_above_cur_line = true, + + -- adjust float windows x position. + -- can be either a number or function + floating_window_off_x = -8, + + -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines + -- can be either number or function, see examples + floating_window_off_y = 14, + + -- close floating window after ms when laster parameter is entered + close_timeout = 4000, + + -- set to true, the floating window will not auto-close until finish all parameters + fix_pos = false, + + -- virtual hint enable + hint_enable = true, + + -- Panda for parameter, NOTE: for the terminal not support emoji, might crash + -- or, provide a table with 3 icons + -- hint_prefix = { + -- above = "↙ ", -- when the hint is on the line above the current line + -- current = "← ", -- when the hint is on the same line + -- below = "↖ " -- when the hint is on the line below the current line + -- } + hint_prefix = "🐼 ", + + hint_scheme = "String", + + -- should the hint be inline(nvim 0.10 only)? default false + -- return true | 'inline' to show hint inline, return 'eol' to show hint at end of line, return false to disable + -- return 'right_align' to display hint right aligned in the current line + hint_inline = function() return false end, + + -- how your parameter will be highlight + hi_parameter = "LspSignatureActiveParameter", + + handler_opts = { + -- double, rounded, single, shadow, none, or a table of borders + border = "rounded" + }, + + -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 + always_trigger = false, + + -- autoclose signature float win after x sec, disabled if nil. + auto_close_after = nil, + + -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} + extra_trigger_chars = {}, + + -- by default it will be on top of all floating windows, set to <= 50 send it to bottom + zindex = 200, + + -- character to pad on left and right of signature can be ' ', or '|' etc + padding = '', + + -- disabled by default, allow floating win transparent value 1~100 + transparency = nil, + + -- if you using shadow as border use this set the opacity + shadow_blend = 36, + + -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' + shadow_guibg = 'Black', + + -- default timer check interval set to lower value if you want to reduce latency + timer_interval = 200, + + -- toggle signature on and off in insert mode, e.g. toggle_key = '' + toggle_key = nil, + + -- true: toggle floating_windows: true|false setting after toggle key pressed + -- false: floating_windows setup will not change, toggle_key will pop up signature helper, but signature + -- may not popup when typing depends on floating_window setting + toggle_key_flip_floatwin_setting = false, + + -- cycle to next signature, e.g. '' function overloading + select_signature_key = nil, + + -- imap, use nvim_set_current_win to move cursor between current win and floating window + -- e.g. move_cursor_key = '', + -- once moved to floating window, you can use , to move cursor up and down + move_cursor_key = nil, + + -- relate to move_cursor_key; the keymaps inside floating window + -- e.g. keymaps = { 'j', 'j' } this map j to j in floating window + -- and are default keymaps to move cursor up and down + keymaps = {} +}) diff --git a/nvim/after/plugin/supertab.lua b/nvim/after/plugin/supertab.lua new file mode 100644 index 0000000..71cf727 --- /dev/null +++ b/nvim/after/plugin/supertab.lua @@ -0,0 +1,2 @@ +vim.g.SuperTabDefaultCompletionType = "" +vim.g.SuperTabClosePreviewOnPopupClose = 1 diff --git a/nvim/after/plugin/tree.lua b/nvim/after/plugin/tree.lua index 1ae7265..369d556 100644 --- a/nvim/after/plugin/tree.lua +++ b/nvim/after/plugin/tree.lua @@ -1,19 +1,27 @@ -require("nvim-tree").setup({ - git = { enable = false }, - renderer = { - icons = { - show = { - folder_arrow = false - }, - glyphs = { - default = "⚬", - folder = { - default = "▸", - open = "▾", - empty = "▹", - empty_open = "▿", - } - }, - } - } +-- require("nvim-tree").setup({ +-- git = { enable = false }, +-- renderer = { +-- icons = { +-- show = { +-- folder_arrow = false +-- }, +-- glyphs = { +-- default = "⚬", +-- folder = { +-- default = "▸", +-- open = "▾", +-- empty = "▹", +-- empty_open = "▿", +-- } +-- }, +-- } +-- } +-- }) + +local tree = require("neo-tree") + +tree.setup({ + close_if_last_window = false, + popup_border_style = "rounded", + enable_git_status = true, }) diff --git a/nvim/lua/keys.lua b/nvim/lua/keys.lua index e15d17c..c8c1ea3 100644 --- a/nvim/lua/keys.lua +++ b/nvim/lua/keys.lua @@ -3,6 +3,8 @@ local etc = require("etc") vim.keymap.set('n', '', etc.project_files, {}) vim.keymap.set('n', '', telescope.diagnostics, {}) vim.keymap.set('n', 'o', telescope.buffers, {}) +vim.keymap.set('n', '', vim.cmd.bnext, {}) +vim.keymap.set('n', '', vim.cmd.bprev, {}) -- vim.keymap.set("v", "J", ":m '>+1gv=gv") -- vim.keymap.set("v", "K", ":m '>-2gv=gv") diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index 54cc59b..68e62d8 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -1,7 +1,6 @@ vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) -- this code is run every time we attach an LSP - print("LSP Attached") end, }) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 3ad4ebc..fb93371 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -27,6 +27,16 @@ function load_plugins(use) -- colorschemes use { "rose-pine/neovim", as = "rose-pine" } use { "nanotech/jellybeans.vim", as = "jellybeans" } + use { "rebelot/kanagawa.nvim", as = "kanagawa" } + use { "sho-87/kanagawa-paper.nvim", as = "kanagawa-paper" } + + -- fancy status bar line + use { + 'nvim-lualine/lualine.nvim', + requires = { 'nvim-tree/nvim-web-devicons', opt = true } + } + + use {'akinsho/bufferline.nvim', tag = "*", requires = 'nvim-tree/nvim-web-devicons'} -- hmmmm try this? -- https://github.com/ThePrimeagen/harpoon/tree/harpoon2 @@ -42,8 +52,21 @@ function load_plugins(use) "lewis6991/gitsigns.nvim" } + use { "ray-x/lsp_signature.nvim" } + use { "ervandew/supertab" } + -- a file browser - use { "nvim-tree/nvim-tree.lua" } + -- use { "nvim-tree/nvim-tree.lua" } + use { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + requires = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + } + } -- helps you configure lsp servers use { diff --git a/nvim/lua/prefs.lua b/nvim/lua/prefs.lua index 4fab5f3..60ac3cd 100644 --- a/nvim/lua/prefs.lua +++ b/nvim/lua/prefs.lua @@ -73,6 +73,7 @@ vim.opt.showmode = false vim.opt.splitright = true vim.opt.splitbelow = true +vim.opt.completeopt="menu,menuone,preview,noselect,noinsert" -- double-tap escape to exit terminal mode vim.keymap.set('t', '', '', {