NeoVim config with GruberDarker theme and with Obsidian Notes

This commit is contained in:
Alexey Norets 2025-09-21 12:27:07 +03:00
commit 4861ac99f5
25 changed files with 1197 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*.json

50
init.lua Normal file
View File

@ -0,0 +1,50 @@
require("config.remap")
require("config.lazy")
require("config.set")
-- Change in Highlight gruber-darker-theme. In all themes, but for now it's ok.)
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),
pattern = "*",
callback = function ()
vim.api.nvim_set_hl(0, "@keyword.directive.define", {fg = "#95a99f"})
vim.api.nvim_set_hl(0, "@keyword.directive", {fg = "#95a99f"})
vim.api.nvim_set_hl(0, "@keyword.conditional", {fg = "#ffdd33"})
vim.api.nvim_set_hl(0, "@keyword.return", {fg = "#ffdd33"})
vim.api.nvim_set_hl(0, "@keyword.import", {fg = "#95a99f"})
vim.api.nvim_set_hl(0, "@type.builtin", {fg = "#95a99f"})
vim.api.nvim_set_hl(0, "@constant.c", {fg = "#f4f4ff"})
vim.api.nvim_set_hl(0, "@constant.macro.c", {fg = "#f4f4ff"})
vim.api.nvim_set_hl(0, "@function.builtin", {fg = "#96a6c8"})
-- vim.api.nvim_set_hl(0, "LspReferenceText", {fg = "#FF0000"})
end
})
-- highlight yanked text
vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
command = "silent! lua vim.highlight.on_yank({ timeout = 500 })",
})
-- jump to last edit position on opening file
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "*",
callback = function(ev)
if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("$") then
-- except for in git commit messages
-- https://stackoverflow.com/questions/31449496/vim-ignore-specifc-file-in-autocommand
if not vim.fn.expand("%:p"):find(".git", 1, true) then
vim.cmd('exe "normal! g\'\\""')
end
end
end,
})
-- Установить 4 пробела для табуляции в C-файлах
vim.api.nvim_create_autocmd("FileType", {
pattern = "c",
callback = function()
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4
vim.bo.expandtab = true
end,
})

16
lua/config/lazy.lua Normal file
View File

@ -0,0 +1,16 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = "plugins",
change_detection = { notify = false },
})

67
lua/config/remap.lua Normal file
View File

@ -0,0 +1,67 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>dj", vim.cmd.Ex)
vim.keymap.set("n", "<C-,>", "mmyyp`mj")
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- greatest remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])
-- next greatest remap ever : asbjornHaland
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
-- This is going to get me cancelled
vim.keymap.set({ "i", "n", "v" }, "<C-c>", "<Esc>")
-- vim.keymap.set("n", "q", "<Nop>")
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<up>", "<nop>")
vim.keymap.set("n", "<down>", "<nop>")
vim.keymap.set("n", "<left>", "<nop>")
vim.keymap.set("n", "<right>", "<nop>")
-- vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
-- vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
-- Disable highlight search result
-- vim.keymap.set({ "n", "v" }, "<C-z>", ":nohlsearch<cr>", {})
vim.keymap.set({ "n", "v" }, "<leader>z", ":nohlsearch<cr>", {})
vim.keymap.set("n", "<C-a>", "<cmd>cnext<cr>zz")
vim.keymap.set("n", "<C-q>", "<cmd>cprev<cr>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<cr>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<cr>zz")
vim.keymap.set("n", "<leader>co", "<cmd>copen<cr>")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")
end)
vim.keymap.set("n", "<leader>vsl", ":lua vim.wo.wrap = not vim.wo.wrap<CR>")
-- Navigate buffers
vim.keymap.set("n", "<S-l>", ":bnext<CR>")
vim.keymap.set("n", "<S-h>", ":bprevious<CR>")
vim.keymap.set("n", "<leader>bk", ":bdel<CR>")
vim.keymap.set("n", "<leader>ns", "<cmd>:ObsidianQuickSwitch<CR>")
local keymap = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
keymap("i", "<c-a>", "<cmd>lua require'luasnip'.jump(1)<CR>", opts)
keymap("s", "<c-a>", "<cmd>lua require'luasnip'.jump(1)<CR>", opts)
keymap("i", "<c-q>", "<cmd>lua require'luasnip'.jump(-1)<CR>", opts)
keymap("s", "<c-q>", "<cmd>lua require'luasnip'.jump(-1)<CR>", opts)

