nvim: nasty, mid-rewrite update

This commit is contained in:
2023-01-14 12:02:08 +02:00
parent 8922dc3d2e
commit 570d058394
12 changed files with 584 additions and 335 deletions

View File

@@ -55,7 +55,7 @@ cmp.setup({
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['solargraph'].setup({ capabilities = capabilities })
-- require('lspconfig')['solargraph'].setup({ capabilities = capabilities })
-- require("luasnip.loaders.from_lua").lazy_load()

View File

@@ -1,84 +0,0 @@
local g = vim.g -- a table to access global variables
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
end
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use 'shaunsingh/nord.nvim'
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use 'tpope/vim-surround'
use { 'junegunn/fzf', run = 'cd ~/.fzf && ./install --all' }
use 'junegunn/fzf.vim'
use 'junegunn/vim-easy-align'
use 'christoomey/vim-tmux-navigator'
use 'airblade/vim-gitgutter'
use 'tpope/vim-repeat'
use 'nvim-tree/nvim-tree.lua'
use 'numtostr/comment.nvim'
use 'ellisonleao/glow.nvim'
-- Snippets
use 'L3MON4D3/LuaSnip'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'saadparwaiz1/cmp_luasnip'
use "rafamadriz/friendly-snippets"
use 'neovim/nvim-lspconfig'
-- tpope
use 'tpope/vim-fugitive'
use 'tpope/vim-rails'
use 'tpope/vim-rhubarb'
-- tests
use 'vim-test/vim-test'
use 'benmills/vimux'
use 'dyng/ctrlsf.vim'
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable "make" == 1 }
use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } }
use "williamboman/mason.nvim"
use "WhoIsSethDaniel/mason-tool-installer.nvim"
use "jose-elias-alvarez/null-ls.nvim"
use({
"williamboman/mason-lspconfig.nvim",
requires = {
"neovim/nvim-lspconfig",
}
})
use 'AndrewRadev/splitjoin.vim'
end)
require 'plugins/treesitter'
require 'plugins/gitgutter'
require 'plugins/lsp'
require 'plugins/cmp'
require 'plugins/nord'
require 'plugins/nvim-tree'
require 'plugins/comment'
require 'plugins/mason'
require 'plugins/null-ls'
require 'plugins/telescope'
-- vim-test
g['test#strategy'] = 'vimux'
-- CtrlSF
g.ctrlsf_ackprg = 'rg'
g.ctrlsf_regex_pattern = 1
g.ctrlsf_case_sensitive = 'smart'
g.ctrlsf_default_root = 'project'
g.ctrlsf_context = '-B 1 -A 1'
g.ctrlsf_position = 'bottom'
g.ctrlsf_winsize = '40%'
g.ctrlsf_mapping = {
next = 'n',
prev = 'N',
}

View File

