From 2c592d521dc255bca1f044fa660246bdff2f0919 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 1 May 2023 22:09:07 +0800 Subject: Update --- init.lua | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'init.lua') 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({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- Use sudo in command mode + 'lambdalisue/suda.vim', + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. { -- LSP Configuration & Plugins @@ -92,7 +95,11 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = { + triggers_blacklist = { + n = { ":" }, -- ignore : in normal mode + }, + } }, { -- Adds git releated signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', opts = { @@ -171,20 +178,14 @@ require('lazy').setup({ -- -- An additional note is that if you only copied in the `init.lua`, you can just comment this line -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. - { import = 'custom.plugins' }, + --{ import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] -- See `:help vim.o` --- Set highlight on search -vim.o.hlsearch = false - --- Make line numbers default -vim.wo.number = true - -- Enable mouse mode -vim.o.mouse = 'a' +-- vim.o.mouse = 'a' -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. @@ -194,13 +195,6 @@ vim.o.clipboard = 'unnamedplus' -- Enable break indent vim.o.breakindent = true --- Save undo history -vim.o.undofile = true - --- Case insensitive searching UNLESS /C or capital in search -vim.o.ignorecase = true -vim.o.smartcase = true - -- Keep signcolumn on by default vim.wo.signcolumn = 'yes' @@ -215,14 +209,16 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true + -- [[ Basic Keymaps ]] -- Keymaps for better default experience -- See `:help vim.keymap.set()` --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- Use suda.vim to run sudo, or terminal prompt fails +-- See more details at https://github.com/neovim/neovim/issues/1716 +vim.keymap.set('n', ':W', "SudaWrite %") + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` @@ -245,15 +241,14 @@ require('telescope').setup { [''] = false, }, }, - }, -} + },} -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') -- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', 'f', require('telescope.builtin').oldfiles, { desc = '[f] Find recently opened files' }) +vim.keymap.set('n', 'q', require('telescope.builtin').buffers, { desc = '[q] Find existing buffers' }) vim.keymap.set('n', '/', function() -- You can pass additional configuration to telescope to change theme, layout, etc. require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { @@ -339,7 +334,7 @@ require('nvim-treesitter.configs').setup { vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) +-- vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. -- cgit v1.2.3-70-g09d2