64
lua/config/set.lua Normal file
View File

@ -0,0 +1,64 @@
-- vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.foldenable = false
vim.opt.foldmethod = "manual"
vim.opt.foldlevelstart = 99
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.virtualedit = "block"
vim.opt.inccommand = "split"
vim.opt.iskeyword:remove("_")
vim.opt.smartindent = true
vim.opt.listchars = {
eol = "¬", -- Character at the end of each line
tab = "", -- Characters for tabs (requires two characters)
extends = "»", -- Character for lines extending beyond the window
precedes = "«", -- Character for lines preceding the window
trail = "·", -- Character for trailing spaces
space = "·", -- Character for regular spaces
nbsp = "", -- Character for non-breaking spaces
lead = "·", -- Character for leading spaces (can be an empty string)
multispace = "·", -- Character for two or more consecutive spaces
}
vim.opt.list = true
vim.cmd("hi Whitespace guifg=#282828")
vim.cmd("hi NonText guifg=#282828")
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = false
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
-- vim.opt.colorcolumn = "80"
vim.g.netrw_browse_split = 0
vim.g.netrw_liststyle = 3
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25
-- vim.g.netrw_hide = 0
-- ScrollOff

View File

@ -0,0 +1,86 @@
return {
{
-- "zenbones-theme/zenbones.nvim",
-- -- Optionally install Lush. Allows for more configuration or extending the colorscheme
-- -- If you don't want to install lush, make sure to set g:zenbones_compat = 1
-- -- In Vim, compat mode is turned on as Lush only works in Neovim.
-- dependencies = "rktjmp/lush.nvim",
-- lazy = false,
-- priority = 1000,
-- -- you can set set configuration options here
-- config = function()
-- vim.opt.termguicolors = true
-- vim.opt.background = warm
-- vim.g.zenbones_darken_comments = 45
-- vim.cmd.colorscheme('neobones')
-- end,
},
{
-- "wincent/base16-nvim",
-- lazy = false, -- load at start
-- priority = 1000, -- load first
-- config = function()
-- vim.cmd([[colorscheme nord]])
-- vim.o.background = "dark"
-- -- XXX: hi Normal ctermbg=NONE
-- -- Make comments more prominent -- they are important.
-- local bools = vim.api.nvim_get_hl(0, { name = "Boolean" })
-- vim.api.nvim_set_hl(0, "Comment", bools)
-- -- Make it clearly visible which argument we're at.
-- local marked = vim.api.nvim_get_hl(0, { name = "PMenu" })
-- vim.api.nvim_set_hl(
-- 0,
-- "LspSignatureActiveParameter",
-- { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true }
-- )
-- -- XXX
-- -- Would be nice to customize the highlighting of warnings and the like to make
-- -- them less glaring. But alas
-- -- https://github.com/nvim-lua/lsp_extensions.nvim/issues/21
-- -- call Base16hi("CocHintSign", g:base16_gui03, "", g:base16_cterm03, "", "", "")
-- end,
},
{
"blazkowolf/gruber-darker.nvim",
opts = {
bold = false,
invert = {
signs = false,
tabline = false,
visual = false,
},
italic = {
strings = true,
comments = true,
operators = false,
folds = true,
},
undercurl = true,
underline = true,
},
config = function()
vim.cmd.colorscheme("gruber-darker")
end,
},
{
-- "sainnhe/gruvbox-material",
-- priority = 1000,
-- config = function()
-- vim.opt.termguicolors = true
-- vim.g.gruvbox_material_foreground = "original" -- original, mix, material
-- vim.g.gruvbox_material_background = "hard"
-- vim.g.gruvbox_material_better_performance = 1
-- vim.g.gruvbox_material_enable_italic = 0
-- vim.g.gruvbox_material_enable_bold = 0
-- vim.cmd.colorscheme("gruvbox-material")
-- end,
},
{
-- "sainnhe/everforest",
-- config = function()
-- vim.g.everforest_background = "hard"
-- vim.cmd.colorscheme("everforest")
-- -- vim.api.nvim_set_hl(0, "LspInlayHint", { fg = "#9DA9A0" })
-- end,
},
}

7
lua/plugins/comment.lua Normal file
View File

@ -0,0 +1,7 @@
return {
'numToStr/Comment.nvim',
opts = {
-- add any options here
},
lazy = false,
}

102
lua/plugins/completions.lua Normal file
View File

