some pretty decent changes to nvim

This commit is contained in:
Solomon Laing 2022-12-11 08:42:07 +10:30
parent fa7cf6ee09
commit 8ae4db0469
19 changed files with 48 additions and 440 deletions

View File

@ -1,42 +1,40 @@
require "user.impatient"
require "user.options"
require "user.keymaps"
require "user.plugins"
require "user.colorscheme"
require "user.lsp"
require "user.alpha"
require "user.autocmd"
require "user.autopairs"
require "user.cmp"
require "user.colorizer"
require "user.comment"
require "user.dressing"
require "user.dial"
-- require "user.fidget" -- replaced with noice
require "user.functions"
require "user.gitsigns"
require "user.harpoon"
require "user.indentline"
require "user.keymaps"
require "user.lualine"
require "user.navic"
require "user.notify"
require "user.numb"
require "user.nvim-tree"
require "user.symbols-outline"
require "user.telescope"
require "user.todo-comments"
require "user.toggleterm"
require "user.treesitter"
require "user.whichkey"
require "user.zen-mode"
require "user.spectre"
require "user.impatient" -- good leading
require "user.options" -- my options
require "user.keymaps" -- misc keymaps not part of whichkey
require "user.plugins" -- plugins configuration (packer)
require "user.colorscheme" -- my choice of colorscheme
require "user.lsp" -- lsp configuration
require "user.alpha" -- start/home page for nvim
require "user.autocmd" -- custom autocmds
require "user.autopairs" -- automatically add parirs for brackens quotes etc
require "user.cmp" -- completion configuration
require "user.colorizer" -- highlight colors hexcodes etc
require "user.comment" -- better commenting
require "user.dressing" -- better ui
require "user.dial" -- better incrementing/decrementing
require "user.fidget" -- display lsp server progress
require "user.functions" -- custom functions
require "user.gitsigns" -- gitsigns integration
require "user.harpoon" -- mark files in project and pull them too you
require "user.indentline" -- show indentation levels for code blocks
require "user.lualine" -- pretty and nice statusline plugin
require "user.navic" -- lsp integrated location in code finder/printer
require "user.notify" -- display notifications nicer
require "user.numb" -- peek before you move :10 etc.
require "user.nvim-tree" -- file tree, when needed.
require "user.symbols-outline" -- navigate code symbols
require "user.telescope" -- nice.
require "user.todo-comments" -- highlight TODO and other related comments
require "user.treesitter" -- magic
require "user.whichkey" -- keymaps
require "user.spectre" -- renaming but better
-- require "user.bufferline" -- replaced with cybu and bbye
-- disabled due to "Not enough room" issue see https://github.com/neovim/neovim/issues/19464
-- and potential conflict with noice, I added it same time as updating so maybe not.
require "user.winbar"
require "user.zk"
require "user.tabout"
require "user.cybu"
require "user.dap"
-- require "user.noice"
require "user.winbar" -- top bar
require "user.cybu" -- cycle through current buffers
require "user.dap" -- debugging
require "user.lspsaga" -- bit overkill, using for code action menu
-- require "user.noice" -- fun with new ui

View File

@ -45,20 +45,6 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, {
end,
})
-- vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
-- pattern = { "*" },
-- callback = function()
-- vim.cmd "checktime"
-- end,
-- })
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.ts" },
callback = function()
vim.lsp.buf.format { async = true }
end,
})
-- Prevent auto comment on next line
vim.cmd [[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]]

View File

@ -4,25 +4,8 @@ if not status_ok then
end
npairs.setup {
check_ts = true,
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character.
fast_wrap = {
map = "<C-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
}
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
@ -30,4 +13,5 @@ local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })

View File

