aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/lazy/lazy.lua
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-06-24 16:34:51 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-06-24 16:34:51 +0800
commit2a1645ae9593114514a7f28fa6d9109d1820375d (patch)
treebab2ac0a019ca9af961a04b2a58f0bac3d49bdeb /vim/lazy/lazy.lua
parentfdb53f590cef5499b14322d22fee47722b135626 (diff)
Update
Diffstat (limited to 'vim/lazy/lazy.lua')
-rw-r--r--vim/lazy/lazy.lua424
1 files changed, 0 insertions, 424 deletions
diff --git a/vim/lazy/lazy.lua b/vim/lazy/lazy.lua
deleted file mode 100644
index 4aef220..0000000
--- a/vim/lazy/lazy.lua
+++ /dev/null
@@ -1,424 +0,0 @@
1--[[
2
3From kickstarter
4
5 TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
6
7 If you don't know anything about Lua, I recommend taking some time to read through
8 a guide. One possible example which will only take 10-15 minutes:
9 - https://learnxinyminutes.com/docs/lua/
10
11 After understanding a bit more about Lua, you can use `:help lua-guide` as a
12 reference for how Neovim integrates Lua.
13 - :help lua-guide
14 - (or HTML version): https://neovim.io/doc/user/lua-guide.html
15
16 MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
17 which is very useful when you're not exactly sure of what you're looking for.
18--]]
19
20-- Install package manager
21-- https://github.com/folke/lazy.nvim
22-- `:help lazy.nvim.txt` for more info
23local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
24if not vim.loop.fs_stat(lazypath) then
25 vim.fn.system {
26 'git',
27 'clone',
28 '--filter=blob:none',
29 'https://github.com/folke/lazy.nvim.git',
30 '--branch=stable', -- latest stable release
31 lazypath,
32 }
33end
34vim.opt.runtimepath:prepend(lazypath)
35
36-- NOTE: Here is where you install your plugins.
37-- You can configure plugins using the `config` key.
38--
39-- You can also configure plugins after the setup call,
40-- as they will be available in your neovim runtime.
41require('lazy').setup({
42 -- NOTE: First, some plugins that don't require any configuration
43 -- Git related plugins
44 'tpope/vim-fugitive',
45 -- 'tpope/vim-rhubarb',
46
47 -- Detect tabstop and shiftwidth automatically
48 'tpope/vim-sleuth',
49
50 -- Use sudo in command mode
51 'lambdalisue/suda.vim',
52
53 -- For surrounding
54 'tpope/vim-surround',
55
56
57 -- From vim plugin
58 'junegunn/goyo.vim',
59 'itchyny/lightline.vim',
60 'preservim/nerdtree',
61
62 -- gitsigns.nvim: Adds git related signs to the gutter, as well as utilities for managing changes
63 {
64 'lewis6991/gitsigns.nvim',
65 opts = {
66 -- See `:help gitsigns.txt`
67 signs = {
68 add = { text = '+' },
69 change = { text = '~' },
70 delete = { text = '_' },
71 topdelete = { text = '‾' },
72 changedelete = { text = '~' },
73 },
74 on_attach = function(bufnr)
75 vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
76 { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
77 vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
78 vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
79 vim.keymap.set('n', '<leader>hd', require('gitsigns').diffthis, { buffer = bufnr, desc = '[h]unk [d]iff' })
80 vim.keymap.set('n', '<leader>hD', function() require('gitsigns').diffthis('~') end,
81 { buffer = bufnr, desc = '[h]unk [d]iff for ~' })
82 vim.keymap.set('v', 'hr', ":Gitsigns reset_hunk<CR>", { buffer = bufnr, desc = '[h]unk [r]eset' })
83 end,
84 },
85 },
86
87 -- onedark: colorscheme
88 {
89 -- onedark.nvim: Theme inspired by Atom
90 'navarasu/onedark.nvim',
91 priority = 1000,
92 config = function()
93 vim.cmd.colorscheme 'onedark'
94 -- vim.cmd('source ~/.vim/vim-init/init/init-basic.vim')
95 end,
96 },
97
98 -- hop.nvim: For quick jump
99 {
100 'smoka7/hop.nvim',
101 version = "*",
102 opts = {
103 keys = 'etovxqpdygfblzhckisuran'
104 }
105 },
106
107 -- which-key.nvim: Useful plugin to show you pending keybinds.
108 {
109 'folke/which-key.nvim',
110 opts = {
111 plugins = {
112 spelling = {
113 enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
114 suggestions = 20, -- how many suggestions should be shown in the list?
115 },
116 }
117 }
118 },
119
120 -- obsidian.nvim: For obsidian
121 {
122 "epwalsh/obsidian.nvim",
123 version = "*", -- recommended, use latest release instead of latest commit
124 lazy = true,
125 ft = "markdown",
126 -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
127 -- event = {
128 -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
129 -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
130 -- "BufReadPre path/to/my-vault/**.md",
131 -- "BufNewFile path/to/my-vault/**.md",
132 -- },
133 dependencies = {
134 -- Required.
135 "nvim-lua/plenary.nvim",
136
137 -- see below for full list of optional dependencies 👇
138 },
139 opts = {
140 workspaces = {
141 {
142 name = "log",
143 path = "~/log",
144 },
145 },
146 completion = {
147 -- Set to false to disable completion.
148 nvim_cmp = true,
149 -- Trigger completion at 2 chars.
150 min_chars = 2,
151 },
152 mapping = {
153 -- Toggle check-boxes.
154 ["<leader>oc"] = {
155 action = function()
156 return require("obsidian").util.toggle_checkbox()
157 end,
158 opts = { buffer = true },
159 },
160 -- Smart action depending on context, either follow link or toggle checkbox.
161 ["<cr>"] = {
162 action = function()
163 return require("obsidian").util.smart_action()
164 end,
165 opts = { buffer = true, expr = true },
166 }
167 },
168 -- see below for full list of options 👇
169 note_id_func = function(title)
170 return title
171 -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
172 -- In this case a note with the title 'My new note' will be given an ID that looks
173 -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
174 -- local suffix = ""
175 -- title = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
176 -- if title ~= nil and title ~= "" then
177 -- -- If title is given, transform it into valid file name.
178 -- suffix = "-" .. title
179 -- else
180 -- -- If title is nil, just add 4 random uppercase letters to the suffix.
181 -- for _ = 1, 4 do
182 -- suffix = suffix .. string.char(math.random(65, 90))
183 -- end
184 -- suffix = "-" .. title
185 -- end
186 -- return tostring(os.time()) .. suffix
187 end,
188 },
189 },
190
191 -- markdown-preview: Install without yarn or npm
192 {
193 "iamcco/markdown-preview.nvim",
194 cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
195 ft = { "markdown" },
196 build = function() vim.fn["mkdp#util#install"]() end,
197 },
198
199 -- vim-beancount: For beancount
200 {
201 'nathangrigg/vim-beancount',
202 ft = { "beancount" },
203 },
204
205 -- NOTE: This is where your plugins related to LSP can be installed.
206 -- The configuration is done below. Search for lspconfig to find it below.
207 {
208 -- LSP Configuration & Plugins
209 'neovim/nvim-lspconfig',
210 dependencies = {
211 -- Automatically install LSPs to stdpath for neovim
212 { 'williamboman/mason.nvim', config = true },
213 'williamboman/mason-lspconfig.nvim',
214
215 -- Useful status updates for LSP
216 -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
217 { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
218
219 -- Additional lua configuration, makes nvim stuff amazing!
220 'folke/neodev.nvim',
221 },
222 },
223
224 {
225 -- Autocompletion
226 'hrsh7th/nvim-cmp',
227 dependencies = {
228 -- Snippet Engine & its associated nvim-cmp source
229 'L3MON4D3/LuaSnip',
230 'saadparwaiz1/cmp_luasnip',
231
232 -- Adds LSP completion capabilities
233 'hrsh7th/cmp-nvim-lsp',
234
235 -- Adds a number of user-friendly snippets
236 'rafamadriz/friendly-snippets',
237 },
238 },
239
240 {
241 'stevearc/aerial.nvim',
242 enable = false,
243 opts = {},
244 -- Optional dependencies
245 dependencies = {
246 "nvim-treesitter/nvim-treesitter",
247 "nvim-tree/nvim-web-devicons"
248 },
249 },
250
251
252 --{
253 -- -- Set lualine as statusline
254 -- 'nvim-lualine/lualine.nvim',
255 -- -- See `:help lualine.txt`
256 -- opts = {
257 -- options = {
258 -- icons_enabled = false,
259 -- theme = 'onedark',
260 -- component_separators = '|',
261 -- section_separators = { left = '', right = '' },
262 -- },
263 -- },
264 --},
265
266 {
267 -- Add indentation guides even on blank lines
268 'lukas-reineke/indent-blankline.nvim',
269 -- Enable `lukas-reineke/indent-blankline.nvim`
270 -- See `:help ibl`
271 main = "ibl",
272 opts = {
273 indent = { char = "┊" },
274 whitespace = { highlight = { "Whitespace", "NonText" } },
275 },
276 },
277
278 -- "gc" to comment visual regions/lines
279 --{ 'numToStr/Comment.nvim', opts = {} },
280 -- Another config
281 {
282 'numToStr/Comment.nvim',
283 opts = {
284 opleader = {
285 ---Line-comment keymap
286 line = '<C-/>',
287 ---Block-comment keymap
288 block = 'gb',
289 },
290 }
291 },
292
293
294 -- Fuzzy Finder (files, lsp, etc)
295 {
296 'nvim-telescope/telescope.nvim',
297 branch = '0.1.x',
298 dependencies = {
299 'nvim-lua/plenary.nvim',
300 -- Fuzzy Finder Algorithm which requires local dependencies to be built.
301 -- Only load if `make` is available. Make sure you have the system
302 -- requirements installed.
303 {
304 'nvim-telescope/telescope-fzf-native.nvim',
305 -- NOTE: If you are having trouble with this installation,
306 -- refer to the README for telescope-fzf-native for more instructions.
307 build = 'make',
308 cond = function()
309 return vim.fn.executable 'make' == 1
310 end,
311 },
312 'cljoly/telescope-repo.nvim',
313 },
314 },
315
316 {
317 -- Highlight, edit, and navigate code
318 'nvim-treesitter/nvim-treesitter',
319 dependencies = {
320 'nvim-treesitter/nvim-treesitter-textobjects',
321 },
322 build = ':TSUpdate',
323 },
324
325 -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
326 -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
327 -- up-to-date with whatever is in the kickstart repo.
328 -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
329 --
330 -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
331 -- { import = 'custom.plugins' },
332}, {})
333
334-- [[ Setting options ]]
335-- See `:help vim.o`
336
337-- Let cursor be line in insert mode
338vim.opt.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"
339
340-- Enable break indent
341vim.o.breakindent = true
342
343-- Set completeopt to have a better completion experience
344vim.o.completeopt = 'menuone,noselect'
345
346-- NOTE: You should make sure your terminal supports this
347vim.o.termguicolors = true
348
349-- [[ Basic Keymaps ]]
350
351-- Keymaps for better default experience
352-- See `:help vim.keymap.set()`
353-- vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
354
355-- Use suda.vim to run sudo, or terminal prompt fails
356-- See more details at https://github.com/neovim/neovim/issue
357vim.cmd("command! W execute 'SudaWrite %'")
358
359-- [[ Configure vim.surround ]]
360vim.cmd('vmap s S')
361
362-- [[ Configure lualine ]]
363-- Change the background of lualine_b section for normal mode
364-- local custom_wombat = require 'lualine.themes.wombat'
365-- custom_wombat.normal.b.bg = '#a8a8a8'
366-- custom_wombat.normal.b.fg = '#444444'
367-- require('lualine').setup {
368-- options = { theme = custom_wombat },
369-- }
370
371-- [[ Configure lightline ]]
372vim.cmd("let g:lightline = { 'colorscheme': 'wombat' }")
373
374-- [[ Configure Goyo ]]
375vim.cmd("nnoremap <silent> <leader>z :Goyo<CR>")
376
377-- [[ Configure NERDTree ]]
378vim.g.NERDTreeWinPos = 'left'
379vim.g.NERDTreeShowHidden = 0
380vim.api.nvim_set_var('NERDTreeWinSize', 22)
381vim.cmd("map <C-n> :NERDTreeToggle<cr>")
382vim.cmd("map <leader>nb :NERDTreeFromBookmark<Space>")
383vim.cmd("map <leader>nf :NERDTreeFind<cr>")
384vim.o.autochdir = 0
385-- vim.cmd("autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif")
386
387-- [ Configure Hop ]
388vim.keymap.set('n', "<space>", ':HopWord<CR>')
389vim.keymap.set('n', '<C-.>', ':HopChar1<CR>')
390
391-- [[ Highlight on yank ]]
392-- See `:help vim.highlight.on_yank()`
393-- local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
394-- vim.api.nvim_create_autocmd('TextYankPost', {
395-- callback = function()
396-- vim.highlight.on_yank()
397-- end,
398-- group = highlight_group,
399-- pattern = '*',
400-- })
401
402-- [[ Configure Comment.nvim ]]
403vim.cmd('nmap <C-/> V<C-/>')
404
405-- [[ Configure Obsidian.nvim ]]
406vim.keymap.set('n', "<leader>oo", ':Obsidian')
407vim.keymap.set('n', "<leader>ot", ':ObsidianTags<CR>')
408vim.keymap.set('n', "<leader>os", ':ObsidianSearch<CR>')
409vim.keymap.set('n', "<leader>oq", ':ObsidianQuickSwitch<CR>')
410vim.keymap.set('v', "<leader>on", ':ObsidianLinkNew<CR>')
411
412-- vim.cmd("let g:mkdp_browser = 'surf'")
413vim.cmd("let g:mkdp_browser = 'firefox'")
414vim.g.mkdp_preview_options = {
415 mkit = { breaks = true },
416 toc= {
417 containerClass = "toc",
418 format = 'function format(x, htmlencode) { return `<span>${htmlencode(x)}</span>`; }',
419 callback = "console.log('foo')",
420 }
421}
422
423-- The line beneath this is called `modeline`. See `:help modeline`
424-- vim: ts=2 sts=2 sw=2 et