aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-05-01 22:09:07 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-05-01 22:09:07 +0800
commit2c592d521dc255bca1f044fa660246bdff2f0919 (patch)
tree8a737e70b300ed9da2890a30cb75b3eddb1c625b
parentf59748e7d73c87ba42969a8f12cc0420bddb2ef1 (diff)
Update
-rw-r--r--init.lua43
1 files changed, 19 insertions, 24 deletions
diff --git a/init.lua b/init.lua
index 4f12dac..b33b0d5 100644
--- a/init.lua
+++ b/init.lua
@@ -68,6 +68,9 @@ require('lazy').setup({
68 -- Detect tabstop and shiftwidth automatically 68 -- Detect tabstop and shiftwidth automatically
69 'tpope/vim-sleuth', 69 'tpope/vim-sleuth',
70 70
71 -- Use sudo in command mode
72 'lambdalisue/suda.vim',
73
71 -- NOTE: This is where your plugins related to LSP can be installed. 74 -- NOTE: This is where your plugins related to LSP can be installed.
72 -- The configuration is done below. Search for lspconfig to find it below. 75 -- The configuration is done below. Search for lspconfig to find it below.
73 { -- LSP Configuration & Plugins 76 { -- LSP Configuration & Plugins
@@ -92,7 +95,11 @@ require('lazy').setup({
92 }, 95 },
93 96
94 -- Useful plugin to show you pending keybinds. 97 -- Useful plugin to show you pending keybinds.
95 { 'folke/which-key.nvim', opts = {} }, 98 { 'folke/which-key.nvim', opts = {
99 triggers_blacklist = {
100 n = { ":" }, -- ignore : in normal mode
101 },
102 } },
96 { -- Adds git releated signs to the gutter, as well as utilities for managing changes 103 { -- Adds git releated signs to the gutter, as well as utilities for managing changes
97 'lewis6991/gitsigns.nvim', 104 'lewis6991/gitsigns.nvim',
98 opts = { 105 opts = {
@@ -171,20 +178,14 @@ require('lazy').setup({
171 -- 178 --
172 -- An additional note is that if you only copied in the `init.lua`, you can just comment this line 179 -- An additional note is that if you only copied in the `init.lua`, you can just comment this line
173 -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. 180 -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`.
174 { import = 'custom.plugins' }, 181 --{ import = 'custom.plugins' },
175}, {}) 182}, {})
176 183
177-- [[ Setting options ]] 184-- [[ Setting options ]]
178-- See `:help vim.o` 185-- See `:help vim.o`
179 186
180-- Set highlight on search
181vim.o.hlsearch = false
182
183-- Make line numbers default
184vim.wo.number = true
185
186-- Enable mouse mode 187-- Enable mouse mode
187vim.o.mouse = 'a' 188-- vim.o.mouse = 'a'
188 189
189-- Sync clipboard between OS and Neovim. 190-- Sync clipboard between OS and Neovim.
190-- Remove this option if you want your OS clipboard to remain independent. 191-- Remove this option if you want your OS clipboard to remain independent.
@@ -194,13 +195,6 @@ vim.o.clipboard = 'unnamedplus'
194-- Enable break indent 195-- Enable break indent
195vim.o.breakindent = true 196vim.o.breakindent = true
196 197
197-- Save undo history
198vim.o.undofile = true
199
200-- Case insensitive searching UNLESS /C or capital in search
201vim.o.ignorecase = true
202vim.o.smartcase = true
203
204-- Keep signcolumn on by default 198-- Keep signcolumn on by default
205vim.wo.signcolumn = 'yes' 199vim.wo.signcolumn = 'yes'
206 200
@@ -215,14 +209,16 @@ vim.o.completeopt = 'menuone,noselect'
215-- NOTE: You should make sure your terminal supports this 209-- NOTE: You should make sure your terminal supports this
216vim.o.termguicolors = true 210vim.o.termguicolors = true
217 211
212
218-- [[ Basic Keymaps ]] 213-- [[ Basic Keymaps ]]
219 214
220-- Keymaps for better default experience 215-- Keymaps for better default experience
221-- See `:help vim.keymap.set()` 216-- See `:help vim.keymap.set()`
222 217
223-- Remap for dealing with word wrap 218-- Use suda.vim to run sudo, or terminal prompt fails
224vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) 219-- See more details at https://github.com/neovim/neovim/issues/1716
225vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) 220vim.keymap.set('n', ':W', "SudaWrite %<CR>")
221
226 222
227-- [[ Highlight on yank ]] 223-- [[ Highlight on yank ]]
228-- See `:help vim.highlight.on_yank()` 224-- See `:help vim.highlight.on_yank()`
@@ -245,15 +241,14 @@ require('telescope').setup {
245 ['<C-d>'] = false, 241 ['<C-d>'] = false,
246 }, 242 },
247 }, 243 },
248 }, 244 },}
249}
250 245
251-- Enable telescope fzf native, if installed 246-- Enable telescope fzf native, if installed
252pcall(require('telescope').load_extension, 'fzf') 247pcall(require('telescope').load_extension, 'fzf')
253 248
254-- See `:help telescope.builtin` 249-- See `:help telescope.builtin`
255vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) 250vim.keymap.set('n', '<leader>f', require('telescope.builtin').oldfiles, { desc = '[f] Find recently opened files' })
256vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) 251vim.keymap.set('n', '<leader>q', require('telescope.builtin').buffers, { desc = '[q] Find existing buffers' })
257vim.keymap.set('n', '<leader>/', function() 252vim.keymap.set('n', '<leader>/', function()
258 -- You can pass additional configuration to telescope to change theme, layout, etc. 253 -- You can pass additional configuration to telescope to change theme, layout, etc.
259 require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { 254 require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
@@ -339,7 +334,7 @@ require('nvim-treesitter.configs').setup {
339vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) 334vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
340vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) 335vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
341vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) 336vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
342vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) 337-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
343 338
344-- LSP settings. 339-- LSP settings.
345-- This function gets run when an LSP connects to a particular buffer. 340-- This function gets run when an LSP connects to a particular buffer.