@ -0,0 +1,102 @@
return {
{
"hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
},
{
"L3MON4D3/LuaSnip",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
},
},
{
"hrsh7th/nvim-cmp",
config = function()
-- local has_words_before = function()
-- unpack = unpack or table.unpack
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
-- return col ~= 0
-- and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
-- end
--
-- local luasnip = require("luasnip")
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
-- ["<C-e>"] = cmp.mapping.abort(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
-- ["<c-a>"] = cmp.mapping("<cmd>lua require'luasnip'.jump(1)<CR>", { "i", "s" }),
-- ["<c-q>"] = cmp.mapping("<cmd>lua require'luasnip'.jump(-1)<CR>", { "i", "s" }),
-- !!!
-- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#no-snippet-plugin
-- !!!
-- ["<Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_next_item()
-- -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- -- that way you will only jump inside the snippet region
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
-- elseif has_words_before() then
-- cmp.complete()
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
--
-- ["<S-Tab>"] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
-- elseif luasnip.jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {
{ name = "buffer" },
}, {
{ name = "nvim_lsp_signature_help" },
}),
experimental = {
chost_text = true,
},
})
-- Enable completing paths in :
cmp.setup.cmdline(":", {
sources = cmp.config.sources({
{ name = "path" },
}),
})
end,
},
}

View File

@ -0,0 +1,7 @@
return {
"saecki/crates.nvim",
tag = "stable",
config = function()
require("crates").setup()
end,
}

9
lua/plugins/eyeliner.lua Normal file
View File

@ -0,0 +1,9 @@
return {
"jinh0/eyeliner.nvim",
config = function()
require("eyeliner").setup({
highlight_on_key = true, -- show highlights only after keypress
dim = true, -- dim all other characters if set to true (recommended!)
})
end,
}

39
lua/plugins/formating.lua Normal file
View File

@ -0,0 +1,39 @@
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
rust = { "rustfmt" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
},
})
vim.keymap.set({ "n", "v" }, "<leader>f", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
})
end, { desc = "Format file or range (in visual mode)" })
end,
}

6
lua/plugins/fugitive.lua Normal file
View File

@ -0,0 +1,6 @@
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
end,
}

50
lua/plugins/fzf.lua Normal file
View File

@ -0,0 +1,50 @@
return {
-- auto-cd to root of git project
-- 'airblade/vim-rooter'
{
"notjedi/nvim-rooter.lua",
config = function()
require("nvim-rooter").setup()
end,
},
{
"junegunn/fzf.vim",
dependencies = {
{ "junegunn/fzf", dir = "~/.fzf", build = "./install --all" },
},
config = function()
-- stop putting a giant window over my editor
vim.g.fzf_layout = { down = "~20%" }
-- when using :Files, pass the file list through
--
-- !!!! https://github.com/jonhoo/proximity-sort
--
-- to prefer files closer to the current file.
function list_cmd()
local base = vim.fn.fnamemodify(vim.fn.expand("%"), ":h:.:S")
if base == "." then
-- if there is no current file,
-- proximity-sort can't do its thing
return "fd --type file --follow"
else
return vim.fn.printf(
"fd --type file --follow | proximity-sort %s",
vim.fn.shellescape(vim.fn.expand("%"))
)
end
end
-- vim.keymap.set("n", "<leader>ps", function()
-- builtin.grep_string({ search = vim.fn.input("Grep > ") })
-- end)
vim.api.nvim_create_user_command("MyFiles", function(arg)
vim.fn["fzf#vim#files"](arg.qargs, { source = list_cmd(), options = "--tiebreak=index" }, arg.bang)
end, { bang = true, nargs = "?", complete = "dir" })
-- vim.keymap.set("n", "<leader>pf", "<cmd>MyFiles<CR>")
-- vim.keymap.set("n", "<leader>fg", "<cmd>GFiles<CR>")
-- vim.keymap.set("n", "<leader>bb", "<cmd>Buffers<CR>")
-- vim.keymap.set("n", "<leader>ps", ":Rg ")
end,
},
}

8
lua/plugins/leap.lua Normal file
View File

@ -0,0 +1,8 @@
return {
"ggandor/leap.nvim",
config = function()
-- require("leap").create_default_mappings()
vim.keymap.set({ "n", "x", "o" }, "Z", "<Plug>(leap-forward)")
vim.keymap.set({ "n", "x", "o" }, "X", "<Plug>(leap-backward)")
end,
}

