continueing to setup nvim properly, struggling with LSP and christian chiarullis LSP setup, thinking it might be better to build from scratch?

This commit is contained in:
Solomon Laing 2022-08-19 21:43:08 +09:30
parent 59a3d274c7
commit cfe7491b56
13 changed files with 116 additions and 261 deletions

View File

@ -1,42 +1,44 @@
require("user.options")
require("user.keymaps")
require("user.plugins")
require("user.colorscheme")
require("user.lsp")
require("user.lsp-inlayhints")
require("user.autocommands")
require("user.cmp")
require("user.navic")
require("user.lsp-inlayhints")
require("user.lsp")
require("user.telescope")
require("user.treesitter")
require("user.autopairs")
require("user.comment")
require("user.gitsigns")
require("user.nvim-tree")
require("user.bufferline")
require("user.toggleterm")
require("user.project")
require("user.impatient")
require("user.indentline")
require("user.alpha")
require("user.whichkey")
require("user.hop")
-- require "user.hop"
require("user.matchup")
require("user.numb")
-- require "user.numb"
require("user.colorizer")
require("user.spectre")
-- require "user.spectre"
require("user.zen-mode")
require("user.neoscroll")
require("user.todo-comments")
require("user.symbol-outline")
require("user.notify")
require("user.ts-context")
require("user.copilot")
require("user.functions")
require("user.illuminate")
require("user.dap")
require("user.lir")
require "user.winbar"
require("user.options")
-- require "user.lir"
require("user.winbar")
require("user.nvim-webdev-icons")
require("user.fidget")
-- require "user.fidget"
require("user.browse")
require("user.surround")
require("user.harpoon")

View File

@ -72,97 +72,4 @@ bufferline.setup {
-- return buffer_a.modified > buffer_b.modified
-- end
},
highlights = {
fill = {
guifg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
background = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
-- buffer_selected = {
-- guifg = {attribute='fg',highlight='#ff0000'},
-- guibg = {attribute='bg',highlight='#0000ff'},
-- gui = 'none'
-- },
buffer_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
close_button = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
close_button_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
-- close_button_selected = {
-- guifg = {attribute='fg',highlight='TabLineSel'},
-- guibg ={attribute='bg',highlight='TabLineSel'}
-- },
tab_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
tab = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
tab_close = {
-- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "Normal" },
},
duplicate_selected = {
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "TabLineSel" },
gui = "italic",
},
duplicate_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
},
duplicate = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
},
modified = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
modified_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
modified_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
separator = {
guifg = { attribute = "bg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
-- separator_visible = {
-- guifg = {attribute='bg',highlight='TabLine'},
-- guibg = {attribute='bg',highlight='TabLine'}
-- },
indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" },
},
},
}

View File

@ -8,11 +8,6 @@ if not snip_status_ok then
return
end
local tabnine_status_ok, _ = pcall(require, "user.tabnine")
if not tabnine_status_ok then
return
end
local buffer_fts = {
"markdown",
"toml",
@ -211,7 +206,6 @@ cmp.setup {
end
end,
},
{ name = "cmp_tabnine", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = "emoji", group_index = 2 },
{ name = "lab.quick_data", keyword_length = 4, group_index = 2 },

View File

@ -3,41 +3,4 @@ if not status_ok then
return
end
local status_ok_1, _ = pcall(require, "lsp-inlayhints")
if not status_ok_1 then
return
end
comment.setup {
pre_hook = function(ctx)
-- For inlay hints
local line_start = (ctx.srow or ctx.range.srow) - 1
local line_end = ctx.erow or ctx.range.erow
require("lsp-inlayhints.core").clear(0, line_start, line_end)
if
vim.bo.filetype == "typescriptreact"
or vim.bo.filetype == "javascriptreact"
or vim.bo.filetype == "javascript"
or vim.bo.filetype == "typescript"
then
local U = require "Comment.utils"
-- Determine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.linewise and "__default" or "__multiline"
-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.blockwise then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
key = type,
location = location,
}
end
end,
}
comment.setup {}

View File

@ -0,0 +1,35 @@
-- For copilot.vim
-- vim.g.copilot_filetypes = {
-- ["*"] = false,
-- }
-- vim.cmd [[
-- imap <silent><script><expr> <C-A> copilot#Accept("\<CR>")
-- let g:copilot_no_tab_map = v:true
-- ]]
local status_ok, copilot = pcall(require, "copilot")
if not status_ok then
return
end
copilot.setup {
cmp = {
enabled = true,
method = "getCompletionsCycling",
},
panel = { -- no config options yet
enabled = true,
},
ft_disable = { "markdown" },
-- plugin_manager_path = vim.fn.stdpath "data" .. "/site/pack/packer",
server_opts_overrides = {
-- trace = "verbose",
settings = {
advanced = {
-- listCount = 10, -- #completions for panel
inlineSuggestCount = 3, -- #completions for getCompletions
},
},
},
}

View File

