Skip to content

Instantly share code, notes, and snippets.

@DougAnderson444
Created October 6, 2023 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DougAnderson444/63d59ee4b89e22eb903c84b5924836f0 to your computer and use it in GitHub Desktop.
Save DougAnderson444/63d59ee4b89e22eb903c84b5924836f0 to your computer and use it in GitHub Desktop.
Initial ChadRC File
local M = {}
M.plugins = "custom.plugins"
-- key mapping file
M.mappings = require "custom.mappings"
-- set our custom plugins.lua file here
M.ui = {
theme = "chadracula",
hl_override = {
-- NvimTreeFolderName = { fg = "orange", bold = true }, -- works
Cursor = { bg = "pink" }, -- works
-- TermCursor = { bg = "orange" }, -- kinds works, soetimes
LspReferenceText = { fg = "#3ba1c5", bg = "#e9f5f9" }, -- works
LspReferenceRead = { fg = "green", bg = "purple" },
LspReferenceWrite = { fg = "green", bg = "lightblue" },
},
hl_add = {
FloatBorder = { fg = "green" }, -- works
NormalFloat = { fg = "green" }, -- works
-- NormalInactive = { fg = "lightblue" }, -- works
NvimTreeCursorLine = { bg = "lightblue" },
},
FloatBorder = { fg = "blue" },
telescope = { style = "bordered" },
changed_themes = {
chadracula = {},
},
statusline = {
theme = "default",
-- ensure column shows
overriden_modules = function(modules)
-- check to ensure nvchad.statusline.default is loaded first
-- if not, return
-- if not require "nvchad.statusline.default" then
-- return
-- end
local st_modules = require "nvchad.statusline.default"
local sep_r = " "
local modes = st_modules.modes
modes["n"][3] = "  "
modes["v"][3] = "  "
modes["i"][3] = "  "
modes["t"][3] = "  "
table.insert(
modules,
2,
(function()
-- path with '/filename.ext' removed:
local path = vim.api.nvim_buf_get_name(0):match "^.*/"
-- check if pathe xists
if not path then
return
end
return "%#St_LspStatus#" .. path -- https://github.com/NvChad/base46/blob/v2.0/lua/base46/integrations/statusline.lua
end)()
)
-- insert line and column at the end of the modules
table.insert(modules, "Ln %l, %c")
--from https://github.com/NvChad/ui/issues/129
modules[1] = (function()
local m = vim.api.nvim_get_mode().mode
local current_mode = "%#" .. modes[m][2] .. "#" .. (modes[m][3] or "  !") .. modes[m][1]
local right_sep = "%#" .. modes[m][2] .. "Sep" .. "#" .. sep_r
return current_mode .. right_sep .. "%#ST_EmptySpace#" .. sep_r
end)()
end,
},
}
return M
@DougAnderson444
Copy link
Author

Some mappings:

-- Douglas' custom mappings
M.douglasmappings = {
  -- normal mode
  n = {
    ["<C-t>"] = { ":TroubleToggle<CR>", "Trouble Sidebar" },
    -- Press F4 to find and replace
    ["<F4>"] = { ":%s/<c-r><c-w>/<c-r><c-w>/gc<c-f>$F/i", "Find and Replace" },
    -- Ctrl-Shift- right arrow to select word (<ESC>wviw)
    ["<C-S-Right>"] = { "<ESC>wviw", "Select word" },
    ["<C-z>"] = { "u", "Undo" },
    -- toggle line numbers with <leader>ln (leader is space)
    ["<leader>ln"] = { ":set number<CR>", "Toggle line numbers" },
    ["<C-s>"] = { ":wa<CR>", "Quick save all" },
  },
  -- insert mode
  i = {
    ["kj"] = { "<ESC>", "escape insert mode", opts = { nowait = true } },
    -- Ctrl-v to paste
    ["<C-v>"] = { "<ESC>pa", "Paste" },
    -- Ctrl-z to undo (like in terminal)
    ["<C-z>"] = { "<ESC>ua", "Undo" },
    -- Ctrl-Shift- right arrow to select word (<ESC>wviw)
    ["<C-S-Right>"] = { "<ESC>wviw", "Select word" },
    ["<C-s>"] = { "<cmd>wa<CR>", "Quick save all" },
  },
  -- visual mode
  v = {
    -- Ctrl-x to cut
    ["<C-x>"] = { "x", "Cut" },
  },
  t = {
    -- Map Esc to Ctrl-\ Ctrl=n
    ["<Esc>"] = { "<C-\\><C-n>", "Exit terminal" },
    ["<C-t>"] = { ":TroubleToggle<CR>", "Trouble Sidebar" },
  },
}

@DougAnderson444
Copy link
Author

DougAnderson444 commented Oct 6, 2023

Some nvim-tree overrides:

-- custom/plugins.lua
 {
    "nvim-tree/nvim-tree.lua",
    opts = overrides.nvimtree,
  },
-- custom/configs/overrides.lua
-- :help nvim-tree
M.nvimtree = {
  git = {
    enable = true,
    ignore = false,
    show_on_dirs = true,
    show_on_open_dirs = true,
  },
  diagnostics = {
    enable = true,
    icons = {
      hint = "",
      info = "",
      warning = "",
      error = "",
    },
  },
  renderer = {
    highlight_git = true,
    highlight_opened_files = "all", -- default is "none"
    highlight_diagnostics = true,
    icons = {
      show = {
        git = true,
      },
    },
  },
  view = {
    signcolumn = "yes", -- default is "yes"
  },
  update_focused_file = {
    enable = true,
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment