From c94c895ad7aeabd2bca0659d19f55a795f832a06 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 30 Sep 2023 04:07:51 -0400 Subject: [PATCH] feat(nvim): combine lua files and change a buncha stuff --- config/nvim/base.vim | 2 +- config/nvim/config.lua | 90 ++++++++++++++++++++++++++++++++++++++++++ config/nvim/lsp.lua | 82 -------------------------------------- nixos/home/nvim.nix | 14 ++++--- 4 files changed, 99 insertions(+), 89 deletions(-) delete mode 100644 config/nvim/lsp.lua diff --git a/config/nvim/base.vim b/config/nvim/base.vim index 17e56903..a87df0a6 100644 --- a/config/nvim/base.vim +++ b/config/nvim/base.vim @@ -32,7 +32,7 @@ autocmd FileType scss setl iskeyword+=@-@ nnoremap :noh -let g:minimap_width = 10 +let g:minimap_width = 6 let g:minimap_auto_start = 1 let g:minimap_auto_start_win_enter = 1 let g:minimap_git_colors = 1 diff --git a/config/nvim/config.lua b/config/nvim/config.lua index d8a7ee5b..d0dbb105 100644 --- a/config/nvim/config.lua +++ b/config/nvim/config.lua @@ -7,3 +7,93 @@ vim.g.loaded_netrw = 0 vim.g.loaded_netrwPlugin = 0 -- https://github.com/nvim-neo-tree/neo-tree.nvim/issues/983#issuecomment-1637372234 + + +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} + +require('gitsigns').setup() +require('lualine').setup { + options = { + theme = 'dracula', + globalstatus = true + } +} +require("neo-tree").setup({ + close_if_last_window = true, + enable_refresh_on_write = true, + window = { + width = 25, + }, + filesystem = { + use_libuv_file_watcher = true, + filtered_items = { + visible = false, + hide_dotfiles = false, + hide_gitignored = true, + hide_by_name = {}, + hide_by_pattern = {}, + always_show = {}, + never_show = {}, + never_show_by_pattern = {}, + }, + }, + source_selector = { + winbar = true, + statusline = false + }, + follow_current_file = { + enabled = true, + leave_dirs_open = true, + } +}) +require('todo-comments').setup() + +-- Auto indent when pressing Enter between brackets +local remap = vim.api.nvim_set_keymap +local npairs = require('nvim-autopairs') +npairs.setup({map_cr=false}) + +_G.MUtils= {} + +MUtils.completion_confirm=function() + if vim.fn["coc#pum#visible"]() ~= 0 then + return vim.fn["coc#pum#confirm"]() + else + return npairs.autopairs_cr() + end +end + +remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) + +-- Indent Blanklines +local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowOrange", + "RainbowGreen", + "RainbowViolet", + "RainbowCyan", +} + +local hooks = require "ibl.hooks" +hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) +end) + +require("ibl").setup { indent = { highlight = highlight } } diff --git a/config/nvim/lsp.lua b/config/nvim/lsp.lua deleted file mode 100644 index 665e92d4..00000000 --- a/config/nvim/lsp.lua +++ /dev/null @@ -1,82 +0,0 @@ -require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} - -require('gitsigns').setup() -require('lualine').setup { - options = { - theme = 'dracula', - globalstatus = true - } -} -require("neo-tree").setup({ - close_if_last_window = true, - window = { - width = 30, - }, - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = false, - hide_gitignored = true, - hide_by_name = {}, - hide_by_pattern = {}, - always_show = {}, - never_show = {}, - never_show_by_pattern = {}, - }, - }, - follow_current_file = { - enabled = true, - leave_dirs_open = true, - } -}) -require('todo-comments').setup() - --- Auto indent when pressing Enter between brackets -local remap = vim.api.nvim_set_keymap -local npairs = require('nvim-autopairs') -npairs.setup({map_cr=false}) - -_G.MUtils= {} - -MUtils.completion_confirm=function() - if vim.fn["coc#pum#visible"]() ~= 0 then - return vim.fn["coc#pum#confirm"]() - else - return npairs.autopairs_cr() - end -end - -remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) - --- Indent Blanklines -local highlight = { - "RainbowRed", - "RainbowYellow", - "RainbowBlue", - "RainbowOrange", - "RainbowGreen", - "RainbowViolet", - "RainbowCyan", -} - -local hooks = require "ibl.hooks" -hooks.register(hooks.type.HIGHLIGHT_SETUP, function() - vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) - vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) - vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) - vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) - vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) - vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) - vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) -end) - -require("ibl").setup { indent = { highlight = highlight } } diff --git a/nixos/home/nvim.nix b/nixos/home/nvim.nix index 9c713b02..9e134aaf 100644 --- a/nixos/home/nvim.nix +++ b/nixos/home/nvim.nix @@ -19,16 +19,11 @@ in enable = true; package = pkgs.neovim-nightly; - # read in the vim config from filesystem - # this enables syntaxhighlighting when editing those extraConfig = builtins.concatStringsSep "\n" [ (lib.strings.fileContents ../../config/nvim/base.vim) - # (lib.strings.fileContents ./.nvim/plugins.vim) - # (lib.strings.fileContents ./.nvim/lsp.vim) '' lua << EOF ${lib.strings.fileContents ../../config/nvim/config.lua} - ${lib.strings.fileContents ../../config/nvim/lsp.lua} EOF '' ]; @@ -54,7 +49,13 @@ in "--logpath" "~/.cache/sumneko_lua/log" ]; - "sumneko-lua.serverDir" = "${pkgs.lua-language-server}/share/lua-language-server"; + "Lua.workspace.library" = [ + "$\{3rd\}/luv/library" + ]; + sumneko-lua = { + serverDir = "${pkgs.lua-language-server}/share/lua-language-server"; + enableNvimLuaDev = true; + }; "java.jdt.ls.java.home" = "${pkgs.temurin-bin-17}"; "bashIde.shellcheckPath" = "${pkgs.shellcheck}/bin/shellcheck"; languageserver = { @@ -82,6 +83,7 @@ in coc-toml coc-markdownlint coc-tsserver + neodev-nvim coc-fzf fzfWrapper