Simplify configuration
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal 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
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
# Neovim Config
|
# Neovim Config
|
||||||
|
|
||||||
## Requirements
|
## Getting Started
|
||||||
* [ripgrep](https://github.com/BurntSushi/ripgrep)
|
`git clone https://github.com/saeedafzal/neovim-config.git ~/.config/nvim --recursive`
|
||||||
* [fd](https://github.com/sharkdp/fd)
|
|
||||||
|
|||||||
20
init.lua
20
init.lua
@@ -1,25 +1,5 @@
|
|||||||
-- Core configuration
|
-- Core configuration
|
||||||
require "core"
|
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
|
-- Theme
|
||||||
require("theme_switcher").toggle()
|
require("theme_switcher").toggle()
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|||||||
command = "Tabs 4"
|
command = "Tabs 4"
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|
||||||
pattern = { "*.ts", "*.tsx" },
|
|
||||||
command = "compiler tsc"
|
|
||||||
})
|
|
||||||
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
pattern = { "*.dart" },
|
pattern = { "*.dart" },
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -27,30 +22,3 @@ api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|||||||
pattern = "*.md",
|
pattern = "*.md",
|
||||||
command = "set conceallevel=3"
|
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
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
return {
|
|
||||||
"wakatime/vim-wakatime"
|
|
||||||
}
|
|
||||||
1
pack/vendor/start/vim-wakatime
vendored
Submodule
1
pack/vendor/start/vim-wakatime
vendored
Submodule
Submodule pack/vendor/start/vim-wakatime added at cf51327a9e
Reference in New Issue
Block a user