@ -16,8 +16,6 @@ cybu.setup {
},
display_time = 1750, -- time the cybu window is displayed
style = {
path = "relative", -- absolute, relative, tail (filename only)
border = "rounded", -- single, double, rounded, none
separator = " ", -- string used as separator
prefix = "", -- string used as prefix for truncated paths
padding = 1, -- left & right padding in number of spaces

View File

@ -19,7 +19,6 @@ dressing.setup {
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
@ -31,11 +30,6 @@ dressing.setup {
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
@ -67,15 +61,11 @@ dressing.setup {
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 10,
},
max_width = 80,
max_height = 40,
min_width = 40,
@ -86,15 +76,9 @@ dressing.setup {
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"

View File

@ -23,8 +23,9 @@ map("n", "<C-s>", ":w<CR>", opts)
map("n", "<S-l>", ":CybuNext<CR>", opts)
map("n", "<S-h>", ":CybuPrev<CR>", opts)
-- Show definition
map("n", "<S-k>", ":lua vim.lsp.buf.hover()<CR>", opts)
-- center after up and down movements
map("n", "<C-u>", "<C-u>zz", opts)
map("n", "<C-d>", "<C-d>zz", opts)
-- INSERT
-- Easy exit insert mode

View File

@ -32,18 +32,6 @@ M.setup = function()
-- disable virtual text
virtual_lines = false,
virtual_text = false,
-- virtual_text = {
-- -- spacing = 7,
-- -- update_in_insert = false,
-- -- severity_sort = true,
-- -- prefix = "<-",
-- prefix = " ●",
-- source = "if_many", -- Or "always"
-- -- format = function(diag)
-- -- return diag.message .. "blah"
-- -- end,
-- },
-- show signs
signs = {
active = signs,
@ -54,28 +42,11 @@ M.setup = function()
float = {
focusable = true,
style = "minimal",
border = "rounded",
-- border = {"▄","▄","▄","█","▀","▀","▀","█"},
source = "if_many", -- Or "always"
header = "",
prefix = "",
-- width = 40,
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
-- width = 60,
-- height = 30,
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
-- width = 60,
-- height = 30,
})
end
local function attach_navic(client, bufnr)

View File

@ -13,13 +13,10 @@ local servers = {
"cssmodules_ls",
"emmet_ls",
"html",
"jdtls",
"solc",
"sumneko_lua",
"omnisharp",
"tflint",
"denols",
"terraformls",
"tsserver",
"pyright",
"yamlls",
@ -28,7 +25,6 @@ local servers = {
"clangd",
"rust_analyzer",
"taplo",
"zk@v0.10.1",
"lemminx",
"clangd",
}
@ -93,11 +89,6 @@ for _, server in pairs(servers) do
opts = vim.tbl_deep_extend("force", tsserver_opts, opts)
end
if server == "solc" then
local solc_opts = require("user.lsp.settings.solc")
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)
@ -108,15 +99,6 @@ for _, server in pairs(servers) do
opts = vim.tbl_deep_extend("force", emmet_ls_opts, opts)
end
if server == "zk" then
local zk_opts = require("user.lsp.settings.zk")
opts = vim.tbl_deep_extend("force", zk_opts, opts)
end
if server == "jdtls" then
goto continue
end
if server == "rust_analyzer" then
local rust_opts = require("user.lsp.settings.rust")
-- opts = vim.tbl_deep_extend("force", rust_opts, opts)

View File

@ -14,19 +14,12 @@ null_ls.setup({
formatting.prettier.with({
filetypes = {
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"css",
"scss",
"less",
"html",
"json",
"jsonc",
"yaml",
"graphql",
"handlebars",
},
}),
formatting.deno_fmt.with({

View File

@ -1,4 +0,0 @@
-- targets can be one of ewasm, generic, sabre, solana, substrate
return {
cmd = { "solang", "--language-server", "--target", "ewasm", "--importpath", "node_modules/" },
}

View File

@ -1,5 +0,0 @@
-- targets can be one of ewasm, generic, sabre, solana, substrate
return {
-- cmd = { "solc", "--lsp", "--import-path", "node_modules" },
cmd = { "solc", "--lsp", "--include-path", "../node_modules" },
}

View File

@ -1,5 +0,0 @@
local util = require "lspconfig.util"
return {
root_dir = util.root_pattern { ".git", ".zk" },
}

View File

@ -61,7 +61,6 @@ return packer.startup(function(use)
use("SmiteshP/nvim-navic") -- integrates with winbar to show location in program e.g.: MyClass > MyFunc > MyProperty
use("simrat39/symbols-outline.nvim") -- class explorer for nvim
use("folke/trouble.nvim") -- view lsp diagnostics
-- use "OmniSharp/omnisharp-vim"
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
use({ -- I'm currently just using this for a functional code action menu for omnisharp, I want to look further into its functions though.
"glepnir/lspsaga.nvim",
@ -73,14 +72,9 @@ return packer.startup(function(use)
use("hrsh7th/nvim-cmp") -- completion engine
use("hrsh7th/cmp-buffer") -- buffer completions
use("hrsh7th/cmp-path") -- path completions
use("saadparwaiz1/cmp_luasnip") -- snippet completions
use("hrsh7th/cmp-nvim-lsp") -- lsp completions
use("hrsh7th/cmp-nvim-lua")
use("saadparwaiz1/cmp_luasnip") -- snippet completions
-- LaTeX
-- use "SirVer/ultisnips"
-- use("lervag/vimtex")
-- use("ludovicchabant/vim-gutentags")
-- Snippet
use("L3MON4D3/LuaSnip") -- snippet engine
@ -97,9 +91,6 @@ return packer.startup(function(use)
use("nvim-telescope/telescope.nvim")
use("nvim-telescope/telescope-media-files.nvim")
-- Note Taking
use("mickael-menu/zk-nvim")
-- Colour
use("NvChad/nvim-colorizer.lua")
@ -145,9 +136,6 @@ return packer.startup(function(use)
use("numToStr/Comment.nvim")
use("folke/todo-comments.nvim")
-- Terminal
use("akinsho/toggleterm.nvim")
-- Git
use("lewis6991/gitsigns.nvim")
use("f-person/git-blame.nvim")

View File

@ -1,25 +0,0 @@
local status_ok, tabout = pcall(require, "tabout")
if not status_ok then
return
end
tabout.setup {
tabkey = "<tab>", -- key to trigger tabout, set to an empty string to disable
backwards_tabkey = "<s-tab>", -- key to trigger backwards tabout, set to an empty string to disable
act_as_tab = true, -- shift content if tab out is not possible
act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
default_tab = "<C-t>", -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
default_shift_tab = "<C-d>", -- reverse shift default action,
enable_backwards = false, -- well ...
completion = true, -- if the tabkey is used in a completion pum
tabouts = {
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = "`", close = "`" },
{ open = "(", close = ")" },
{ open = "[", close = "]" },
{ open = "{", close = "}" },
},
ignore_beginning = false, -- if the cursor is at the beginning of a filled element it will rather tab out than shift the content
exclude = { "markdown" }, -- tabout will ignore these filetypes
}

View File

@ -1,116 +0,0 @@
local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then
return
end
toggleterm.setup {
size = 20,
open_mapping = [[<C-0>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
}
local Terminal = require("toggleterm.terminal").Terminal
local htop = Terminal:new { cmd = "htop", hidden = true }
function _HTOP_TOGGLE()
htop:toggle()
end
local dotnet_run = Terminal:new { cmd = "dotnet run", hidden = false }
function _DOTNET_RUN_TOGGLE()
dotnet_run:toggle()
end
local float_term = Terminal:new {
direction = "float",
on_open = function(term)
vim.cmd "startinsert!"
vim.api.nvim_buf_set_keymap(
term.bufnr,
"n",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"t",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"i",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-2>", "<nop>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-3>", "<nop>", { noremap = true, silent = true })
end,
count = 1,
}
function _FLOAT_TERM()
float_term:toggle()
end
vim.api.nvim_set_keymap("n", "<m-1>", "<cmd>lua _FLOAT_TERM()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("i", "<m-1>", "<cmd>lua _FLOAT_TERM()<CR>", { noremap = true, silent = true })
local horizontal_term = Terminal:new {
direction = "horizontal",
on_open = function(term)
vim.cmd "startinsert!"
vim.api.nvim_buf_set_keymap(
term.bufnr,
"n",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"t",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"i",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-2>", "<nop>", { noremap = true, silent = true })
end,
count = 3,
}
function _HORIZONTAL_TERM()
horizontal_term:toggle(10)
end
vim.api.nvim_set_keymap("n", "<m-2>", "<cmd>lua _HORIZONTAL_TERM()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("i", "<m-2>", "<cmd>lua _HORIZONTAL_TERM()<CR>", { noremap = true, silent = true })

View File

@ -1,89 +0,0 @@
-- Disable imaps (using Ultisnips)
vim.g.vimtex_imaps_enabled = 0
-- Do not open pdfviwer on compile
vim.g.vimtex_view_automatic = 0
-- Disable conceal
vim.g.vimtex_syntax_conceal = {
accents = 0,
cites = 0,
fancy = 0,
greek = 0,
math_bounds = 0,
math_delimiters = 0,
math_fracs = 0,
math_super_sub = 0,
math_symbols = 0,
sections = 0,
styles = 0,
}
-- Disable quickfix auto open
vim.g.vimtex_quickfix_ignore_mode = 0
-- PDF viewer settings
vim.g.vimtex_view_general_viewer = "SumatraPDF"
vim.g.vimtex_view_general_options = "-reuse-instance -forward-search @tex @line @pdf"
-- Do not auto open quickfix on compile erros
vim.g.vimtex_quickfix_mode = 0
-- Latex warnings to ignore
vim.g.vimtex_quickfix_ignore_filters = {
"Command terminated with space",
"LaTeX Font Warning: Font shape",
"Package caption Warning: The option",
[[Underfull \\hbox (badness [0-9]*) in]],
"Package enumitem Warning: Negative labelwidth",
[[Overfull \\hbox ([0-9]*.[0-9]*pt too wide) in]],
[[Package caption Warning: Unused \\captionsetup]],
"Package typearea Warning: Bad type area settings!",
[[Package fancyhdr Warning: \\headheight is too small]],
[[Underfull \\hbox (badness [0-9]*) in paragraph at lines]],
"Package hyperref Warning: Token not allowed in a PDF string",
[[Overfull \\hbox ([0-9]*.[0-9]*pt too wide) in paragraph at lines]],
}
vim.g.vimtex_fold_enabled = 1
vim.g.vimtex_fold_manual = 1
vim.g.vimtex_fold_types = {
cmd_addplot = {
cmds = { "addplot[+3]?" },
},
cmd_multi = {
cmds = {
"%(re)?new%(command|environment)",
"providecommand",
"presetkeys",
"Declare%(Multi|Auto)?CiteCommand",
"Declare%(Index)?%(Field|List|Name)%(Format|Alias)",
},
},
cmd_single = {
cmds = { "hypersetup", "tikzset", "pgfplotstableread", "lstset" },
},
cmd_single_opt = {
cmds = { "usepackage", "includepdf" },
},
comments = {
enabled = 0,
},
env_options = vim.empty_dict(),
envs = {
blacklist = {},
whitelist = { "figure", "frame", "table", "example", "answer" },
},
items = {
enabled = 0,
},
markers = vim.empty_dict(),
preamble = {
enabled = 0,
},
sections = {
parse_levels = 0,
parts = { "appendix", "frontmatter", "mainmatter", "backmatter" },
sections = {
"%(add)?part",
"%(chapter|addchap)",
"%(section|section\\*)",
"%(subsection|subsection\\*)",
"%(subsubsection|subsubsection\\*)",
"paragraph",
},
},
}

View File

@ -235,30 +235,12 @@ local mappings = {
M = { "<cmd>Mason<cr>", "Open Mason UI" },
},
t = {
name = "Terminal",
["1"] = { ":1ToggleTerm<cr>", "1" },
["2"] = { ":2ToggleTerm<cr>", "2" },
["3"] = { ":3ToggleTerm<cr>", "3" },
["4"] = { ":4ToggleTerm<cr>", "4" },
t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "htop" },
d = { "<cmd>lua _DOTNET_RUN_TOGGLE()<cr>", "dotnet run" },
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" },
h = { "<cmd>ToggleTerm direction=horizontal<cr>", "Horizontal" },
},
T = {
name = "Treesitter",
h = { "<cmd>TSHighlightCapturesUnderCursor<cr>", "Highlight" },
p = { "<cmd>TSPlaygroundToggle<cr>", "Playground" },
r = { "<cmd>TSToggle rainbow<cr>", "Rainbow" },
},
N = {
name = "Notes (zk)",
n = { "<cmd>ZkNew<cr>", "New Note" },
e = { "<cmd>ZkNotes<cr>", "Edit Notes" },
},
}
local vopts = {

View File

@ -1,21 +0,0 @@
require("zk").setup({
-- can be "telescope", "fzf" or "select" (`vim.ui.select`)
-- it's recommended to use "telescope" or "fzf"
picker = "telescope",
lsp = {
-- `config` is passed to `vim.lsp.start_client(config)`
config = {
cmd = { "zk", "lsp" },
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
},
-- automatically attach buffers in a zk notebook that match the given filetypes
auto_attach = {
enabled = true,
filetypes = { "markdown" },
},
},
})

View File

@ -66,6 +66,12 @@ Including but not limited to:
- git
- and more...
### Current TODOs
- Get navic working with winbar, it's not working at the moment
- Get dap setup properly for my workflow
- Play with noice a bit more and see if it can replace my current bits and pieces.
## xmonad
## xmobar