33
lua/plugins/linting.lua Normal file
View File

@ -0,0 +1,33 @@
return {
"mfussenegger/nvim-lint",
event = {
"BufReadPre",
"BufNewFile",
},
config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
svelte = { "eslint_d" },
python = { "flake8" },
rust = { "trivy" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>l", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
}

85
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,85 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
vim.o.showmode = false
local hide_in_width = function()
return vim.fn.winwidth(0) > 80
end
local lualine = require("lualine")
-- local spaces = function()
-- return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
-- end
lualine.diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
-- symbols = { error = " ", warn = " " },
colored = false,
update_in_insert = false,
always_visible = false,
}
lualine.diff = {
"diff",
colored = false,
-- symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols
cond = hide_in_width,
}
lualine.mode = {
"mode",
fmt = function(str)
return "<" .. str:sub(1, 1) .. ">"
end,
}
lualine.filetype = {
"filetype",
icons_enabled = false,
icon = nil,
}
lualine.branch = {
"branch",
icons_enabled = true,
-- icon = "",
}
lualine.location = {
"location",
padding = 0,
}
lualine.setup({
options = {
-- theme = "nord",
-- theme = "everforest",
theme = "auto",
icons_enabled = true,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline" },
always_divide_middle = true,
},
sections = {
lualine_a = { lualine.mode },
lualine_b = { lualine.branch, "filename" },
lualine_c = {},
-- lualine_x = { "encoding", "fileformat", "filetype" },
-- lualine_x = { lualine.diff, spaces, "encoding", lualine.filetype },
lualine_x = { lualine.diagnostics, lualine.filetype },
lualine_y = { "progress", "location" },
-- lualine_z = { "tabnine" },
lualine_z = {},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
-- lualine_x = { "location" },
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {},
})
end,
}

View File

@ -0,0 +1,128 @@
return {
"MeanderingProgrammer/render-markdown.nvim",
opts = {},
-- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons
config = function()
vim.opt.conceallevel = 2
require("render-markdown").setup({
heading = {
-- Turn on / off heading icon & background rendering
enabled = true,
-- Turn on / off any sign column related rendering
sign = true,
-- Determines how icons fill the available space:
-- inline: underlying '#'s are concealed resulting in a left aligned icon
-- overlay: result is left padded with spaces to hide any additional '#'
position = "overlay",
-- Replaces '#+' of 'atx_h._marker'
-- The number of '#' in the heading determines the 'level'
-- The 'level' is used to index into the array using a cycle
icons = { "󰲡 ", "󰲣 ", "󰲥 ", "󰲧 ", "󰲩 ", "󰲫 " },
-- Added to the sign column if enabled
-- The 'level' is used to index into the array using a cycle
signs = { "󰫎 " },
-- Width of the heading background:
-- block: width of the heading text
-- full: full width of the window
-- Can also be an array of the above values in which case the 'level' is used
-- to index into the array using a clamp
width = "full",
-- Amount of padding to add to the left of headings
left_pad = 0,
-- Amount of padding to add to the right of headings when width is 'block'
right_pad = 0,
-- Minimum width to use for headings when width is 'block'
min_width = 0,
-- Determins if a border is added above and below headings
border = false,
-- Highlight the start of the border using the foreground highlight
border_prefix = false,
-- Used above heading for border
above = "",
-- Used below heading for border
below = "",
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading icon and extends through the entire line
backgrounds = {
"RenderMarkdownH1Bg",
"RenderMarkdownH2Bg",
"RenderMarkdownH3Bg",
"RenderMarkdownH4Bg",
"RenderMarkdownH5Bg",
"RenderMarkdownH6Bg",
},
-- The 'level' is used to index into the array using a clamp
-- Highlight for the heading and sign icons
foregrounds = {
"RenderMarkdownH1",
"RenderMarkdownH2",
"RenderMarkdownH3",
"RenderMarkdownH4",
"RenderMarkdownH5",
"RenderMarkdownH6",
},
},
-- require("render-markdown").setup({
-- heading = {
-- -- Turn on / off heading icon & background rendering
-- enabled = true,
-- -- Turn on / off any sign column related rendering
-- sign = true,
-- -- Determines how icons fill the available space:
-- -- inline: underlying '#'s are concealed resulting in a left aligned icon
-- -- overlay: result is left padded with spaces to hide any additional '#'
-- position = "overlay",
-- -- Replaces '#+' of 'atx_h._marker'
-- -- The number of '#' in the heading determines the 'level'
-- -- The 'level' is used to index into the array using a cycle
-- icons = { "󰲡 ", "󰲣 ", "󰲥 ", "󰲧 ", "󰲩 ", "󰲫 " },
-- -- Added to the sign column if enabled
-- -- The 'level' is used to index into the array using a cycle
-- signs = { "󰫎 " },
-- -- Width of the heading background:
-- -- block: width of the heading text
-- -- full: full width of the window
-- -- Can also be an array of the above values in which case the 'level' is used
-- -- to index into the array using a clamp
-- width = "full",
-- -- Amount of padding to add to the left of headings
-- left_pad = 0,
-- -- Amount of padding to add to the right of headings when width is 'block'
-- right_pad = 0,
-- -- Minimum width to use for headings when width is 'block'
-- min_width = 0,
-- -- Determins if a border is added above and below headings
-- border = false,
-- -- Highlight the start of the border using the foreground highlight
-- border_prefix = false,
-- -- Used above heading for border
-- above = "▄",
-- -- Used below heading for border
-- below = "▀",
-- -- The 'level' is used to index into the array using a clamp
-- -- Highlight for the heading icon and extends through the entire line
-- backgrounds = {
-- "RenderMarkdownH1Bg",
-- "RenderMarkdownH2Bg",
-- "RenderMarkdownH3Bg",
-- "RenderMarkdownH4Bg",
-- "RenderMarkdownH5Bg",
-- "RenderMarkdownH6Bg",
-- },
-- -- The 'level' is used to index into the array using a clamp
-- -- Highlight for the heading and sign icons
-- foregrounds = {
-- "RenderMarkdownH1",
-- "RenderMarkdownH2",
-- "RenderMarkdownH3",
-- "RenderMarkdownH4",
-- "RenderMarkdownH5",
-- "RenderMarkdownH6",
-- },
-- },
-- }),
})
end,
}