@ -5,9 +5,9 @@ local term_opts = { silent = true }
local keymap = vim.api.nvim_set_keymap
--Remap space as leader key
keymap('n', '<Space>', '', opts)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
keymap("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Modes
-- normal_mode = 'n',
@ -17,81 +17,73 @@ vim.g.maplocalleader = ' '
-- term_mode = 't',
-- command_mode = 'c',
keymap('n', 'c', '"_c', opts)
keymap("n", "c", '"_c', opts)
-- Normal --
-- Better window navigation
keymap('n', '<C-h>', '<C-w>h', opts)
keymap('n', '<C-j>', '<C-w>j', opts)
keymap('n', '<C-k>', '<C-w>k', opts)
keymap('n', '<C-l>', '<C-w>l', opts)
-- Resize with arrows
keymap('n', '<C-Up>', ':resize -2<CR>', opts)
keymap('n', '<C-Down>', ':resize +2<CR>', opts)
keymap('n', '<C-Left>', ':vertical resize -2<CR>', opts)
keymap('n', '<C-Right>', ':vertical resize +2<CR>', opts)
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
-- Naviagate buffers
keymap('n', '<S-l>', ':bnext<CR>', opts)
keymap('n', '<S-h>', ':bprevious<CR>', opts)
keymap("n", "<S-l>", ":BufferLineCycleNext<CR>", opts)
keymap("n", "<S-h>", ":BufferLineCyclePrev<CR>", opts)
-- Move text up and down
keymap('n', '<A-j>', '<Esc>:m .+1<CR>==gi', opts)
keymap('n', '<A-k>', '<Esc>:m .-2<CR>==gi', opts)
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
-- Insert --
-- Press jk fast to enter
keymap('i', 'jk', '<ESC>', opts)
keymap("i", "jk", "<ESC>", opts)
-- Visual --
-- Stay in indent mode
keymap('v', '<', '<gv', opts)
keymap('v', '>', '>gv', opts)
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)
-- Move text up and down
keymap('v', '<A-j>', ':m .+1<CR>==', opts)
keymap('v', '<A-k>', ':m .-2<CR>==', opts)
keymap('v', 'p', '"_dP', opts)
keymap('v', 'P', '"_dP', opts)
-- Visual Block --
-- Move text up and down
keymap('x', 'J', ':move ">+1<CR>gv-gv', opts)
keymap('x', 'K', ':move "<-2<CR>gv-gv', opts)
keymap('x', '<A-j>', ':move ">+1<CR>gv-gv', opts)
keymap('x', '<A-k>', ':move "<-2<CR>gv-gv', opts)
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
keymap("v", "p", '"_dP', opts)
keymap("v", "P", '"_dP', opts)
-- My bit's an pieces currently unsorted
-- Spellcheck
keymap('n', '<leader>o', ':setlocal spell! spelllang=en_us<CR>', opts)
keymap("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", opts)
-- Tree
keymap('n', '<leader>n', ':NvimTreeToggle<CR>', opts)
keymap("n", "<leader>n", ":NvimTreeToggle<CR>", opts)
-- Telescope
keymap("n", "<leader>ff", ":Telescope find_files<CR>", opts)
keymap("n", "<leader>ft", ":Telescope live_grep<CR>", opts)
keymap("n", "<leader>fp", ":Telescope projects<CR>", opts)
keymap("n", "<leader>fb", ":Telescope buffers<CR>", opts)
-- Goyo
keymap('n', '<leader>f', ':Goyo<CR>', opts)
keymap("n", "<leader>f", ":Goyo<CR>", opts)
-- Copy and Paste
keymap('n', '<C-c>', '"+y', opts)
keymap('n', '<C-p', '"+p', opts)
keymap("n", "<C-c>", '"+y', opts)
keymap("n", "<C-p", '"+p', opts)
-- Replace All is S
vim.cmd [[nnoremap S :%s//g<Left><Left>]]
vim.cmd([[nnoremap S :%s//g<Left><Left>]])
-- keymap('n', '<S-s>', ':%s//g<Left><Left>', opts)
-- Compile the document with default compiler script
vim.cmd [[map <leader>c :w! \| !compiler "<c-r>%"<CR>]]
vim.cmd([[map <leader>c :w! \| !compiler "<c-r>%"<CR>]])
-- keymap('n', '<leader>c', ':w! | !compiler <c-r>%<CR>', opts)
-- Open compiled document
keymap('n', '<leader>p', ':!opout <c-r>%<CR><CR>', opts)
keymap("n", "<leader>p", ":!opout <c-r>%<CR><CR>", opts)
-- Attempt sudo for files that require it
keymap('n', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!', opts)
keymap("n", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!', opts)
keymap("n", "<F11>", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
keymap("n", "<F12>", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap("n", "fr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
keymap("n", "K", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
keymap("n", "<C-z>", "<cmd>ZenMode<cr>", opts)

View File

@ -28,7 +28,8 @@ local servers = {
"rust_analyzer",
"taplo",
"zk@v0.10.1",
"lemminx"
"lemminx",
"clangd"
}
local settings = {
@ -111,6 +112,11 @@ for _, server in pairs(servers) do
opts = vim.tbl_deep_extend("force", solc_opts, opts)
end
if server == "clangd" then
local clangd_opts = require "user.lsp.settings.clangd"
opts = vim.tbl_deep_extend("force", clangd_opts, opts)
end
if server == "emmet_ls" then
local emmet_ls_opts = require "user.lsp.settings.emmet_ls"
opts = vim.tbl_deep_extend("force", emmet_ls_opts, opts)

View File

@ -0,0 +1,3 @@
return {
cmd = { "clangd" }
}

View File

@ -19,7 +19,7 @@ notify.setup {
render = "default",
-- Default timeout for notifications
timeout = 175,
timeout = 5000,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group or an RGB hex value e.g. "#000000"

View File

@ -54,14 +54,29 @@ return packer.startup(function(use)
-- LSP
use "neovim/nvim-lspconfig" -- enable LSP
use "williamboman/nvim-lsp-installer" -- simple to use language server installer
-- use "williamboman/nvim-lsp-installer" -- simple to use language server installer
use "williamboman/mason.nvim"
use "williamboman/mason-lspconfig.nvim"
use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters
use "ray-x/lsp_signature.nvim"
use "SmiteshP/nvim-navic"
use "simrat39/symbols-outline.nvim"
use "b0o/SchemaStore.nvim"
-- use "github/copilot.vim"
use {
"zbirenbaum/copilot.lua",
event = { "VimEnter" },
config = function()
vim.defer_fn(function()
require "user.copilot"
end, 100)
end,
}
use "RRethy/vim-illuminate"
use "j-hui/fidget.nvim"
use "lvimuser/lsp-inlayhints.nvim"
-- use "simrat39/inlay-hints.nvim"
use "https://git.sr.ht/~whynothugo/lsp_lines.nvim"
-- Completion
use "hrsh7th/nvim-cmp"
@ -121,6 +136,7 @@ return packer.startup(function(use)
-- Tabline
use "akinsho/bufferline.nvim"
use "tiagovla/scope.nvim"
use "fgheng/winbar.nvim"
-- Statusline
use "christianchiarulli/lualine.nvim"
@ -165,13 +181,12 @@ return packer.startup(function(use)
use "nacro90/numb.nvim"
use "andymass/vim-matchup"
use "folke/zen-mode.nvim"
use "fgheng/winbar.nvim"
use "karb94/neoscroll.nvim"
use "junegunn/vim-slash"
use 'vimwiki/vimwiki'
-- Motion
use "phaazon/hop.nvim"
-- use "phaazon/hop.nvim"
-- Keybinding
use "folke/which-key.nvim"

View File

@ -4,15 +4,15 @@ if not status_ok then
end
local actions = require "telescope.actions"
telescope.load_extension "media_files"
local icons = require "user.icons"
telescope.setup {
defaults = {
prompt_prefix = icons.ui.Telescope .. " ",
prompt_prefix = icons.ui.Telescope .. "",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = {
".git/",
"target/",
@ -23,9 +23,6 @@ telescope.setup {
"%.sqlite3",
"%.ipynb",
"node_modules/*",
-- "%.jpg",
-- "%.jpeg",
-- "%.png",
"%.svg",
"%.otf",
"%.ttf",
@ -146,62 +143,4 @@ telescope.setup {
},
},
},
pickers = {
live_grep = {
theme = "dropdown",
},
grep_string = {
theme = "dropdown",
},
find_files = {
theme = "dropdown",
previewer = false,
},
buffers = {
theme = "dropdown",
previewer = false,
initial_mode = "normal",
},
planets = {
show_pluto = true,
show_moon = true,
},
colorscheme = {
-- enable_preview = true,
},
lsp_references = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_definitions = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_declarations = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_implementations = {
theme = "dropdown",
initial_mode = "normal",
},
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
},
}

View File

@ -95,7 +95,6 @@ local m_mappings = {
m = { '<cmd>lua require("harpoon.mark").add_file()<cr>', "Harpoon" },
["."] = { '<cmd>lua require("harpoon.ui").nav_next()<cr>', "Harpoon Next" },
[","] = { '<cmd>lua require("harpoon.ui").nav_prev()<cr>', "Harpoon Prev" },
l = { "<cmd>lua require('user.bfs').open()<cr>", "Buffers" },
j = { "<cmd>silent BookmarkNext<cr>", "Next" },
s = { "<cmd>Telescope harpoon marks<cr>", "Search Files" },
k = { "<cmd>silent BookmarkPrev<cr>", "Prev" },

View File

@ -71,7 +71,7 @@ import XMonad.Util.SpawnOnce
-- A simple way to switch between desktop and laptop related things
-- Don't forget this exists, I have previously confused myself by doing so.
isLaptop :: Bool
isLaptop = True
isLaptop = False
--THEME