From 87d465d5d5c1b327654e687b674a1f56e93c0271 Mon Sep 17 00:00:00 2001 From: Julius Waldmann Date: Thu, 1 Aug 2024 18:42:52 +0200 Subject: [PATCH] look and md --- after/plugin/barbar.lua | 180 ++++++++++++++++++++++++++++++++ after/plugin/colors.lua | 54 ---------- after/plugin/lsp.lua | 9 ++ lazy-lock.json | 5 + lua/juliuswaldmann/lazynvim.lua | 38 +++++++ 5 files changed, 232 insertions(+), 54 deletions(-) create mode 100644 after/plugin/barbar.lua delete mode 100644 after/plugin/colors.lua diff --git a/after/plugin/barbar.lua b/after/plugin/barbar.lua new file mode 100644 index 0000000..cbdb120 --- /dev/null +++ b/after/plugin/barbar.lua @@ -0,0 +1,180 @@ +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +-- Move to previous/next +map('n', '', 'BufferPrevious', opts) +map('n', '', 'BufferNext', opts) +-- Re-order to previous/next +map('n', '', 'BufferMovePrevious', opts) +map('n', '>', 'BufferMoveNext', opts) +-- Goto buffer in position... +map('n', '', 'BufferGoto 1', opts) +map('n', '', 'BufferGoto 2', opts) +map('n', '', 'BufferGoto 3', opts) +map('n', '', 'BufferGoto 4', opts) +map('n', '', 'BufferGoto 5', opts) +map('n', '', 'BufferGoto 6', opts) +map('n', '', 'BufferGoto 7', opts) +map('n', '', 'BufferGoto 8', opts) +map('n', '', 'BufferGoto 9', opts) +map('n', '', 'BufferLast', opts) +-- Pin/unpin buffer +map('n', '', 'BufferPin', opts) +-- Close buffer +map('n', '', 'BufferClose', opts) +-- Wipeout buffer +-- :BufferWipeout +-- Close commands +-- :BufferCloseAllButCurrent +-- :BufferCloseAllButPinned +-- :BufferCloseAllButCurrentOrPinned +-- :BufferCloseBuffersLeft +-- :BufferCloseBuffersRight +-- Magic buffer-picking mode +map('n', '', 'BufferPick', opts) +-- Sort automatically by... +map('n', 'bb', 'BufferOrderByBufferNumber', opts) +map('n', 'bn', 'BufferOrderByName', opts) +map('n', 'bd', 'BufferOrderByDirectory', opts) +map('n', 'bl', 'BufferOrderByLanguage', opts) +map('n', 'bw', 'BufferOrderByWindowNumber', opts) + +-- Other: +-- :BarbarEnable - enables barbar (enabled by default) +-- :BarbarDisable - very bad command, should never be used + + +require'barbar'.setup { + -- WARN: do not copy everything below into your config! + -- It is just an example of what configuration options there are. + -- The defaults are suitable for most people. + + -- Enable/disable animations + animation = true, + + -- Automatically hide the tabline when there are this many buffers left. + -- Set to any value >=0 to enable. + auto_hide = false, + + -- Enable/disable current/total tabpages indicator (top right corner) + tabpages = true, + + -- Enables/disable clickable tabs + -- - left-click: go to buffer + -- - middle-click: delete buffer + clickable = true, + + -- Excludes buffers from the tabline + exclude_ft = {'javascript'}, + exclude_name = {'package.json'}, + + -- A buffer to this direction will be focused (if it exists) when closing the current buffer. + -- Valid options are 'left' (the default), 'previous', and 'right' + focus_on_close = 'left', + + -- Hide inactive buffers and file extensions. Other options are `alternate`, `current`, and `visible`. + --hide = {extensions = true, inactive = true}, + + -- Disable highlighting alternate buffers + highlight_alternate = false, + + -- Disable highlighting file icons in inactive buffers + highlight_inactive_file_icons = false, + + -- Enable highlighting visible buffers + highlight_visible = true, + + icons = { + -- Configure the base icons on the bufferline. + -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript' + buffer_index = true, + buffer_number = false, + button = '', + -- Enables / disables diagnostic symbols + diagnostics = { + [vim.diagnostic.severity.ERROR] = {enabled = true, icon = 'ff'}, + [vim.diagnostic.severity.WARN] = {enabled = false}, + [vim.diagnostic.severity.INFO] = {enabled = false}, + [vim.diagnostic.severity.HINT] = {enabled = true}, + }, + gitsigns = { + added = {enabled = true, icon = '+'}, + changed = {enabled = true, icon = '~'}, + deleted = {enabled = true, icon = '-'}, + }, + filetype = { + -- Sets the icon's highlight group. + -- If false, will use nvim-web-devicons colors + custom_colors = false, + + -- Requires `nvim-web-devicons` if `true` + enabled = true, + }, + separator = {left = '▎', right = ''}, + + -- If true, add an additional separator at the end of the buffer list + separator_at_end = true, + + -- Configure the icons on the bufferline when modified or pinned. + -- Supports all the base icon options. + modified = {button = '●'}, + pinned = {button = '', filename = true}, + + -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted' + preset = 'default', + + -- Configure the icons on the bufferline based on the visibility of a buffer. + -- Supports all the base icon options, plus `modified` and `pinned`. + alternate = {filetype = {enabled = false}}, + current = {buffer_index = true}, + inactive = {button = '×'}, + visible = {modified = {buffer_number = false}}, + }, + + -- If true, new buffers will be inserted at the start/end of the list. + -- Default is to insert after current buffer. + insert_at_end = false, + insert_at_start = false, + + -- Sets the maximum padding width with which to surround each tab + maximum_padding = 1, + + -- Sets the minimum padding width with which to surround each tab + minimum_padding = 1, + + -- Sets the maximum buffer name length. + maximum_length = 30, + + -- Sets the minimum buffer name length. + minimum_length = 0, + + -- If set, the letters for each buffer in buffer-pick mode will be + -- assigned based on their name. Otherwise or in case all letters are + -- already assigned, the behavior is to assign letters in order of + -- usability (see order below) + semantic_letters = true, + + -- Set the filetypes which barbar will offset itself for + sidebar_filetypes = { + -- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'} + NvimTree = true, + -- Or, specify the text used for the offset: + undotree = { + text = 'undotree', + align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right') + }, + -- Or, specify the event which the sidebar executes when leaving: + ['neo-tree'] = {event = 'BufWipeout'}, + -- Or, specify all three + Outline = {event = 'BufWinLeave', text = 'symbols-outline', align = 'right'}, + }, + + -- New buffer letters are assigned in this order. This order is + -- optimal for the qwerty keyboard layout but might need adjustment + -- for other layouts. + letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP', + + -- Sets the name of unnamed buffers. By default format is "[Buffer X]" + -- where X is the buffer number. But only a static string is accepted here. + no_name_title = nil, +} diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua deleted file mode 100644 index a7937f6..0000000 --- a/after/plugin/colors.lua +++ /dev/null @@ -1,54 +0,0 @@ -function LineNumberColors() - vim.api.nvim_set_hl(0, 'LineNrAbove', { fg='#51B3EC', bold=true }) - vim.api.nvim_set_hl(0, 'LineNr', { fg='white', bold=true }) - vim.api.nvim_set_hl(0, 'LineNrBelow', { fg='#FB508F', bold=true }) - vim.o.signcolumn = "auto" - vim.o.numberwidth = 1 -end - ---local function set_terminal_mode_statuscolumn() --- vim.wo.relativenumber = true --- vim.wo.number = true --- vim.wo.statuscolumn = [[%=%{&number ? (v:relnum == 0 ? '~' : printf('%1d', v:relnum)) : ''}]] ---end --- ----- Function to reset status column back to default ---local function reset_normal_mode_statuscolumn() --- vim.wo.relativenumber = true --- vim.wo.number = true --- --vim.wo.statuscolumn = [[%=%{v:relnum ? printf('%1d', v:relnum) : printf('%1d', v:lnum)}]] --- --vim.wo.statuscolumn = [[%=%{&number ? (v:relnum == 0 ? printf('%1d', v:lnum) : printf('%1d', v:relnum)) : ''}]] --- vim.wo.statuscolumn = [[%=%{printf('1%d', v:relnum)}]] ---end --- ---vim.api.nvim_create_augroup('TerminalModeStatusColumn', { clear = true }) --- ---vim.api.nvim_create_autocmd('TermEnter', { --- group = 'TerminalModeStatusColumn', --- pattern = '*', --- callback = function() --- LineNumberColors() --- set_terminal_mode_statuscolumn() --- end ---}) --- ---vim.api.nvim_create_autocmd('TermLeave', { --- group = 'TerminalModeStatusColumn', --- pattern = '*', --- callback = function() --- LineNumberColors() --- reset_normal_mode_statuscolumn() --- end ---}) --- ---vim.api.nvim_create_autocmd('CursorMoved', { --- group = 'TerminalModeStatusColumn', --- pattern = '*', --- callback = function() --- if vim.bo.buftype == 'terminal' then --- set_terminal_mode_statuscolumn() --- end --- end, ---}) - ---LineNumberColors() diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index c8588f9..d075095 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -37,6 +37,15 @@ cmp.setup({ {name = 'nvim_lua'}, {name = 'luasnip', keyword_length = 2}, {name = 'buffer', keyword_length = 3}, + { + name = 'look', + keyword_length = 2, + option = { + convert_case = true, + loud = true + --dict = '/usr/share/dict/words' + } + }, }, formatting = lsp_zero.cmp_format(), mapping = cmp.mapping.preset.insert({ diff --git a/lazy-lock.json b/lazy-lock.json index d97a93e..313624d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,14 +1,19 @@ { "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, + "barbar.nvim": { "branch": "master", "commit": "79f7d16578a167bdf5355725551ef7d90613a601" }, + "cmp-look": { "branch": "master", "commit": "971e65a6be0e75c3438fe7b176d4fc020cb89d7b" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "conform.nvim": { "branch": "master", "commit": "6dc1603ea408f476a57937bbeaf7f86520a21a98" }, "cutlass.nvim": { "branch": "main", "commit": "1ac7e4b53d79410be52a9e464d44c60556282b3e" }, + "flatten.nvim": { "branch": "main", "commit": "e420e531d2ab24aebcf7b3c9fca28e6c5c34964d" }, "fzf-lua": { "branch": "main", "commit": "9c953dfa7650191d892800333d187f3439e01afd" }, + "gitsigns.nvim": { "branch": "main", "commit": "bcae8395fb1033ed0340dd00d61b3bf050b1bd8e" }, "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, "instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" }, "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" }, "lsp-zero.nvim": { "branch": "v3.x", "commit": "d1114ca5ff28ffcd0bc2a3fdd4c13019b1c41812" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "05744f0f1967b5757bd05c08df4271ab8ec990aa" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "neovim": { "branch": "main", "commit": "17b466e79479758b332a3cac12544a3ad2be6241" }, diff --git a/lua/juliuswaldmann/lazynvim.lua b/lua/juliuswaldmann/lazynvim.lua index 963a0d5..7a31593 100644 --- a/lua/juliuswaldmann/lazynvim.lua +++ b/lua/juliuswaldmann/lazynvim.lua @@ -59,6 +59,7 @@ return lazy.setup({ "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", 'hrsh7th/nvim-cmp', + 'octaltree/cmp-look', 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip' }, @@ -139,6 +140,43 @@ return lazy.setup({ wilder.setup({modes = {':', '/', '?'}}) end, }, + { + "willothy/flatten.nvim", + config = true, + -- or pass configuration with + -- opts = { } + -- Ensure that it runs first to minimize delay when opening file from terminal + lazy = false, + priority = 1001, + }, + {'romgrk/barbar.nvim', + dependencies = { + 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status + 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons + }, + init = function() vim.g.barbar_auto_setup = false end, + opts = { + -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default: + -- animation = true, + -- insert_at_start = true, + -- …etc. + }, + version = '^1.0.0', -- optional: only update when a new 1.x version is released + }, + { + dir = "~/Documents/code/here.nvim", + name = "here", + config = function () + require("here") + end + }, + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() vim.fn["mkdp#util#install"]() end, + } + -- Uncomment these lines if you want to use the plugins -- use 'nvim-tree/nvim-tree.lua' -- use 'nvim-tree/nvim-web-devicons'