@@ -1,47 +1,111 @@
require("mason-lspconfig").setup()
local lspconfig = require('lspconfig')
lspconfig.ansiblels.setup({})
lspconfig.bashls.setup({})
lspconfig.dockerls.setup({})
lspconfig.gopls.setup({})
lspconfig.jsonls.setup({})
lspconfig.solargraph.setup({})
lspconfig.marksman.setup({})
lspconfig.terraformls.setup({})
lspconfig.vimls.setup({})
lspconfig.pylsp.setup({})
lspconfig.yamlls.setup({})
-- local M = {}
--
-- function M.config()
-- local lspconfig = require('lspconfig')
--
-- lspconfig.ansiblels.setup({})
-- lspconfig.bashls.setup({})
-- lspconfig.dockerls.setup({})
-- lspconfig.gopls.setup({})
-- lspconfig.jsonls.setup({})
-- lspconfig.solargraph.setup({})
--
-- -- local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- -- require('lspconfig')['solargraph'].setup({ capabilities = capabilities })
--
-- lspconfig.marksman.setup({})
-- lspconfig.terraformls.setup({})
-- lspconfig.vimls.setup({})
-- lspconfig.pylsp.setup({})
-- lspconfig.yamlls.setup({
-- settings = {
-- yaml = {
-- format = {
-- enable = true,
-- singleQuote = true
-- }
-- }
-- }
-- })
--
-- require("mason").setup({})
-- require("mason-lspconfig").setup()
-- require("mason-tool-installer").setup({
-- -- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
-- ensure_installed = { "bash-language-server", "black", "dockerfile-language-server",
-- "isort", "json-lsp", "jsonlint", "lua-language-server", "marksman", "prettierd",
-- "python-lsp-server", "rubocop", "shfmt", "solargraph", "terraform-ls",
-- "vim-language-server", "yaml-language-server",
-- },
-- auto_update = true,
-- run_on_start = true
-- })
--
-- -- Provide settings that should only apply to the "sumneko_lua" server
-- local lua_runtime_path = vim.split(package.path, ';')
-- table.insert(lua_runtime_path, "lua/?.lua")
-- table.insert(lua_runtime_path, "lua/?/init.lua")
-- table.insert(lua_runtime_path, vim.fn.stdpath('config') .. "lua/?.lua")
--
-- lspconfig.sumneko_lua.setup({
-- settings = {
-- Lua = {
-- runtime = {
-- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
-- version = 'LuaJIT',
-- -- Setup your lua path
-- path = lua_runtime_path,
-- },
-- format = {
-- enable = true,
-- defaultConfig = {
-- keep_one_space_between_table_and_bracket = "false",
-- }
-- },
-- diagnostics = {
-- -- Get the language server to recognize the `vim` global
-- globals = {'vim'},
-- ["codestyle-check"] = "Any",
-- },
-- -- Do not send telemetry data containing a randomized but unique identifier
-- telemetry = {
-- enable = false,
-- },
-- },
-- }
-- })
-- end
-- Provide settings that should only apply to the "sumneko_lua" server
local lua_runtime_path = vim.split(package.path, ';')
table.insert(lua_runtime_path, "lua/?.lua")
table.insert(lua_runtime_path, "lua/?/init.lua")
table.insert(lua_runtime_path, vim.fn.stdpath('config') .. "lua/?.lua")
lspconfig.sumneko_lua.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = lua_runtime_path,
},
format = {
enable = true,
defaultConfig = {
keep_one_space_between_table_and_bracket = "false",
}
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
["codestyle-check"] = "Any",
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
local lsp = require('lsp-zero')
-- lsp.preset('recommended')
lsp.set_preferences({
suggest_lsp_servers = true,
setup_servers_on_start = true,
set_lsp_keymaps = true,
configure_diagnostics = true,
cmp_capabilities = true,
manage_nvim_cmp = true,
call_servers = 'local',
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
lsp.setup()
-- should be after setup
vim.diagnostic.config({
virtual_text = true,
signs = true,
update_in_insert = false,
underline = true,
severity_sort = false,
float = true,
})

View File

@@ -1,11 +1,11 @@
require("mason").setup({})
require("mason-tool-installer").setup({
-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
ensure_installed = { "bash-language-server", "black", "dockerfile-language-server",
"isort", "json-lsp", "jsonlint", "lua-language-server", "marksman", "prettierd",
"python-lsp-server", "rubocop", "shfmt", "solargraph", "terraform-ls",
"vim-language-server", "yaml-language-server",
},
auto_update = true,
run_on_start = true
})
-- require("mason").setup({})
-- require("mason-tool-installer").setup({
-- -- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
-- ensure_installed = { "bash-language-server", "black", "dockerfile-language-server",
-- "isort", "json-lsp", "jsonlint", "lua-language-server", "marksman", "prettierd",
-- "python-lsp-server", "rubocop", "shfmt", "solargraph", "terraform-ls",
-- "vim-language-server", "yaml-language-server",
-- },
-- auto_update = true,
-- run_on_start = true
-- })

View File

@@ -1,30 +1,37 @@
-- https://github.com/shaunsingh/nord.nvim#%EF%B8%8F-configuration
local M = {}
-- Make sidebars and popup menus like nvim-tree and telescope
-- have a different background
vim.g.nord_contrast = true
function M.setup()
-- https://github.com/shaunsingh/nord.nvim#%EF%B8%8F-configuration
-- Enable the border between verticaly split windows visable
vim.g.nord_borders = true
-- Make sidebars and popup menus like nvim-tree and telescope
-- have a different background
vim.g.nord_contrast = true
-- Disable the setting of background color so that NeoVim
-- can use your terminal background
vim.g.nord_disable_background = false
-- Enable the border between verticaly split windows visable
vim.g.nord_borders = true
-- Set the cursorline transparent/visible
vim.g.nord_cursorline_transparent = false
-- Disable the setting of background color so that NeoVim
-- can use your terminal background
vim.g.nord_disable_background = false
-- Re-enables the background of the sidebar if you disabled the background of everything
vim.g.nord_enable_sidebar_background = false
-- Set the cursorline transparent/visible
vim.g.nord_cursorline_transparent = false
-- Enables/disables italics
vim.g.nord_italic = true
-- Re-enables the background of the sidebar if you disabled the background of everything
vim.g.nord_enable_sidebar_background = false
-- Enables/disables colorful backgrounds when used in diff mode
vim.g.nord_uniform_diff_background = true
-- Enables/disables italics
vim.g.nord_italic = true
-- Enables/disables bold
vim.g.nord_bold = false
-- Enables/disables colorful backgrounds when used in diff mode
vim.g.nord_uniform_diff_background = true
-- Load the colorscheme
require('nord').set()
-- Enables/disables bold
vim.g.nord_bold = false
end
function M.config()
require('nord').set()
end
return M

View File

@@ -1,2 +1,54 @@
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
local M = {}
function M.setup()
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
-- require('telescope.builtin').find_files({ hidden = true })
end
function M.config()
local telescope = require 'telescope'
telescope.setup {
defaults = {
layout_strategy = 'vertical',
winblend = 7,
set_env = { COLORTERM = 'truecolor' },
color_devicons = true,
scroll_strategy = 'limit',
},
pickers = {
live_grep = {
only_sort_text = true,
path_display = { 'shorten' },
layout_strategy = 'horizontal',
layout_config = { preview_width = 0.4 },
},
git_files = {
path_display = {},
hidden = true,
show_untracked = true,
layout_strategy = 'horizontal',
layout_config = { preview_width = 0.65 },
},
},
extensions = {
fzf = {
override_generic_sorter = true,
override_file_sorter = true,
case_mode = 'smart_case',
},
},
}
-- pcall(require('telescope').load_extension, 'fzf')
-- Enable telescope fzf native, if installed
telescope.load_extension('fzf')
end
-- Telescope
-- TODO: change to Telescope
-- nmap('<leader>ft', ':Files ~/Tmp<CR>')
-- nmap('<leader>fo', ":call fzf#run(fzf#wrap(fzf#vim#with_preview({ 'source': 'fd . --type f --extension=md --follow --exclude .git ~/Syncthing/Obsidian/Personal' })))<CR>", { silent = true })
return M

View File

@@ -1,27 +1,32 @@
-- Tree-sitter
require('nvim-treesitter.configs').setup {
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
-- ignore_install = { 'norg' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
disable = { "html" },
extended_mode = false,
max_file_lines = nil,
},
indent = { enable = false },
autopairs = { enable = true },
autotag = { enable = true },
incremental_selection = { enable = true },
}
local M = {}
function M.config()
require('nvim-treesitter.configs').setup {
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
-- ignore_install = { 'norg' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
disable = { "html" },
extended_mode = false,
max_file_lines = nil,
},
indent = { enable = false },
autopairs = { enable = true },
autotag = { enable = true },
incremental_selection = { enable = true },
}
end
return M