Ver Fonte

Merge branch 'ChristianChiarulli:master' into master

Jacek Kiedrowski há 4 anos atrás
pai
commit
1f32f7737a

+ 4 - 2
ftplugin/python.lua

@@ -76,5 +76,7 @@ if O.lang.python.autoformat then
   }
 end
 
-local dap_install = require("dap-install")
-dap_install.config("python_dbg", {})
+if O.plugin.debug.active and O.plugin.dap_install.active then
+  local dap_install = require("dap-install")
+  dap_install.config("python_dbg", {})
+end

+ 10 - 42
lua/default-config.lua

@@ -4,6 +4,7 @@ CACHE_PATH = vim.fn.stdpath "cache"
 TERMINAL = vim.fn.expand "$TERMINAL"
 
 O = {
+
   auto_close_tree = 0,
   auto_complete = true,
   colorscheme = "lunar",
@@ -31,6 +32,10 @@ O = {
     rainbow = { enabled = false },
   },
 
+  lsp = {
+    popup_border = "single"
+  },
+
   database = { save_location = "~/.config/nvcode_db", auto_execute = 1 },
 
   plugin = {
@@ -72,6 +77,10 @@ O = {
     tabnine = { active = false },
   },
 
+  user_autocommands = {
+    { "FileType", "qf", "set nobuflisted" },
+  },
+
   lang = {
     python = {
       linter = "",
@@ -243,45 +252,4 @@ O = {
   },
 }
 
--- TODO find a new home for these autocommands
-require("lv-utils").define_augroups {
-  _general_settings = {
-    {
-      "TextYankPost",
-      "*",
-      "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
-    },
-    {
-      "BufWinEnter",
-      "*",
-      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
-    },
-    {
-      "BufRead",
-      "*",
-      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
-    },
-    {
-      "BufNewFile",
-      "*",
-      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
-    },
-    { "VimLeavePre", "*", "set title set titleold=" },
-    { "FileType", "qf", "set nobuflisted" },
-  },
-  -- _solidity = {
-  --     {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
-  --     {'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
-  -- },
-  -- _gemini = {
-  --     {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
-  --     {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
-  -- },
-  _markdown = {
-    { "FileType", "markdown", "setlocal wrap" },
-    { "FileType", "markdown", "setlocal spell" },
-  },
-  _buffer_bindings = {
-    { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" },
-  },
-}
+

+ 14 - 2
lua/lsp/init.lua

@@ -22,8 +22,8 @@ vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
 vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
 vim.cmd("nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>")
 -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
-vim.cmd("nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev()<CR>")
-vim.cmd("nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next()<CR>")
+vim.cmd("nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>")
+vim.cmd("nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>")
 -- scroll down hover doc or scroll in definition preview
 -- scroll up hover doc
 vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
@@ -41,6 +41,18 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
   }
 )
 
+vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
+  vim.lsp.handlers.hover, {
+    border = O.lsp.popup_border
+  }
+)
+
+vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
+  vim.lsp.handlers.signature_help, {
+    border = O.lsp.popup_border
+  }
+)
+
 -- symbols for autocomplete
 vim.lsp.protocol.CompletionItemKind = {
     "   (Text) ",

+ 1 - 1
lua/lv-compe/init.lua

@@ -90,7 +90,7 @@ M.config = function()
   vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
 
   vim.api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", { noremap = true, silent = true, expr = true })
-  vim.api.nvim_set_keymap("i", "<CR>", "compe#confirm('<CR>')", { noremap = true, silent = true, expr = true })
+  -- vim.api.nvim_set_keymap("i", "<CR>", "compe#confirm('<CR>')", { noremap = true, silent = true, expr = true })
   vim.api.nvim_set_keymap("i", "<C-e>", "compe#close('<C-e>')", { noremap = true, silent = true, expr = true })
   vim.api.nvim_set_keymap("i", "<C-f>", "compe#scroll({ 'delta': +4 })", { noremap = true, silent = true, expr = true })
   vim.api.nvim_set_keymap("i", "<C-d>", "compe#scroll({ 'delta': -4 })", { noremap = true, silent = true, expr = true })

+ 8 - 0
lua/lv-dial/init.lua

@@ -17,6 +17,14 @@ vmap g<C-x> <Plug>(dial-decrement-additional)
     strlist = { "true", "false" },
   }
   table.insert(dial.config.searchlist.normal, "custom#boolean")
+
+  -- For Languages which prefer True/False, e.g. python.
+  dial.augends["custom#Boolean"] = dial.common.enum_cyclic {
+    name = "Boolean",
+    strlist = { "True", "False" },
+  }
+  table.insert(dial.config.searchlist.normal, "custom#Boolean")
+
 end
 
 return M

+ 1 - 1
lua/lv-galaxyline/init.lua

@@ -104,7 +104,7 @@ table.insert(gls.left, {
       vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()])
       return "▊"
     end,
-    -- highlight = 'TabLineSel'
+    highlight = 'StatusLineNC'
     -- highlight = {colors.red, colors.bg}
   },
 })

+ 56 - 0
lua/lv-utils/init.lua

@@ -22,4 +22,60 @@ function lv_utils.define_augroups(definitions) -- {{{1
   end
 end
 
+lv_utils.define_augroups {
+
+    _user_autocommands = O.user_autocommands,
+  _general_settings = {
+    {
+      "TextYankPost",
+      "*",
+      "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
+    },
+    {
+      "BufWinEnter",
+      "*",
+      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+    },
+    {
+      "BufRead",
+      "*",
+      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+    },
+    {
+      "BufNewFile",
+      "*",
+      "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+    },
+    { "VimLeavePre", "*", "set title set titleold=" },
+  },
+  -- _solidity = {
+  --     {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
+  --     {'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
+  -- },
+  -- _gemini = {
+  --     {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
+  --     {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
+  -- },
+  _markdown = {
+    { "FileType", "markdown", "setlocal wrap" },
+    { "FileType", "markdown", "setlocal spell" },
+  },
+  _buffer_bindings = {
+    { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" },
+  },
+  _auto_resize = {
+    -- will cause split windows to be resized evenly if main window is resized
+    {'VimResized ', '*', 'wincmd ='},
+  },
+  -- _mode_switching = {
+  --   -- will switch between absolute and relative line numbers depending on mode
+  --   {'InsertEnter', '*', 'if &relativenumber | let g:ms_relativenumberoff = 1 | setlocal number norelativenumber | endif'},
+  --   {'InsertLeave', '*', 'if exists("g:ms_relativenumberoff") | setlocal relativenumber | endif'},
+  --   {'InsertEnter', '*', 'if &cursorline | let g:ms_cursorlineoff = 1 | setlocal nocursorline | endif'},
+  --   {'InsertLeave', '*', 'if exists("g:ms_cursorlineoff") | setlocal cursorline | endif'},
+  -- },
+}
+
 return lv_utils
+
+-- TODO find a new home for these autocommands

+ 10 - 3
lua/lv-which-key/init.lua

@@ -121,7 +121,14 @@ local mappings = {
       "sort BufferLines automatically by language",
     },
   },
-
+    p = {
+        name = "Packer",
+        c = {"<cmd>PackerCompile<cr>", "Compile"},
+        i = {"<cmd>PackerInstall<cr>", "Install"},
+        r = {":luafile %<cr>", "Reload"},
+        s = {"<cmd>PackerSync<cr>", "Sync"},
+        u = {"<cmd>PackerUpdate<cr>", "Update"}
+    },
   -- diagnostics vanilla nvim
   -- -- diagnostic
   -- function lv_utils.get_all()
@@ -200,8 +207,8 @@ local mappings = {
     },
     f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },
     i = { "<cmd>LspInfo<cr>", "Info" },
-    j = { "<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", "Next Diagnostic" },
-    k = { "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "Prev Diagnostic" },
+    j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" },
+    k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" },
     q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
     r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
     s = {

+ 1 - 1
lua/plugins.lua

@@ -254,7 +254,7 @@ return require("packer").startup(function(use)
     "mfussenegger/nvim-dap",
     config = function()
         require('dap')
-        vim.fn.sign_define('DapBreakpoint', {text='🛑', texthl='', linehl='', numhl=''})
+        vim.fn.sign_define('DapBreakpoint', {text='', texthl='LspDiagnosticsSignError', linehl='', numhl=''})
         require('dap').defaults.fallback.terminal_win_cmd = '50vsplit new'
     end,
     disable = not O.plugin.debug.active,

+ 1 - 0
lua/settings.lua

@@ -12,6 +12,7 @@ cmd "set iskeyword+=-"
 cmd "set whichwrap+=<,>,[,],h,l"
 if O.transparent_window then
   cmd "au ColorScheme * hi Normal ctermbg=none guibg=none"
+  cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none"
 end
 
 --- COLORSCHEME ---

+ 2 - 0
utils/installer/lv-config.example.lua

@@ -97,6 +97,8 @@ O.lang.php.filetypes = { "php", "phtml" }
 
 -- TODO Autocommands
 -- https://neovim.io/doc/user/autocmd.html
+-- local test = { "BufWinEnter", "*", "echo \"hi again\""}
+-- table.insert(O.user_autocommands, test)
 
 -- TODO Additional Plugins