瀏覽代碼

handsome new plugin config

christianchiarulli 4 年之前
父節點
當前提交
89ea86f0ae
共有 5 個文件被更改,包括 32 次插入7 次删除
  1. 6 4
      lua/default-config.lua
  2. 4 0
      lua/lv-autocommands/init.lua
  3. 8 2
      lua/lv-hop/init.lua
  4. 11 1
      lua/plugins.lua
  5. 3 0
      lv-config.lua

+ 6 - 4
lua/default-config.lua

@@ -27,6 +27,8 @@ O = {
 
     database = {save_location = '~/.config/nvcode_db', auto_execute = 1},
 
+    plugins = {hop = {active = false}},
+
     lang = {
         python = {
             active = false,
@@ -143,10 +145,10 @@ O = {
         css = {
             active = false,
 
-            formatter = '', autoformat = false, virtual_text = true},
-        json = {
-            active = false,
-            formatter = '', autoformat = false, virtual_text = true}
+            formatter = '',
+            autoformat = false,
+            virtual_text = true
+        }
 
     },
 

+ 4 - 0
lua/lv-autocommands/init.lua

@@ -36,6 +36,9 @@ utils.define_augroups({
         {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
         {'VimLeavePre', '*', 'set title set titleold='},
         {'FileType', 'qf', 'set nobuflisted'},
+        {'BufWinEnter', 'lv-config.lua', 'PackerCompile'},
+        {'BufWinLeave', 'lv-config.lua', 'PackerCompile'},
+        {'BufWritePost', 'lv-config.lua', 'PackerCompile'}
 
         -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
         -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
@@ -44,6 +47,7 @@ utils.define_augroups({
         -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
         {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'}
     },
+
     _go = {
         -- Go generally requires Tabs instead of spaces.
         {'FileType', 'go', 'setlocal tabstop=4'},

+ 8 - 2
lua/lv-hop/init.lua

@@ -1,2 +1,8 @@
-vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
-vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
+local M = {}
+
+M.config = function()
+    vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
+    vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
+end
+
+return M

+ 11 - 1
lua/plugins.lua

@@ -27,7 +27,8 @@ local function require_plugin(plugin)
     return ok, err, code
 end
 
--- vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
+vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
+-- vim.cmd "autocmd BufWritePost lv-config.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
 
 return require("packer").startup(function(use)
     -- Packer can manage itself as an optional plugin
@@ -109,6 +110,15 @@ return require("packer").startup(function(use)
     }
 
     use {"hrsh7th/vim-vsnip"}
+    use {
+        event = 'BufRead',
+        'phaazon/hop.nvim',
+        config = function()
+            require('lv-hop').config()
+        end,
+        disable = not O.plugins.hop.active,
+        opt = true
+    }
 
     -- extras
     -- if O.matchup then require('lv-matchup') end

+ 3 - 0
lv-config.lua

@@ -16,6 +16,9 @@ O.document_highlight = true
 O.extras = false
 O.leader_key = ' '
 
+-- After changing plugin config it is recommended to run :PackerCompile
+O.plugins.hop.active = true
+
 -- dashboard
 -- O.dashboard.custom_header = {""}
 -- O.dashboard.footer = {""}