simp
This commit is contained in:
5
init.lua
5
init.lua
@@ -18,8 +18,5 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- Init plugins
|
-- Load plugins
|
||||||
require("lazy").setup("plugins")
|
require("lazy").setup("plugins")
|
||||||
|
|
||||||
-- Theme
|
|
||||||
vim.cmd [[colorscheme tokyonight]]
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|||||||
pattern = { "*.go" },
|
pattern = { "*.go" },
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd [[Tabs 4]]
|
vim.cmd [[Tabs 4]]
|
||||||
command = "compiler go"
|
vim.cmd [[compiler go]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -17,3 +17,30 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|||||||
pattern = { "*.ts", "*.tsx" },
|
pattern = { "*.ts", "*.tsx" },
|
||||||
command = "compiler tsc"
|
command = "compiler tsc"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Markdown navigation
|
||||||
|
function navigate_markdown()
|
||||||
|
local line = vim.api.nvim_get_current_line()
|
||||||
|
local cursor_pos = vim.api.nvim_win_get_cursor(0)
|
||||||
|
local col = cursor_pos[2]
|
||||||
|
|
||||||
|
local pattern = "%[%[([^%]]+%.md)%]%]"
|
||||||
|
local start_pos, end_pos, file = line:find(pattern)
|
||||||
|
|
||||||
|
if start_pos and col >= start_pos - 1 and col <= end_pos then
|
||||||
|
if vim.fn.filereadable(file) == 1 then
|
||||||
|
vim.cmd('edit ' .. file)
|
||||||
|
else
|
||||||
|
print("File not found: " .. file)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("No valid Markdown link under cursor.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "markdown",
|
||||||
|
callback = function()
|
||||||
|
api.nvim_set_keymap("n", "gd", ":lua navigate_markdown()<CR>", {})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local g, opt, cmd = vim.g, vim.opt, vim.cmd
|
|||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
g.mapleader = " "
|
g.mapleader = " "
|
||||||
g.maplocalleader = ","
|
|
||||||
|
|
||||||
opt.backup = false
|
opt.backup = false
|
||||||
opt.swapfile = false
|
opt.swapfile = false
|
||||||
@@ -19,8 +18,6 @@ opt.splitbelow = true
|
|||||||
opt.splitright = true
|
opt.splitright = true
|
||||||
opt.showmode = false
|
opt.showmode = false
|
||||||
|
|
||||||
opt.grepprg = "rg --vimgrep --smart-case"
|
|
||||||
|
|
||||||
opt.path = ".,**"
|
opt.path = ".,**"
|
||||||
cmd "set path-=node_modules/**"
|
cmd "set path-=node_modules/**"
|
||||||
cmd "set wildignore-=*/node_modules/*"
|
cmd "set wildignore-=*/node_modules/*"
|
||||||
@@ -34,7 +31,13 @@ opt.list = true
|
|||||||
opt.listchars = "lead:·,tab:··"
|
opt.listchars = "lead:·,tab:··"
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
vim.opt.ignorecase = true
|
opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
opt.smartcase = true
|
||||||
vim.opt.hlsearch = true
|
opt.hlsearch = true
|
||||||
vim.opt.incsearch = true
|
opt.incsearch = true
|
||||||
|
|
||||||
|
-- Transparency
|
||||||
|
vim.cmd([[highlight Normal guibg=none]])
|
||||||
|
vim.cmd([[highlight NonText guibg=none]])
|
||||||
|
vim.cmd([[highlight Normal ctermbg=none]])
|
||||||
|
vim.cmd([[highlight NonText ctermbg=none]])
|
||||||
|
|||||||
31
lua/markdown_navigator/init.lua
Normal file
31
lua/markdown_navigator/init.lua
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.open()
|
||||||
|
local line = vim.api.nvim_get_current_line()
|
||||||
|
local cursor_pos = vim.api.nvim_win_get_cursor(0)
|
||||||
|
local col = cursor_pos[2]
|
||||||
|
|
||||||
|
local pattern = "%[%[([^%]]+%.md)%]%]"
|
||||||
|
local start_pos, end_pos, file = line:find(pattern)
|
||||||
|
|
||||||
|
if start_pos and col >= start_pos - 1 and col <= end_pos then
|
||||||
|
if vim.fn.filereadable(file) == 1 then
|
||||||
|
vim.cmd('edit ' .. file)
|
||||||
|
else
|
||||||
|
print("File not found: " .. file)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("No valid Markdown link under cursor.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "markdown",
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_set_keymap("n", "gd", ":lua require('markdown_navigator').open()", {})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
local function map(mode, lhs, rhs)
|
|
||||||
vim.keymap.set(mode, lhs, rhs, {})
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local telescope = require("telescope")
|
|
||||||
local builtin = require("telescope.builtin")
|
|
||||||
|
|
||||||
telescope.setup {
|
|
||||||
defaults = {
|
|
||||||
layout_config = { prompt_position = "top" },
|
|
||||||
sorting_strategy = "ascending"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
telescope.load_extension("fzf")
|
|
||||||
|
|
||||||
map("n", "<leader>ff", builtin.fd)
|
|
||||||
map("n", "<leader>fw", builtin.live_grep)
|
|
||||||
map("n", "<leader>fb", builtin.buffers)
|
|
||||||
map("n", "<C-f>", builtin.current_buffer_fuzzy_find)
|
|
||||||
|
|
||||||
-- Visual word highlight
|
|
||||||
map("v", "<C-f>", "y<ESC>:Telescope current_buffer_fuzzy_find default_text=<c-r>0<CR>")
|
|
||||||
map("v", "<leader>fw", "y<ESC>:Telescope live_grep default_text=<c-r>0<CR>")
|
|
||||||
map("v", "<leader>ff", "y<ESC>:Telescope fd default_text=<c-r>0<CR>")
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
return {
|
|
||||||
"folke/tokyonight.nvim",
|
|
||||||
lazy = false,
|
|
||||||
priority = 1000,
|
|
||||||
opts = {
|
|
||||||
style = "night"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user