View File

@ -0,0 +1,19 @@
return {
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = function()
require("lazy").load({ plugins = { "markdown-preview.nvim" } })
vim.fn["mkdp#util#install"]()
end,
keys = {
{
"<leader>cp",
ft = "markdown",
"<cmd>MarkdownPreviewToggle<cr>",
desc = "Markdown Preview",
},
},
config = function()
vim.cmd([[do FileType]])
end,
}

View File

@ -0,0 +1,15 @@
return {
"alexghergh/nvim-tmux-navigation",
config = function()
local nvim_tmux_nav = require("nvim-tmux-navigation")
nvim_tmux_nav.setup({
disable_when_zoomed = true, -- defaults to false
})
vim.keymap.set("n", "<C-h>", nvim_tmux_nav.NvimTmuxNavigateLeft)
vim.keymap.set("n", "<C-j>", nvim_tmux_nav.NvimTmuxNavigateDown)
vim.keymap.set("n", "<C-k>", nvim_tmux_nav.NvimTmuxNavigateUp)
vim.keymap.set("n", "<C-l>", nvim_tmux_nav.NvimTmuxNavigateRight)
vim.keymap.set("n", "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive)
vim.keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext)
end,
}

204
lua/plugins/obsidian.lua Normal file
View File

@ -0,0 +1,204 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = false,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
-- -- refer to `:h file-pattern` for more examples
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
},
opts = {
workspaces = {
{
name = "Main",
path = "/Users/norets/Library/Mobile Documents/iCloud~md~obsidian/Documents/Main/",
-- path = "~/Nextcloud/Notes/",
},
},
},
config = function()
require("obsidian").setup({
workspaces = {
{
name = "Main",
-- path = "/Users/norets/Library/Mobile Documents/iCloud~md~obsidian/Documents",
path = "/Users/norets/Library/Mobile Documents/iCloud~md~obsidian/Documents/Main/",
-- path = "~/Nextcloud/Notes/",
},
},
daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "dailies/",
-- Optional, if you want to change the date format for the ID of daily notes.
date_format = "%Y-%m-%d",
-- Optional, if you want to change the date format of the default alias of daily notes.
alias_format = "%B %-d, %Y",
-- Optional, default tags to add to each new daily note created.
default_tags = { "daily-notes" },
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
template = nil,
},
completion = {
-- Set to false to disable completion.
nvim_cmp = true,
-- Trigger completion at 2 chars.
min_chars = 2,
},
-- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this
-- way then set 'mappings = {}'.
mappings = {
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
["gf"] = {
action = function()
return require("obsidian").util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
-- Toggle check-boxes.
["<leader>ch"] = {
action = function()
return require("obsidian").util.toggle_checkbox()
end,
opts = { buffer = true },
},
-- Smart action depending on context, either follow link or toggle checkbox.
["<cr>"] = {
action = function()
return require("obsidian").util.smart_action()
end,
opts = { buffer = true, expr = true },
},
},
picker = {
-- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'.
name = "telescope.nvim",
-- Optional, configure key mappings for the picker. These are the defaults.
-- Not all pickers support all mappings.
note_mappings = {
-- Create a new note from your query.
new = "<C-x>",
-- Insert a link to the selected note.
insert_link = "<C-l>",
},
tag_mappings = {
-- Add tag(s) to current note.
tag_note = "<C-x>",
-- Insert a tag at the current location.
insert_tag = "<C-l>",
},
},
-- Where to put new notes. Valid options are
-- * "current_dir" - put new notes in same directory as the current buffer.
-- * "notes_subdir" - put new notes in the default notes subdirectory.
new_notes_location = "notes_subdir",
-- Optional, customize how note IDs are generated given an optional title.
---@param title string|?
---@return string
note_id_func = function(title)
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
-- In this case a note with the title 'My new note' will be given an ID that looks
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
local suffix = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else
-- If title is nil, just add 4 random uppercase letters to the suffix.
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
end
return tostring(os.time()) .. "-" .. suffix
-- return tostring(os.date("%d%m%yT%H%M%S")) .. "-" .. suffix
end,
-- Optional, customize how note file names are generated given the ID, target directory, and title.
---@param spec { id: string, dir: obsidian.Path, title: string|? }
---@return string|obsidian.Path The full path to the new note.
note_path_func = function(spec)
-- This is equivalent to the default behavior.
local path = spec.dir / tostring(spec.id)
return path:with_suffix(".md")
end,
ui = {
enable = false, --true, -- set to false to disable all additional syntax features
update_debounce = 200, -- update delay after a text change (in milliseconds)
max_file_length = 5000, -- disable UI features for files with more than this many lines
-- Define how various check-boxes are displayed
checkboxes = {
-- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
-- [" "] = { char = "󰄱", hl_group = "ObsidianTodo" },
-- ["x"] = { char = "", hl_group = "ObsidianDone" },
-- [">"] = { char = "", hl_group = "ObsidianRightArrow" },
-- ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" },
-- ["!"] = { char = "", hl_group = "ObsidianImportant" },
-- Replace the above with this if you don't have a patched font:
[" "] = { char = "", hl_group = "ObsidianTodo" },
["x"] = { char = "", hl_group = "ObsidianDone" },
-- You can also add more custom ones...
},
-- Use bullet marks for non-checkbox lists.
-- bullets = { char = "•", hl_group = "ObsidianBullet" },
-- external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" },
-- Replace the above with this if you don't have a patched font:
-- external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" },
reference_text = { hl_group = "ObsidianRefText" },
highlight_text = { hl_group = "ObsidianHighlightText" },
tags = { hl_group = "ObsidianTag" },
block_ids = { hl_group = "ObsidianBlockID" },
hl_groups = {
-- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`.
ObsidianTodo = { bold = true, fg = "#f78c6c" },
ObsidianDone = { bold = true, fg = "#89ddff" },
ObsidianRightArrow = { bold = true, fg = "#f78c6c" },
ObsidianTilde = { bold = true, fg = "#ff5370" },
ObsidianImportant = { bold = true, fg = "#d73128" },
ObsidianBullet = { bold = true, fg = "#89ddff" },
ObsidianRefText = { underline = true, fg = "#c792ea" },
ObsidianExtLinkIcon = { fg = "#c792ea" },
ObsidianTag = { italic = true, fg = "#89ddff" },
ObsidianBlockID = { italic = true, fg = "#89ddff" },
ObsidianHighlightText = { bg = "#75662e" },
},
},
-- Specify how to handle attachments.
attachments = {
-- The default folder to place images in via `:ObsidianPasteImg`.
-- If this is a relative path it will be interpreted as relative to the vault root.
-- You can always override this per image by passing a full path to the command instead of just a filename.
img_folder = "assets/imgs", -- This is the default
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
---@return string
img_name_func = function()
-- Prefix image names with timestamp.
return string.format("%s-", os.time())
end,
-- A function that determines the text to insert in the note when pasting an image.
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- This is the default implementation.
---@param client obsidian.Client
---@param path obsidian.Path the absolute path to the image file
---@return string
img_text_func = function(client, path)
path = client:vault_relative_path(path) or path
return string.format("![%s](%s)", path.name, path)
end,
},
})
end,
}

View File

@ -0,0 +1,34 @@
return {
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "norg", "rmd", "org" },
code = {
sign = false,
width = "block",
right_pad = 1,
},
heading = {
sign = false,
icons = {},
},
},
ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts)
vim.opt.conceallevel = 2
require("render-markdown").setup(opts)
-- vim.keymap.set.toggle.map("<leader>tq", {
-- name = "Render Markdown",
-- get = function()
-- return require("render-markdown.state").enabled
-- end,
-- set = function(enabled)
-- local m = require("render-markdown")
-- if enabled then
-- m.enable()
-- else
-- m.disable()
-- end
-- end,
-- })
end,
}

124
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,124 @@
local function normalize_path(path)
return path:gsub("\\", "/")
end
local function normalize_cwd()
return normalize_path(vim.loop.cwd()) .. "/"
end
local function is_subdirectory(cwd, path)
return string.lower(path:sub(1, #cwd)) == string.lower(cwd)
end
local function split_filepath(path)
local normalized_path = normalize_path(path)
local normalized_cwd = normalize_cwd()
local filename = normalized_path:match("[^/]+$")
if is_subdirectory(normalized_cwd, normalized_path) then
local stripped_path = normalized_path:sub(#normalized_cwd + 1, -(#filename + 1))
return stripped_path, filename
else
local stripped_path = normalized_path:sub(1, -(#filename + 1))
return stripped_path, filename
end
end
local function path_display(_, path)
local stripped_path, filename = split_filepath(path)
if filename == stripped_path or stripped_path == "" then
return filename
end
return string.format("%-25s ~ %s", filename, stripped_path)
end
return {
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
lazy = true,
},
"nvim-lua/plenary.nvim",
},
opts = {},
config = function()
require("telescope").setup({
defaults = {
path_display = path_display,
preview = false,
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
-- path_display = { "smart" },
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--hidden",
"--glob=!.git/",
},
},
pickers = {
find_files = { theme = "dropdown" },
git_files = { theme = "dropdown" },
live_grep = { preview = true, theme = "dropdown" },
buffers = { theme = "dropdown" },
grep_string = { preview = true, theme = "dropdown" },
help_tags = { theme = "dropdown" },
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
},
},
})
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>pp", "<cmd>:Telescope projects theme=dropdown<CR>", {})
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
vim.keymap.set("n", "<leader>pf", builtin.git_files, {})
vim.keymap.set("n", "<leader>bb", builtin.buffers, {})
vim.keymap.set("n", "<leader>bi", "<cmd>:Telescope buffers theme=ivy<CR>", {})
vim.keymap.set("n", "<leader>pws", function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set("n", "<leader>pWs", function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
-- vim.keymap.set("n", "<leader>pg", builtin.live_grep, {})
vim.keymap.set("n", "<leader>vh", builtin.help_tags, {})
end,
},
-- {
-- "ahmedkhalf/project.nvim",
-- config = function()
-- require("project_nvim").setup({
-- manual_mode = false,
-- detection_methods = { "lsp", "pattern" },
-- patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
-- ignore_lsp = {},
-- exclude_dirs = {},
-- show_hidden = false,
-- silent_chdir = true,
-- scope_chdir = "global",
-- datapath = vim.fn.stdpath("data"),
-- })
-- require("telescope").load_extension("projects")
-- end,
-- },
}

View File

@ -0,0 +1,14 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function ()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end,
}

23
lua/plugins/trouble.lua Normal file
View File

@ -0,0 +1,23 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
config = function()
require("trouble").setup({
icons = false,
})
vim.keymap.set("n", "<leader>tt", function()
require("trouble").toggle()
end)
vim.keymap.set("n", "C-n", function()
require("trouble").next({ skip_groups = true, jump = true })
end)
vim.keymap.set("n", "C-p", function()
require("trouble").previous({ skip_groups = true, jump = true })
end)
end,
}

6
lua/plugins/undotree.lua Normal file
View File

@ -0,0 +1,6 @@
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end,
}