adapted neovim

This commit is contained in:
Tomas Mirchev 2025-10-05 01:41:44 +03:00
parent 45f0f3cdc2
commit b7be9daa99
5 changed files with 64 additions and 15 deletions

View File

@ -5,10 +5,29 @@ vim.g.maplocalleader = " "
-- Use Nerd Font
vim.g.have_nerd_font = false
-- Add vertical line
-- vim.opt.colorcolumn = "100"
if vim.env.CONTAINER == "true" then
vim.g.clipboard = {
name = "osc52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
},
paste = {
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
},
}
end
vim.opt.laststatus = 3
-- Sync clipboard between OS and Neovim
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
-- Add vertical line
vim.opt.colorcolumn = "100"
-- vim.opt.laststatus = 3
vim.opt.signcolumn = "no"
-- Enable TrueColor
@ -19,9 +38,9 @@ vim.opt.mousescroll = "hor:1,ver:1"
-- Set indentation preferences
vim.opt.expandtab = true -- Convert tabs to spaces
vim.opt.shiftwidth = 2 -- Number of spaces for auto-indent
vim.opt.tabstop = 2 -- Number of spaces a tab counts for
vim.opt.softtabstop = 2 -- Number of spaces a tab counts for when editing
vim.opt.shiftwidth = 4 -- Number of spaces for auto-indent
vim.opt.tabstop = 4 -- Number of spaces a tab counts for
vim.opt.softtabstop = 4 -- Number of spaces a tab counts for when editing
vim.opt.autoindent = true -- Copy indent from current line when starting new line
vim.opt.smartindent = true -- Do smart autoindenting when starting a new line
@ -39,13 +58,9 @@ vim.opt.relativenumber = true
vim.opt.mouse = "a"
-- Full path on status line
vim.opt.statusline = "%= %F%m%r%h%w ─ (%l,%c %P) %="
vim.opt.fillchars:append({ stl = "", stlnc = "" })
-- Sync clipboard between OS and Neovim
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
vim.opt.statusline = "%F%m%r%h%w%=%l,%c %P "
-- vim.opt.statusline = "%= %F%m%r%h%w ─ (%l,%c %P) %="
-- vim.opt.fillchars:append({ stl = "─", stlnc = "─" })
-- Save undo history
vim.opt.undofile = true

View File

@ -29,6 +29,7 @@ return { -- Autoformat
end,
formatters_by_ft = {
lua = { "stylua" },
sh = { "shfmt" },
swift = { "swift_format" },
python = { "isort", "black", stop_after_first = true },
javascript = { "prettierd", "prettier", stop_after_first = true },
@ -36,5 +37,10 @@ return { -- Autoformat
typescript = { "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
},
formatters = {
shfmt = {
prepend_args = { "-i", "4", "-ci" }, -- 4 spaces, indent cases
},
},
},
}

View File

@ -4,9 +4,33 @@ return {
lazy = false,
keys = {
{ "<Leader>et", ":NvimTreeToggle<CR>", desc = "Explorer Toggle", silent = true },
{
"<Leader>ei",
function()
require("nvim-tree.api").node.show_info_popup()
end,
desc = "NvimTree: Info",
mode = "n",
},
},
config = function()
local function my_on_attach(bufnr)
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "<Leader>et", api.tree.toggle, opts("Open or close the tree"))
vim.keymap.set("n", "<Leader>ei", api.node.show_info_popup, opts("Show info popup"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.del("n", "<C-k>", { buffer = bufnr })
end
require("nvim-tree").setup({
on_attach = my_on_attach,
hijack_cursor = true,
disable_netrw = true,
hijack_netrw = true,

View File

@ -41,11 +41,12 @@ return {
remap.nmap("<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
remap.nmap("<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
remap.nmap("<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
remap.nmap("<leader>ss", builtin.current_buffer_fuzzy_find, { desc = "[S]earch [C]urrent file" })
remap.nmap("<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
remap.nmap("<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
remap.nmap("<leader>sr", builtin.lsp_references, { desc = "[S]earch [R]references" })
remap.nmap("<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
remap.nmap("<leader>ss", builtin.git_status, { desc = "[S]earch Git [S]tatus" })
-- remap.nmap("<leader>ss", builtin.git_status, { desc = "[S]earch Git [S]tatus" })
remap.nmap("<leader><leader>", builtin.buffers, { desc = "Find existing [B]uffers" })
end,
}

View File

@ -9,6 +9,7 @@ function M.get(C)
CursorLineNr = { fg = C.accent, bold = true },
CursorLine = { bg = C.surface },
Visual = { bg = C.accent_light },
ColorColumn = { bg = C.surface },
Search = { fg = C.yellow },
CurSearch = { fg = C.yellow, bg = C.none, bold = true },
@ -18,7 +19,9 @@ function M.get(C)
EndOfBuffer = { fg = C.base }, -- End-of-buffer marker (~ lines)
WinSeparator = { fg = C.outline },
StatusLine = { fg = C.outline, bg = C.none }, -- Active statusline (where filename)
-- StatusLine = { fg = C.outline, bg = C.none }, -- Active statusline (where filename)
StatusLine = { fg = C.base, bg = C.outline, bold = false }, -- Active statusline (where filename)
StatusLineNC = { fg = C.base, bg = C.outline, bold = false }, -- Active statusline (where filename)
MsgArea = { fg = C.text, bg = C.none }, -- Command-line / message area
MsgSeparator = { fg = C.text, bg = C.surface }, -- Separator for messages
ModeMsg = { fg = C.text },