~whynothugo/dotfiles

d693fc44137220a79c11510133f48b3acb24be52 — Hugo Osvaldo Barrera 9 days ago 43988dc
nvim: Avoid absurdly long lines
M home/.config/nvim/lua/_cmp.lua => home/.config/nvim/lua/_cmp.lua +3 -1
@@ 16,7 16,9 @@ cmp.setup({
    -- TODO: See these other mappings: https://github.com/hrsh7th/nvim-cmp#recommended-configuration
    --       The mapping to scroll the doc overlay might be handy.
    ["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
    ["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
    ["<S-Tab>"] = cmp.mapping.select_prev_item({
      behavior = cmp.SelectBehavior.Insert,
    }),
  },
  formatting = {
    format = function(entry, vim_item)

M home/.config/nvim/lua/_galaxyline.lua => home/.config/nvim/lua/_galaxyline.lua +3 -1
@@ 68,7 68,9 @@ sections.left[1] = {
      -- auto change color according the vim mode
      local mode = mode_map[vim.fn.mode()]

      vim.api.nvim_command("hi GalaxyViMode guifg=" .. colors.black .. " guibg=" .. mode[2])
      vim.api.nvim_command(
        "hi GalaxyViMode guifg=" .. colors.black .. " guibg=" .. mode[2]
      )
      return string.format("  %s ", mode[1])
    end,
  },

M home/.config/nvim/lua/_lightbulb.lua => home/.config/nvim/lua/_lightbulb.lua +4 -1
@@ 8,5 8,8 @@ vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
  end,
})

vim.fn.sign_define("LightBulbSign", { text = "", texthl = "", linehl = "", numhl = "" })
vim.fn.sign_define(
  "LightBulbSign",
  { text = "", texthl = "", linehl = "", numhl = "" }
)
-- TODO: Probably using the status bar is best.

M home/.config/nvim/lua/_symbols_outline.lua => home/.config/nvim/lua/_symbols_outline.lua +6 -1
@@ 1,6 1,11 @@
require("symbols-outline").setup({})

vim.api.nvim_set_keymap("n", "<Leader>v", "<Cmd>SymbolsOutline<CR>", { noremap = true, silent = false, expr = false })
vim.api.nvim_set_keymap(
  "n",
  "<Leader>v",
  "<Cmd>SymbolsOutline<CR>",
  { noremap = true, silent = false, expr = false }
)

-- TODO: Make this wider. Ideally, as big as necessary to fit everything,
-- to a max of 50 chars.

M home/.config/nvim/lua/lsp.lua => home/.config/nvim/lua/lsp.lua +5 -1
@@ 200,7 200,11 @@ local common_settings = {
-- Register all the LSP servers.
for server, config in pairs(servers) do
  -- Set default client capabilities plus window/workDoneProgress
  config.capabilities = vim.tbl_extend("keep", config.capabilities or {}, lsp_status.capabilities)
  config.capabilities = vim.tbl_extend(
    "keep",
    config.capabilities or {},
    lsp_status.capabilities
  )

  -- Merge per-LSP configs with the common settings, and use that:
  lspconfig[server].setup(vim.tbl_extend("keep", config, common_settings))

M home/.config/nvim/lua/mappings.lua => home/.config/nvim/lua/mappings.lua +49 -8
@@ 25,7 25,13 @@ vim.keymap.set("n", "<PageDown>", "<nop>")
vim.keymap.set("n", "<PageUp>", "<nop>")

-- Hide search result highlight:
vim.keymap.set("", "<Leader>f", ":nohlsearch<CR>", { remap = true }, { desc = "Stop highlighting search results." })
vim.keymap.set(
  "",
  "<Leader>f",
  ":nohlsearch<CR>",
  { remap = true },
  { desc = "Stop highlighting search results." }
)

-- Comment / uncomment blocks of code.
vim.keymap.set("", "<Leader>c", ":TComment<CR>", { remap = true })


@@ 55,16 61,46 @@ vim.keymap.set("n", "<Leader>tv", "<C-w>t<C-w>H")
-------------------------------------------------------------------------------

-- Switch between autocompletion options with Tab (or Shift+Tab) --------------
vim.keymap.set("i", "<TAB>", [[pumvisible() ? "\<C-n>" : "\<TAB>"]], { silent = true, expr = true })
vim.keymap.set("i", "<S-TAB>", [[pumvisible() ? "\<C-p>" : "\<TAB>"]], { silent = true, expr = true })
vim.keymap.set(
  "i",
  "<TAB>",
  [[pumvisible() ? "\<C-n>" : "\<TAB>"]],
  { silent = true, expr = true }
)
vim.keymap.set(
  "i",
  "<S-TAB>",
  [[pumvisible() ? "\<C-p>" : "\<TAB>"]],
  { silent = true, expr = true }
)
-------------------------------------------------------------------------------

-- Helper keys to resize splits -----------------------------------------------
-- They Ctrl+<directional keys> (hjkl).
vim.keymap.set("n", "<C-h>", [[:vertical resize -1<CR>]], { silent = true, desc = "Shirk window to the left." })
vim.keymap.set("n", "<C-j>", [[:resize +1<CR>]], { silent = true, desc = "Grow window downwards." })
vim.keymap.set("n", "<C-k>", [[:resize -1<CR>]], { silent = true, desc = "Shrink window upwards." })
vim.keymap.set("n", "<C-l>", [[:vertical resize +1<CR>]], { silent = true, desc = "Grow window to the right." })
vim.keymap.set(
  "n",
  "<C-h>",
  [[:vertical resize -1<CR>]],
  { silent = true, desc = "Shirk window to the left." }
)
vim.keymap.set(
  "n",
  "<C-j>",
  [[:resize +1<CR>]],
  { silent = true, desc = "Grow window downwards." }
)
vim.keymap.set(
  "n",
  "<C-k>",
  [[:resize -1<CR>]],
  { silent = true, desc = "Shrink window upwards." }
)
vim.keymap.set(
  "n",
  "<C-l>",
  [[:vertical resize +1<CR>]],
  { silent = true, desc = "Grow window to the right." }
)
-------------------------------------------------------------------------------

-- FZF mapping


@@ 110,7 146,12 @@ vim.keymap.set("n", "<Leader>i", breakPoint, { desc = "Insert a breakpoint." })

vim.keymap.set("n", "gd", vim.lsp.buf.definition, { remap = true })
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { remap = true })
vim.keymap.set("n", "<Leader>h", vim.lsp.buf.hover, { remap = true, desc = "Show hover details." })
vim.keymap.set(
  "n",
  "<Leader>h",
  vim.lsp.buf.hover,
  { remap = true, desc = "Show hover details." }
)
-- TODO: focus the hover float after creating it.
-- TODO: Also map <Esc> to closing it. The goal is to be able to easily scroll AND dismiss it.
vim.keymap.set("n", "<Leader>r", function()

M home/.config/nvim/stylua.toml => home/.config/nvim/stylua.toml +1 -0
@@ 1,2 1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 88