diff options
| author | Christian Chiarulli <[email protected]> | 2022-09-15 23:33:08 -0400 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-15 23:33:08 -0400 | 
| commit | a4c2dc4d0b638a50c3219f247b09e6238a44ec50 (patch) | |
| tree | 250527d4ca3a5644d6d6fbae80d9d5a2abee5b0d /lua/lvim/core | |
| parent | 464ad8b0035cbcaf4864d14da598b77a939026d8 (diff) | |
refactor: small improvements (#3021)
Diffstat (limited to 'lua/lvim/core')
| -rw-r--r-- | lua/lvim/core/alpha/dashboard.lua | 12 | ||||
| -rw-r--r-- | lua/lvim/core/autocmds.lua | 2 | ||||
| -rw-r--r-- | lua/lvim/core/autopairs.lua | 5 | ||||
| -rw-r--r-- | lua/lvim/core/bufferline.lua | 8 | ||||
| -rw-r--r-- | lua/lvim/core/builtins/init.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/core/cmp.lua | 2 | ||||
| -rw-r--r-- | lua/lvim/core/lir.lua | 90 | ||||
| -rw-r--r-- | lua/lvim/core/nvimtree.lua | 15 | ||||
| -rw-r--r-- | lua/lvim/core/terminal.lua | 4 | ||||
| -rw-r--r-- | lua/lvim/core/which-key.lua | 14 | 
10 files changed, 118 insertions, 35 deletions
| diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index d65980fb..9f235ce0 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -51,13 +51,13 @@ function M.get_sections()    local buttons = {      entries = { -      { "SPC f", "  Find File", "<CMD>Telescope find_files<CR>" }, -      { "SPC n", "  New File", "<CMD>ene!<CR>" }, -      { "SPC P", "  Recent Projects ", "<CMD>Telescope projects<CR>" }, -      { "SPC s r", "  Recently Used Files", "<CMD>Telescope oldfiles<CR>" }, -      { "SPC s t", "  Find Word", "<CMD>Telescope live_grep<CR>" }, +      { "f", "  Find File", "<CMD>Telescope find_files<CR>" }, +      { "n", "  New File", "<CMD>ene!<CR>" }, +      { "p", "  Recent Projects ", "<CMD>Telescope projects<CR>" }, +      { "r", "  Recently Used Files", "<CMD>Telescope oldfiles<CR>" }, +      { "t", "  Find Word", "<CMD>Telescope live_grep<CR>" },        { -        "SPC L c", +        "c",          "  Configuration",          "<CMD>edit " .. require("lvim.config"):get_user_config_path() .. " <CR>",        }, diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index f5c63588..ef7122e5 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -18,7 +18,7 @@ function M.load_defaults()          pattern = "*",          desc = "Highlight text on yank",          callback = function() -          require("vim.highlight").on_yank { higroup = "Search", timeout = 200 } +          require("vim.highlight").on_yank { higroup = "Search", timeout = 100 }          end,        },      }, diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua index 469a38a4..5daffba5 100644 --- a/lua/lvim/core/autopairs.lua +++ b/lua/lvim/core/autopairs.lua @@ -47,7 +47,10 @@ function M.config()  end  M.setup = function() -  local autopairs = require "nvim-autopairs" +  local status_ok, autopairs = pcall(require, "nvim-autopairs") +  if not status_ok then +    return +  end    local Rule = require "nvim-autopairs.rule"    autopairs.setup { diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index 36e5ff54..6ae0d6c6 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -140,7 +140,13 @@ end  M.setup = function()    require("lvim.keymappings").load(lvim.builtin.bufferline.keymap) -  require("bufferline").setup { + +  local status_ok, bufferline = pcall(require, "bufferline") +  if not status_ok then +    return +  end + +  bufferline.setup {      options = lvim.builtin.bufferline.options,      highlights = lvim.builtin.bufferline.highlights,    } diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 5cad2a00..03ee8aec 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,6 +9,7 @@ local builtins = {    "lvim.core.telescope",    "lvim.core.treesitter",    "lvim.core.nvimtree", +  "lvim.core.lir",    "lvim.core.project",    "lvim.core.bufferline",    "lvim.core.autopairs", diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 408691a6..8e954335 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -135,7 +135,7 @@ M.config = function()        keyword_length = 1,      },      experimental = { -      ghost_text = true, +      ghost_text = false,        native_menu = false,      },      formatting = { diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..e14e01cd --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,90 @@ +local M = {} + +M.config = function() +  local status_ok, lir = pcall(require, "lir") +  if not status_ok then +    return +  end + +  local actions = require "lir.actions" +  local mark_actions = require "lir.mark.actions" +  local clipboard_actions = require "lir.clipboard.actions" + +  lir.setup { +    show_hidden_files = false, +    devicons_enable = true, +    mappings = { +      ["l"] = actions.edit, +      ["<CR>"] = actions.edit, +      ["<C-s>"] = actions.split, +      ["v"] = actions.vsplit, +      ["<C-t>"] = actions.tabedit, + +      ["h"] = actions.up, +      ["q"] = actions.quit, + +      ["A"] = actions.mkdir, +      ["a"] = actions.newfile, +      ["r"] = actions.rename, +      ["@"] = actions.cd, +      ["Y"] = actions.yank_path, +      ["i"] = actions.toggle_show_hidden, +      ["d"] = actions.delete, + +      ["J"] = function() +        mark_actions.toggle_mark() +        vim.cmd "normal! j" +      end, +      ["c"] = clipboard_actions.copy, +      ["x"] = clipboard_actions.cut, +      ["p"] = clipboard_actions.paste, +    }, +    float = { +      winblend = 0, +      curdir_window = { +        enable = false, +        highlight_dirname = true, +      }, + +      -- -- You can define a function that returns a table to be passed as the third +      -- -- argument of nvim_open_win(). +      win_opts = function() +        local width = math.floor(vim.o.columns * 0.7) +        local height = math.floor(vim.o.lines * 0.7) +        return { +          border = "rounded", +          width = width, +          height = height, +          -- row = 1, +          -- col = math.floor((vim.o.columns - width) / 2), +        } +      end, +    }, +    hide_cursor = false, +    on_init = function() +      -- use visual mode +      vim.api.nvim_buf_set_keymap( +        0, +        "x", +        "J", +        ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>', +        { noremap = true, silent = true } +      ) + +      -- echo cwd +      -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) +    end, +  } + +  -- custom folder icon +  require("nvim-web-devicons").set_icon { +    lir_folder_icon = { +      icon = "", +      -- color = "#7ebae4", +      -- color = "#569CD6", +      color = "#42A5F5", +      name = "LirFolderNode", +    }, +  } +end +return M diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 15e80e85..372cd00f 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -6,26 +6,16 @@ function M.config()      active = true,      on_config_done = nil,      setup = { -      disable_netrw = true, -      hijack_netrw = true, -      open_on_setup = false, -      open_on_setup_file = false, -      sort_by = "name", -      ignore_buffer_on_setup = false,        ignore_ft_on_setup = {          "startify",          "dashboard",          "alpha",        },        auto_reload_on_write = true, -      hijack_unnamed_buffer_when_opening = false,        hijack_directories = { -        enable = true, -        auto_open = true, +        enable = false,        }, -      open_on_tab = false, -      hijack_cursor = false, -      update_cwd = false, +      update_cwd = true,        diagnostics = {          enable = lvim.use_icons,          show_on_dirs = false, @@ -55,7 +45,6 @@ function M.config()          height = 30,          hide_root_folder = false,          side = "left", -        preserve_window_proportions = false,          mappings = {            custom_only = false,            list = {}, diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 6f543d06..ac844b11 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -6,8 +6,8 @@ M.config = function()      on_config_done = nil,      -- size can be a number or function which is passed the current terminal      size = 20, -    -- open_mapping = [[<c-\>]], -    open_mapping = [[<c-t>]], +    open_mapping = [[<c-\>]], +    -- open_mapping = [[<c-t>]],      hide_numbers = true, -- hide the number column in toggleterm buffers      shade_filetypes = {},      shade_terminals = true, diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 2301943f..7d75dee1 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -6,8 +6,8 @@ M.config = function()      on_config_done = nil,      setup = {        plugins = { -        marks = true, -- shows a list of your marks on ' and ` -        registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode +        marks = false, -- shows a list of your marks on ' and ` +        registers = false, -- shows your registers on " in NORMAL or <C-r> in INSERT mode          -- the presets plugin, adds help for a bunch of default keybindings in Neovim          -- No actual key bindings are created          presets = { @@ -16,8 +16,8 @@ M.config = function()            text_objects = false, -- help for text objects triggered after entering an operator            windows = false, -- default bindings on <c-w>            nav = true, -- misc bindings to work with windows -          z = true, -- bindings for folds, spelling and others prefixed with z -          g = true, -- bindings for prefixed with g +          z = false, -- bindings for folds, spelling and others prefixed with z +          g = false, -- bindings for prefixed with g          },          spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints        }, @@ -170,12 +170,6 @@ M.config = function()            "Prev Diagnostic",          },          l = { vim.lsp.codelens.run, "CodeLens Action" }, -        p = { -          name = "Peek", -          d = { "<cmd>lua require('lvim.lsp.peek').Peek('definition')<cr>", "Definition" }, -          t = { "<cmd>lua require('lvim.lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" }, -          i = { "<cmd>lua require('lvim.lsp.peek').Peek('implementation')<cr>", "Implementation" }, -        },          q = { vim.diagnostic.setloclist, "Quickfix" },          r = { vim.lsp.buf.rename, "Rename" },          s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" }, | 
