Simplify configuration

This commit is contained in:
Saeed Afzal
2025-01-25 11:21:27 +00:00
parent 119f83f0ae
commit c24ea66ae7
7 changed files with 6 additions and 89 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "pack/vendor/start/vim-wakatime"]
path = pack/vendor/start/vim-wakatime
url = https://github.com/wakatime/vim-wakatime.git

View File

@@ -1,5 +1,4 @@
# Neovim Config
## Requirements
* [ripgrep](https://github.com/BurntSushi/ripgrep)
* [fd](https://github.com/sharkdp/fd)
## Getting Started
`git clone https://github.com/saeedafzal/neovim-config.git ~/.config/nvim --recursive`

View File

@@ -1,25 +1,5 @@
-- Core configuration
require "core"
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Load plugins
require("lazy").setup("plugins")
-- Theme
require("theme_switcher").toggle()

View File

@@ -10,11 +10,6 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
command = "Tabs 4"
})
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.ts", "*.tsx" },
command = "compiler tsc"
})
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.dart" },
callback = function()
@@ -27,30 +22,3 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = "*.md",
command = "set conceallevel=3"
})
-- 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
})

View File

@@ -1,31 +0,0 @@
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

View File

@@ -1,3 +0,0 @@
return {
"wakatime/vim-wakatime"
}