aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/nvim')
-rw-r--r--vim/nvim/init.vim44
-rw-r--r--vim/nvim/lazy.lua39
-rw-r--r--vim/nvim/lua/chadrc.lua47
-rw-r--r--vim/nvim/lua/configs/conform.lua15
-rw-r--r--vim/nvim/lua/configs/lazy.lua47
-rw-r--r--vim/nvim/lua/configs/lspconfig.lua23
-rw-r--r--vim/nvim/lua/configs/telescope.lua48
-rw-r--r--vim/nvim/lua/configs/treesitter.lua62
-rw-r--r--vim/nvim/lua/mappings.lua170
-rw-r--r--vim/nvim/lua/options.lua20
-rw-r--r--vim/nvim/lua/plugins/init.lua218
11 files changed, 0 insertions, 733 deletions
diff --git a/vim/nvim/init.vim b/vim/nvim/init.vim
deleted file mode 100644
index 20a1c74..0000000
--- a/vim/nvim/init.vim
+++ /dev/null
@@ -1,44 +0,0 @@
1" Avoid load this script twice
2if get(s:, 'loaded', 0) != 0
3 finish
4else
5 let s:loaded = 1
6endif
7
8" Get current dir
9" let s:home = fnamemodify(resolve(expand('<sfile>:p')), ':h')
10let s:home = '~/helper/vim'
11
12" Load script in current dir
13" command! -nargs=1 LoadScript exec 'source '.s:home.'/'.'<args>'
14
15" Add current dir into runtimepath
16execute 'set runtimepath+='.s:home
17
18
19"----------------------------------------------------------------------
20" Locad Modules
21"----------------------------------------------------------------------
22
23" Basic configuration
24source ~/helper/vim/init/basic.vim
25
26" Key mappings
27source ~/helper/vim/init/keymaps.vim
28
29" Extra config for different contexts
30source ~/helper/vim/init/config.vim
31
32" Set tabsize
33source ~/helper/vim/init/tabsize.vim
34
35if has('nvim')
36 " For neovim
37 source ~/.config/nvim/lazy.lua
38else
39 " For vim
40 source ~/helper/vim/init/plugins.vim
41 source ~/helper/vim/init/style.vim
42endif
43
44source ~/helper/vim/init/special_highlight.vim
diff --git a/vim/nvim/lazy.lua b/vim/nvim/lazy.lua
deleted file mode 100644
index 6cfadf0..0000000
--- a/vim/nvim/lazy.lua
+++ /dev/null
@@ -1,39 +0,0 @@
1vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
2vim.g.mapleader = ","
3
4-- bootstrap lazy and all plugins
5local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
6
7if not vim.loop.fs_stat(lazypath) then
8 local repo = "https://github.com/folke/lazy.nvim.git"
9 vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
10end
11
12vim.opt.rtp:prepend(lazypath)
13
14local lazy_config = require "configs.lazy"
15
16-- load plugins
17require("lazy").setup({
18 {
19 "NvChad/NvChad",
20 lazy = false,
21 branch = "v2.5",
22 import = "nvchad.plugins",
23 config = function()
24 require "options"
25 end,
26 },
27
28 { import = "plugins" },
29}, lazy_config)
30
31-- load theme
32dofile(vim.g.base46_cache .. "defaults")
33dofile(vim.g.base46_cache .. "statusline")
34
35require "nvchad.autocmds"
36
37vim.schedule(function()
38 require "mappings"
39end)
diff --git a/vim/nvim/lua/chadrc.lua b/vim/nvim/lua/chadrc.lua
deleted file mode 100644
index aa0d78c..0000000
--- a/vim/nvim/lua/chadrc.lua
+++ /dev/null
@@ -1,47 +0,0 @@
1-- This file needs to have same structure as nvconfig.lua
2-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua
3
4---@type ChadrcConfig
5local M = {}
6
7M.ui = {
8 theme = "onedark",
9
10 -- hl_override = {
11 -- Comment = { italic = true },
12 -- ["@comment"] = { italic = true },
13 -- },
14 tabufline = {
15 enabled = true,
16 },
17}
18
19-- For tabufline
20if M.ui.tabufline.enabled then
21 vim.keymap.set("n", "<C-c>", function()
22 local bufnrs = vim.tbl_filter(function(b)
23 if 1 ~= vim.fn.buflisted(b) then
24 return false
25 else
26 return true
27 end
28 end, vim.api.nvim_list_bufs())
29 if #bufnrs == 1 then
30 vim.cmd("silent quit!")
31 else
32 require("nvchad.tabufline").close_buffer()
33 end
34 end, { desc = "buffer close" })
35 for i = 1, 9, 1 do
36 vim.keymap.set("n", string.format("<A-%s>", i), function()
37 vim.api.nvim_set_current_buf(vim.t.bufs[i])
38 end)
39 end
40 vim.keymap.set("n", "<A-h>", function() require("nvchad.tabufline").move_buf(-1) end)
41 vim.keymap.set("n", "<A-l>", function() require("nvchad.tabufline").move_buf(1) end)
42 vim.keymap.set("n", "<A-H>", function() vim.cmd("tabprevious") end)
43 vim.keymap.set("n", "<A-L>", function() vim.cmd("tabnext") end)
44end
45
46
47return M
diff --git a/vim/nvim/lua/configs/conform.lua b/vim/nvim/lua/configs/conform.lua
deleted file mode 100644
index a000447..0000000
--- a/vim/nvim/lua/configs/conform.lua
+++ /dev/null
@@ -1,15 +0,0 @@
1local options = {
2 formatters_by_ft = {
3 lua = { "stylua" },
4 -- css = { "prettier" },
5 -- html = { "prettier" },
6 },
7
8 -- format_on_save = {
9 -- -- These options will be passed to conform.format()
10 -- timeout_ms = 500,
11 -- lsp_fallback = true,
12 -- },
13}
14
15require("conform").setup(options)
diff --git a/vim/nvim/lua/configs/lazy.lua b/vim/nvim/lua/configs/lazy.lua
deleted file mode 100644
index cd170bd..0000000
--- a/vim/nvim/lua/configs/lazy.lua
+++ /dev/null
@@ -1,47 +0,0 @@
1return {
2 defaults = { lazy = true },
3 install = { colorscheme = { "nvchad" } },
4
5 ui = {
6 icons = {
7 ft = "",
8 lazy = "󰂠 ",
9 loaded = "",
10 not_loaded = "",
11 },
12 },
13
14 performance = {
15 rtp = {
16 disabled_plugins = {
17 "2html_plugin",
18 "tohtml",
19 "getscript",
20 "getscriptPlugin",
21 "gzip",
22 "logipat",
23 "netrw",
24 "netrwPlugin",
25 "netrwSettings",
26 "netrwFileHandlers",
27 "matchit",
28 "tar",
29 "tarPlugin",
30 "rrhelper",
31 "spellfile_plugin",
32 "vimball",
33 "vimballPlugin",
34 "zip",
35 "zipPlugin",
36 "tutor",
37 "rplugin",
38 "syntax",
39 "synmenu",
40 "optwin",
41 "compiler",
42 "bugreport",
43 "ftplugin",
44 },
45 },
46 },
47}
diff --git a/vim/nvim/lua/configs/lspconfig.lua b/vim/nvim/lua/configs/lspconfig.lua
deleted file mode 100644
index a73657a..0000000
--- a/vim/nvim/lua/configs/lspconfig.lua
+++ /dev/null
@@ -1,23 +0,0 @@
1-- EXAMPLE
2local on_attach = require("nvchad.configs.lspconfig").on_attach
3local on_init = require("nvchad.configs.lspconfig").on_init
4local capabilities = require("nvchad.configs.lspconfig").capabilities
5
6local lspconfig = require "lspconfig"
7local servers = { "html", "cssls" }
8
9-- lsps with default config
10for _, lsp in ipairs(servers) do
11 lspconfig[lsp].setup {
12 on_attach = on_attach,
13 on_init = on_init,
14 capabilities = capabilities,
15 }
16end
17
18-- typescript
19lspconfig.tsserver.setup {
20 on_attach = on_attach,
21 on_init = on_init,
22 capabilities = capabilities,
23}
diff --git a/vim/nvim/lua/configs/telescope.lua b/vim/nvim/lua/configs/telescope.lua
deleted file mode 100644
index 73c64e5..0000000
--- a/vim/nvim/lua/configs/telescope.lua
+++ /dev/null
@@ -1,48 +0,0 @@
1return {
2 defaults = {
3 mappings = {
4 i = {
5 -- ["<c-j>"] = "move_selection_next",
6 -- ["<c-k>"] = "move_selection_previous",
7 ["<C-w>"] = require("telescope.actions.layout").toggle_preview,
8 ["<C-u>"] = false,
9 },
10 },
11 layout_config = {
12 horizontal = {
13 prompt_position = "bottom",
14 },
15 vertical = { height = 0.8 },
16 -- other layout configuration here
17 preview_cutoff = 0,
18 },
19 },
20 pickers = {
21 buffers = {
22 show_all_buffers = true,
23 sort_lastused = true,
24 theme = "dropdown",
25 previewer = false,
26 mappings = {
27 i = {
28 ["<c-d>"] = "delete_buffer",
29 },
30 n = {
31 ["<c-d>"] = "delete_buffer",
32 }
33 }
34 },
35
36 },
37 extensions_list = {},
38 extensions = {
39 aerial = {
40 -- Display symbols as <root>.<parent>.<symbol>
41 show_nesting = {
42 ["_"] = false, -- This key will be the default
43 json = true, -- You can set the option for specific filetypes
44 yaml = true,
45 },
46 },
47 },
48}
diff --git a/vim/nvim/lua/configs/treesitter.lua b/vim/nvim/lua/configs/treesitter.lua
deleted file mode 100644
index 8375d5b..0000000
--- a/vim/nvim/lua/configs/treesitter.lua
+++ /dev/null
@@ -1,62 +0,0 @@
1return {
2 -- Add languages to be installed here that you want installed for treesitter
3 ensure_installed = { 'bash', 'c', 'html', 'css', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
4
5 -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
6 auto_install = true,
7
8 -- highlight = { enable = true },
9 incremental_selection = {
10 enable = true,
11 keymaps = {
12 init_selection = '<c-space>',
13 node_incremental = '<c-space>',
14 scope_incremental = '<c-s>',
15 node_decremental = '<M-space>',
16 },
17 },
18 textobjects = {
19 select = {
20 enable = true,
21 lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
22 keymaps = {
23 -- You can use the capture groups defined in textobjects.scm
24 ['aa'] = '@parameter.outer',
25 ['ia'] = '@parameter.inner',
26 ['af'] = '@function.outer',
27 ['if'] = '@function.inner',
28 ['ac'] = '@class.outer',
29 ['ic'] = '@class.inner',
30 },
31 },
32 move = {
33 enable = true,
34 set_jumps = true, -- whether to set jumps in the jumplist
35 goto_next_start = {
36 [']f'] = '@function.outer',
37 [']c'] = '@class.outer',
38 },
39 goto_next_end = {
40 [']F'] = '@function.outer',
41 [']C'] = '@class.outer',
42 },
43 goto_previous_start = {
44 ['[f'] = '@function.outer',
45 ['[c'] = '@class.outer',
46 },
47 goto_previous_end = {
48 ['[F'] = '@function.outer',
49 ['[C'] = '@class.outer',
50 },
51 },
52 swap = {
53 enable = true,
54 swap_next = {
55 ['<leader>a'] = '@parameter.inner',
56 },
57 swap_previous = {
58 ['<leader>A'] = '@parameter.inner',
59 },
60 },
61 },
62}
diff --git a/vim/nvim/lua/mappings.lua b/vim/nvim/lua/mappings.lua
deleted file mode 100644
index f6ef8c4..0000000
--- a/vim/nvim/lua/mappings.lua
+++ /dev/null
@@ -1,170 +0,0 @@
1-- require "nvchad.mappings"
2
3-- add yours here
4
5local map = vim.keymap.set
6
7map("i", "jk", "<ESC>")
8vim.cmd("command! W execute 'SudaWrite %'")
9
10-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
11
12map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
13
14-- map("n", "<C-c>", "<cmd>%y+<CR>", { desc = "file copy whole" })
15
16-- map("n", "<leader>n", "<cmd>set nu!<CR>", { desc = "toggle line number" })
17-- map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "toggle relative number" })
18map("n", "<leader>ch", "<cmd>NvCheatsheet<CR>", { desc = "toggle nvcheatsheet" })
19
20map("n", "<leader>F", function()
21 require("conform").format { lsp_fallback = true }
22end, { desc = "format files" })
23
24-- global lsp mappings
25map("n", "<leader>ds", vim.diagnostic.setloclist, { desc = "lsp diagnostic loclist" })
26
27-- tabufline
28map("n", "<tab>", function()
29 require("nvchad.tabufline").next()
30end, { desc = "buffer goto next" })
31
32map("n", "<S-tab>", function()
33 require("nvchad.tabufline").prev()
34end, { desc = "buffer goto prev" })
35
36map("n", "<leader>x", function()
37 require("nvchad.tabufline").close_buffer()
38end, { desc = "buffer close" })
39
40-- Comment
41map("n", "<leader>/", "gcc", { desc = "comment toggle", remap = true })
42map("v", "<leader>/", "gc", { desc = "comment toggle", remap = true })
43
44-- nvimtree
45map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" })
46map("n", "<leader>nf", "<cmd>NvimTreeFocus<CR>", { desc = "nvimtree focus window" })
47
48-- telescope
49map("n", "<leader>f", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" })
50map("n", "<leader>b", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" })
51map("n", "<leader>/", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "telescope find in current buffer" })
52map("n", "<leader>sf", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
53map("n", "<leader>sF", "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>",
54 { desc = "telescope find all files" })
55map("n", "<leader>sg", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" })
56
57map("n", "<leader>gf", "<cmd>Telescope git_files<CR>", { desc = "telescope git files" })
58map("n", "<leader>sH", "<cmd>Telescope help_tags<CR>", { desc = "telescope help page" })
59map("n", "<leader>tt", ":Telescope ", { desc = "telescope help page" })
60map('n', '<leader>sk', "<cmd>Telescope keymaps<CR>", { desc = 'telescope keymaps' })
61map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
62
63vim.keymap.set('n', '<leader>ss', function()
64 local current_filetype = vim.bo.filetype
65 local cwd = os.getenv("HOME") .. '/snippets/' .. current_filetype
66 require('telescope.builtin').find_files {
67 prompt_title = 'Select a snippet for ' .. current_filetype,
68 cwd = cwd,
69 attach_mappings = function(prompt_bufnr, map)
70 local insert_selected_snippet = function()
71 local file = require('telescope.actions.state').get_selected_entry()[1]
72 local snippet_content = vim.fn.readfile(cwd .. "/" .. file)
73 require('telescope.actions').close(prompt_bufnr)
74 vim.api.nvim_put(snippet_content, '', false, true)
75 end
76
77 map('i', '<CR>', insert_selected_snippet)
78 map('n', '<CR>', insert_selected_snippet)
79
80 return true
81 end,
82 }
83end, { desc = '[S]earch [S]nippets' })
84
85vim.keymap.set('n', '<leader>sn', function()
86 vim.ui.input({ prompt = 'Snippet Name: ' }, function(snippet_path)
87 local current_filetype
88 local snippet
89 if string.find(snippet_path, "/") then
90 current_filetype = string.match(snippet_path, "^(.-)/")
91 snippet = string.match(snippet_path, "/(.-)$")
92 else
93 current_filetype = vim.bo.filetype
94 snippet = snippet_path
95 end
96 local dir = os.getenv("HOME") .. '/snippets/' .. current_filetype
97 local path = dir .. '/' .. snippet
98 vim.cmd("!mkdir -p" .. dir)
99 vim.cmd("e " .. path)
100 vim.cmd("set filetype=" .. current_filetype)
101 vim.cmd("set filetype?")
102 end)
103end, { desc = "Create a new snippet" })
104
105
106-- map("n", "<leader>ma", "<cmd>Telescope marks<CR>", { desc = "telescope find marks" })
107-- map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
108-- map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
109-- map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "telescope nvchad themes" })
110
111-- terminal
112-- map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
113
114-- new terminals
115map("n", "<leader><leader>h", function() require("nvchad.term").new { pos = "sp" } end,
116 { desc = "terminal new horizontal term" })
117map("n", "<leader>v", function() require("nvchad.term").new { pos = "vsp" } end,
118 { desc = "terminal new vertical window" })
119-- toggleable
120map({ "n", "t" }, "<A-v>", function() require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm" } end,
121 { desc = "terminal toggleable vertical term" })
122map({ "n", "t" }, "<A-t>", function() require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" } end,
123 { desc = "terminal new horizontal term" })
124map({ "n", "t" }, "<A-i>", function() require("nvchad.term").toggle { pos = "float", id = "floatTerm" } end,
125 { desc = "terminal toggle floating term" })
126
127-- whichkey
128map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "whichkey all keymaps" })
129
130map("n", "<leader>wk", function()
131 vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ")
132end, { desc = "whichkey query lookup" })
133
134-- blankline
135map("n", "<leader>cc", function()
136 local config = { scope = {} }
137 config.scope.exclude = { language = {}, node_type = {} }
138 config.scope.include = { node_type = {} }
139 local node = require("ibl.scope").get(vim.api.nvim_get_current_buf(), config)
140
141 if node then
142 local start_row, _, end_row, _ = node:range()
143 if start_row ~= end_row then
144 vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start_row + 1, 0 })
145 vim.api.nvim_feedkeys("_", "n", true)
146 end
147 end
148end, { desc = "blankline jump to current context" })
149
150-- [[ Configure Obsidian.nvim ]]
151map('n', "<leader>oo", ':Obsidian')
152map('n', "<leader>ot", ':ObsidianTags<CR>')
153map('n', "<leader>os", ':ObsidianSearch<CR>')
154map('n', "<leader>oq", ':ObsidianQuickSwitch<CR>')
155map('v', "<leader>on", ':ObsidianLinkNew<CR>')
156
157-- vim.cmd("let g:mkdp_browser = 'surf'")
158vim.cmd("let g:mkdp_browser = 'firefox'")
159vim.g.mkdp_preview_options = {
160 mkit = { breaks = true },
161 toc = {
162 containerClass = "toc",
163 format = 'function format(x, htmlencode) { return `<span>${htmlencode(x)}</span>`; }',
164 callback = "console.log('foo')",
165 }
166}
167
168-- [ Configure Hop ]
169vim.keymap.set('n', "<space>", ':HopWord<CR>')
170vim.keymap.set('n', '<C-.>', ':HopChar1<CR>')
diff --git a/vim/nvim/lua/options.lua b/vim/nvim/lua/options.lua
deleted file mode 100644
index f9e6e7e..0000000
--- a/vim/nvim/lua/options.lua
+++ /dev/null
@@ -1,20 +0,0 @@
1require "nvchad.options"
2
3-- add yours here!
4
5local o = vim.o
6
7-- To enable cursorline!
8o.cursorlineopt ='both'
9
10-- Let cursor be line in insert mode
11o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"
12
13-- Enable break indent
14o.breakindent = true
15
16-- To have a better completion experience
17o.completeopt = 'menuone,noselect'
18
19-- NOTE: You should make sure your terminal supports this
20o.termguicolors = true
diff --git a/vim/nvim/lua/plugins/init.lua b/vim/nvim/lua/plugins/init.lua
deleted file mode 100644
index 132f1a2..0000000
--- a/vim/nvim/lua/plugins/init.lua
+++ /dev/null
@@ -1,218 +0,0 @@
1return {
2
3 -- Detect tabstop and shiftwidth automatically
4 'tpope/vim-sleuth',
5
6 -- Use sudo in command mode
7 {
8 'lambdalisue/suda.vim',
9 cmd = { "SudaWrite" },
10 },
11
12 -- For focus mode
13 {
14 "Pocco81/true-zen.nvim",
15 cmd = { "TZAtaraxis", "TZMinimalist" },
16 },
17
18 -- hop.nvim: For quick jump
19 {
20 'smoka7/hop.nvim',
21 lazy = false,
22 version = "*",
23 opts = {
24 keys = 'etovxqpdygfblzhckisuran'
25 },
26 config = function()
27 require("hop").setup()
28 end
29 },
30
31 {
32 "stevearc/conform.nvim",
33 -- event = 'BufWritePre', -- uncomment for format on save
34 config = function()
35 require "configs.conform"
36 end,
37 },
38
39 {
40 -- Add indentation guides even on blank lines
41 'lukas-reineke/indent-blankline.nvim',
42 -- See `:help ibl`
43 enabled = false,
44 main = "ibl",
45 opts = {
46 indent = { char = "┊" },
47 whitespace = { highlight = { "Whitespace", "NonText" } },
48 },
49 },
50
51 {
52 'lewis6991/gitsigns.nvim',
53 opts = {
54 -- See `:help gitsigns.txt`
55 signs = {
56 add = { text = '+' },
57 change = { text = '~' },
58 delete = { text = '_' },
59 topdelete = { text = '‾' },
60 changedelete = { text = '~' },
61 },
62 on_attach = function(bufnr)
63 vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
64 { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
65 vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
66 vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
67 vim.keymap.set('n', '<leader>hd', require('gitsigns').diffthis, { buffer = bufnr, desc = '[h]unk [d]iff' })
68 vim.keymap.set('n', '<leader>hD', function() require('gitsigns').diffthis('~') end,
69 { buffer = bufnr, desc = '[h]unk [d]iff for ~' })
70 vim.keymap.set('v', 'hr', ":Gitsigns reset_hunk<CR>", { buffer = bufnr, desc = '[h]unk [r]eset' })
71 end,
72 },
73 },
74
75 {
76 "epwalsh/obsidian.nvim",
77 version = "*", -- recommended, use latest release instead of latest commit
78 lazy = true,
79 ft = "markdown",
80 -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
81 -- event = {
82 -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
83 -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
84 -- "BufReadPre path/to/my-vault/**.md",
85 -- "BufNewFile path/to/my-vault/**.md",
86 -- },
87 dependencies = {
88 -- Required.
89 "nvim-lua/plenary.nvim",
90 },
91 opts = {
92 workspaces = {
93 {
94 name = "log",
95 path = "~/log",
96 },
97 },
98 completion = {
99 -- Set to false to disable completion.
100 nvim_cmp = true,
101 -- Trigger completion at 2 chars.
102 min_chars = 2,
103 },
104 mapping = {
105 -- Toggle check-boxes.
106 ["<leader>oc"] = {
107 action = function()
108 return require("obsidian").util.toggle_checkbox()
109 end,
110 opts = { buffer = true },
111 },
112 -- Smart action depending on context, either follow link or toggle checkbox.
113 ["<cr>"] = {
114 action = function()
115 return require("obsidian").util.smart_action()
116 end,
117 opts = { buffer = true, expr = true },
118 }
119 },
120 -- see below for full list of options 👇
121 note_id_func = function(title)
122 return title
123 -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
124 -- In this case a note with the title 'My new note' will be given an ID that looks
125 -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
126 -- local suffix = ""
127 -- title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
128 -- if title ~= nil and title ~= "" then
129 -- -- If title is given, transform it into valid file name.
130 -- suffix = "-" .. title
131 -- else
132 -- -- If title is nil, just add 4 random uppercase letters to the suffix.
133 -- for _ = 1, 4 do
134 -- suffix = suffix .. string.char(math.random(65, 90))
135 -- end
136 -- suffix = "-" .. title
137 -- end
138 -- return tostring(os.time()) .. suffix
139 end,
140 },
141 },
142
143 {
144 "iamcco/markdown-preview.nvim",
145 cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
146 ft = { "markdown" },
147 build = function() vim.fn["mkdp#util#install"]() end,
148 },
149
150 {
151 "nvim-telescope/telescope.nvim",
152 opts = function()
153 return require "configs.telescope"
154 end,
155 },
156
157 {
158 "nvim-treesitter/nvim-treesitter",
159 dependencies = {
160 'nvim-treesitter/nvim-treesitter-textobjects',
161 },
162 opts = function()
163 return require "configs.treesitter"
164 end,
165 },
166
167 {
168 'stevearc/aerial.nvim',
169 lazy = false,
170 event = { "BufReadPost", "BufWritePost", "BufNewFile" },
171 opts = {
172 on_attach = function(bufnr)
173 -- Jump forwards/backwards with '{' and '}'
174 vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
175 vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
176 vim.keymap.set("n", "<leader><leader>a", "<cmd>Telescope aerial<CR>")
177 vim.keymap.set("n", "<leader><leader>A", "<cmd>AerialToggle!left<CR>")
178 end,
179 },
180 -- Optional dependencies
181 dependencies = {
182 "nvim-treesitter/nvim-treesitter",
183 "nvim-tree/nvim-web-devicons"
184 },
185 },
186
187 -- {
188 -- 'numToStr/Comment.nvim',
189 -- lazy = true,
190 -- opts = {
191 -- opleader = {
192 -- ---Line-comment keymap
193 -- line = '<C-/>',
194 -- ---Block-comment keymap
195 -- block = 'gb',
196 -- },
197 -- }
198 -- },
199
200 -- These are some examples, uncomment them if you want to see them work!
201 -- {
202 -- "neovim/nvim-lspconfig",
203 -- config = function()
204 -- require("nvchad.configs.lspconfig").defaults()
205 -- require "configs.lspconfig"
206 -- end,
207 -- },
208 --
209 -- {
210 -- "williamboman/mason.nvim",
211 -- opts = {
212 -- ensure_installed = {
213 -- "lua-language-server", "stylua",
214 -- "html-lsp", "css-lsp" , "prettier"
215 -- },
216 -- },
217 -- },
218}