feat: eww hypr alacritty and more
This commit is contained in:
parent
7fb4f9ee73
commit
99f7c60db7
431 changed files with 9853 additions and 23 deletions
5
nvim/lua/settings/autocommands.lua
Normal file
5
nvim/lua/settings/autocommands.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
callback = function()
|
||||
require("lint").try_lint()
|
||||
end,
|
||||
})
|
||||
169
nvim/lua/settings/bufferline.lua
Normal file
169
nvim/lua/settings/bufferline.lua
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
bufferline.setup {
|
||||
options = {
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
-- NOTE: this plugin is designed with this icon in mind,
|
||||
-- and so changing this is NOT recommended, this is intended
|
||||
-- as an escape hatch for people who cannot bear it for whatever reason
|
||||
indicator = {
|
||||
style = 'underline',
|
||||
},
|
||||
buffer_close_icon = "",
|
||||
-- buffer_close_icon = '',
|
||||
modified_icon = "●",
|
||||
close_icon = "",
|
||||
-- close_icon = '',
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
--- name_formatter can be used to change the buffer's label in the bufferline.
|
||||
--- Please note some names can/will break the
|
||||
--- bufferline so use this at your discretion knowing that it has
|
||||
--- some limitations that will *NOT* be fixed.
|
||||
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||
-- -- remove extension from markdown files for example
|
||||
-- if buf.name:match('%.md') then
|
||||
-- return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||
-- end
|
||||
-- end,
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 21,
|
||||
diagnostics = false, -- | "nvim_lsp" | "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
-- diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
-- return "("..count..")"
|
||||
-- end,
|
||||
-- NOTE: this will be called a lot so don't do any heavy processing here
|
||||
-- custom_filter = function(buf_number)
|
||||
-- -- filter out filetypes you don't want to see
|
||||
-- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out by buffer name
|
||||
-- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out based on arbitrary rules
|
||||
-- -- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
-- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
-- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
|
||||
-- -- add custom logic
|
||||
-- return buffer_a.modified > buffer_b.modified
|
||||
-- end
|
||||
},
|
||||
highlights = {
|
||||
fill = {
|
||||
fg = { attribute = "fg", highlight = "#ff0000" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
background = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
-- buffer_selected = {
|
||||
-- guifg = {attribute='fg',highlight='#ff0000'},
|
||||
-- guibg = {attribute='bg',highlight='#0000ff'},
|
||||
-- gui = 'none'
|
||||
-- },
|
||||
buffer_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
close_button = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
close_button_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
-- close_button_selected = {
|
||||
-- guifg = {attribute='fg',highlight='TabLineSel'},
|
||||
-- guibg ={attribute='bg',highlight='TabLineSel'}
|
||||
-- },
|
||||
|
||||
tab_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
tab = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
tab_close = {
|
||||
-- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
|
||||
duplicate_selected = {
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "TabLineSel" },
|
||||
italic = true,
|
||||
},
|
||||
duplicate_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
italic = true,
|
||||
},
|
||||
duplicate = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
italic = true,
|
||||
},
|
||||
|
||||
modified = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
modified_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
modified_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
separator = {
|
||||
fg = { attribute = "bg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
separator_selected = {
|
||||
fg = { attribute = "bg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
-- separator_visible = {
|
||||
-- guifg = {attribute='bg',highlight='TabLine'},
|
||||
-- guibg = {attribute='bg',highlight='TabLine'}
|
||||
-- },
|
||||
indicator_selected = {
|
||||
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
},
|
||||
}
|
||||
131
nvim/lua/settings/cmp.lua
Normal file
131
nvim/lua/settings/cmp.lua
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col "." - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
|
||||
end
|
||||
|
||||
-- פּ ﯟ some other good icons
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "m",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
["<C-e>"] = cmp.mapping {
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
},
|
||||
-- Accept currently selected item. If none selected, `select` first item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||
},
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false,
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
||||
6
nvim/lua/settings/colorscheme.lua
Normal file
6
nvim/lua/settings/colorscheme.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local status_ok, _ = pcall(require, "nightfox")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.cmd("colorscheme nightfox")
|
||||
22
nvim/lua/settings/comment.lua
Normal file
22
nvim/lua/settings/comment.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {
|
||||
pre_hook = function(ctx)
|
||||
local U = require "Comment.utils"
|
||||
|
||||
local location = nil
|
||||
if ctx.ctype == U.ctype.block 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 = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
||||
location = location,
|
||||
}
|
||||
end,
|
||||
}
|
||||
42
nvim/lua/settings/dashboard.lua
Normal file
42
nvim/lua/settings/dashboard.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
[[ __ ]],
|
||||
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
||||
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
|
||||
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
||||
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
||||
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
||||
}
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
|
||||
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("p", " Find project", ":Telescope projects <CR>"),
|
||||
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
|
||||
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
|
||||
dashboard.button("c", " Configuration", ":e ~/.config/nvim/init.lua <CR>"),
|
||||
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
|
||||
local function footer()
|
||||
-- NOTE: requires the fortune-mod package to work
|
||||
-- local handle = io.popen("fortune")
|
||||
-- local fortune = handle:read("*a")
|
||||
-- handle:close()
|
||||
-- return fortune
|
||||
return "dashie@shitgaem.online"
|
||||
end
|
||||
|
||||
dashboard.section.footer.val = footer()
|
||||
|
||||
dashboard.section.footer.opts.hl = "Type"
|
||||
dashboard.section.header.opts.hl = "Include"
|
||||
dashboard.section.buttons.opts.hl = "Keyword"
|
||||
|
||||
dashboard.opts.opts.noautocmd = true
|
||||
-- vim.cmd([[autocmd User AlphaReady echo 'ready']])
|
||||
alpha.setup(dashboard.opts)
|
||||
23
nvim/lua/settings/devicons.lua
Normal file
23
nvim/lua/settings/devicons.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local status_ok , _ = pcall (require, "nvim-web-devicons")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
require'nvim-web-devicons'.setup {
|
||||
-- your personnal icons can go here (to override)
|
||||
-- you can specify color or cterm_color instead of specifying both of them
|
||||
-- DevIcon will be appended to `name`
|
||||
override = {
|
||||
zsh = {
|
||||
icon = "",
|
||||
color = "#428850",
|
||||
cterm_color = "65",
|
||||
name = "Zsh"
|
||||
}
|
||||
};
|
||||
|
||||
default = true;
|
||||
}
|
||||
|
||||
require'nvim-web-devicons'.get_icons()
|
||||
8
nvim/lua/settings/feline.lua
Normal file
8
nvim/lua/settings/feline.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
local status_ok, _ = pcall(require, "feline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
require('feline').setup()
|
||||
--require('feline').winbar.setup()
|
||||
1
nvim/lua/settings/gitsigns.lua
Normal file
1
nvim/lua/settings/gitsigns.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require('gitsigns').setup()
|
||||
43
nvim/lua/settings/haskell.lua
Normal file
43
nvim/lua/settings/haskell.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'haskell-language-server-wrapper', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_dir = util.root_pattern('*.cabal', 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml'),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = 'ormolu',
|
||||
},
|
||||
},
|
||||
lspinfo = function(cfg)
|
||||
local extra = {}
|
||||
local function on_stdout(_, data, _)
|
||||
local version = data[1]
|
||||
table.insert(extra, 'version: ' .. version)
|
||||
end
|
||||
|
||||
local opts = {
|
||||
cwd = cfg.cwd,
|
||||
stdout_buffered = true,
|
||||
on_stdout = on_stdout,
|
||||
}
|
||||
local chanid = vim.fn.jobstart({ cfg.cmd[1], '--version' }, opts)
|
||||
vim.fn.jobwait { chanid }
|
||||
return extra
|
||||
end,
|
||||
},
|
||||
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/haskell/haskell-language-server
|
||||
Haskell Language Server
|
||||
]],
|
||||
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
6
nvim/lua/settings/impatient.lua
Normal file
6
nvim/lua/settings/impatient.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local status_ok, impatient = pcall(require, "impatient")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
impatient.enable_profile()
|
||||
70
nvim/lua/settings/indentline.lua
Normal file
70
nvim/lua/settings/indentline.lua
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
}
|
||||
vim.g.indentLine_enabled = 1
|
||||
-- vim.g.indent_blankline_char = "│"
|
||||
vim.g.indent_blankline_char = "▏"
|
||||
-- vim.g.indent_blankline_char = "▎"
|
||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||
vim.g.indent_blankline_show_first_indent_level = true
|
||||
vim.g.indent_blankline_use_treesitter = true
|
||||
vim.g.indent_blankline_show_current_context = true
|
||||
vim.g.indent_blankline_context_patterns = {
|
||||
"class",
|
||||
"return",
|
||||
"function",
|
||||
"method",
|
||||
"^if",
|
||||
"^while",
|
||||
"jsx_element",
|
||||
"^for",
|
||||
"^object",
|
||||
"^table",
|
||||
"block",
|
||||
"arguments",
|
||||
"if_statement",
|
||||
"else_clause",
|
||||
"jsx_element",
|
||||
"jsx_self_closing_element",
|
||||
"try_statement",
|
||||
"catch_clause",
|
||||
"import_statement",
|
||||
"operation_type",
|
||||
}
|
||||
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
|
||||
vim.wo.colorcolumn = "99999"
|
||||
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
|
||||
-- vim.opt.list = true
|
||||
-- vim.opt.listchars:append "space:⋅"
|
||||
-- vim.opt.listchars:append "space:"
|
||||
-- vim.opt.listchars:append "eol:↴"
|
||||
|
||||
indent_blankline.setup({
|
||||
-- show_end_of_line = true,
|
||||
-- space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
-- show_current_context_start = true,
|
||||
-- char_highlight_list = {
|
||||
-- "IndentBlanklineIndent1",
|
||||
-- "IndentBlanklineIndent2",
|
||||
-- "IndentBlanklineIndent3",
|
||||
-- },
|
||||
})
|
||||
9
nvim/lua/settings/keymaps.lua
Normal file
9
nvim/lua/settings/keymaps.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local term_opts = { silent = true }
|
||||
|
||||
-- Shorten function name
|
||||
local keymap = vim.api.nvim_set_keymap
|
||||
|
||||
|
||||
keymap("n", "c" ,":CodeActionMenu<CR>" , opts)
|
||||
4
nvim/lua/settings/lint.lua
Normal file
4
nvim/lua/settings/lint.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require('lint').linters_by_ft = {
|
||||
javascript = {'eslint',},
|
||||
react = {'eslint',},
|
||||
}
|
||||
74
nvim/lua/settings/lsp.lua
Normal file
74
nvim/lua/settings/lsp.lua
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
local status_ok, _ = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
require'lspconfig'.hls.setup {}
|
||||
require'lspconfig'.pyright.setup {}
|
||||
require'lspconfig'.clangd.setup {}
|
||||
require'lspconfig'.html.setup {}
|
||||
require'lspconfig'.eslint.setup {}
|
||||
require'lspconfig'.texlab.setup {}
|
||||
require'lspconfig'.jdtls.setup {}
|
||||
require'lspconfig'.sumneko_lua.setup {}
|
||||
require'lspconfig'.gopls.setup {}
|
||||
require'lspconfig'.jsonls.setup {}
|
||||
|
||||
|
||||
require("nvim-lsp-installer").setup({
|
||||
automatic_installation = true, -- automatically detect which servers to install (based on which servers are set up via lspconfig)
|
||||
ui = {
|
||||
icons = {
|
||||
server_installed = "✓",
|
||||
server_pending = "➜",
|
||||
server_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
local status_ok2, lsp_installer = pcall(require, "nvim-lsp-installer")
|
||||
if not status_ok2 then
|
||||
return
|
||||
end
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local servers = {"jdtls" , "sumneko_lua" , "texlab", "pyright" , "eslint" , "html" }
|
||||
|
||||
lsp_installer.setup {
|
||||
ensure_installed = servers
|
||||
}
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
local opts = {
|
||||
on_attach = require("settings.lsp_config.handlers").on_attach,
|
||||
capabilities = require("settings.lsp_config.handlers").capabilities,
|
||||
}
|
||||
local has_custom_opts, server_custom_opts = pcall(require, "settings.lsp_config." .. server)
|
||||
if has_custom_opts then
|
||||
opts = vim.tbl_deep_extend("force", server_custom_opts, opts)
|
||||
end
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
||||
|
||||
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.stylua,
|
||||
-- diagnostics.flake8
|
||||
},
|
||||
})
|
||||
165
nvim/lua/settings/lsp_config/eslint.lua
Normal file
165
nvim/lua/settings/lsp_config/eslint.lua
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
local util = require 'lspconfig.util'
|
||||
local lsp = vim.lsp
|
||||
|
||||
local function fix_all(opts)
|
||||
opts = opts or {}
|
||||
|
||||
local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint')
|
||||
if eslint_lsp_client == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local request
|
||||
if opts.sync then
|
||||
request = function(bufnr, method, params)
|
||||
eslint_lsp_client.request_sync(method, params, nil, bufnr)
|
||||
end
|
||||
else
|
||||
request = function(bufnr, method, params)
|
||||
eslint_lsp_client.request(method, params, nil, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
local bufnr = util.validate_bufnr(opts.bufnr or 0)
|
||||
request(0, 'workspace/executeCommand', {
|
||||
command = 'eslint.applyAllFixes',
|
||||
arguments = {
|
||||
{
|
||||
uri = vim.uri_from_bufnr(bufnr),
|
||||
version = lsp.util.buf_versions[bufnr],
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local bin_name = 'vscode-eslint-language-server'
|
||||
local cmd = { bin_name, '--stdio' }
|
||||
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'javascript.jsx',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'typescript.tsx',
|
||||
'vue',
|
||||
},
|
||||
-- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
|
||||
root_dir = util.root_pattern(
|
||||
'.eslintrc',
|
||||
'.eslintrc.js',
|
||||
'.eslintrc.cjs',
|
||||
'.eslintrc.yaml',
|
||||
'.eslintrc.yml',
|
||||
'.eslintrc.json',
|
||||
'package.json'
|
||||
),
|
||||
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
||||
settings = {
|
||||
validate = 'on',
|
||||
packageManager = 'npm',
|
||||
useESLintClass = false,
|
||||
codeActionOnSave = {
|
||||
enable = false,
|
||||
mode = 'all',
|
||||
},
|
||||
format = true,
|
||||
quiet = false,
|
||||
onIgnoredFiles = 'off',
|
||||
rulesCustomizations = {},
|
||||
run = 'onType',
|
||||
-- nodePath configures the directory in which the eslint server should start its node_modules resolution.
|
||||
-- This path is relative to the workspace folder (root dir) of the server instance.
|
||||
nodePath = '',
|
||||
-- use the workspace folder location or the file location (if no workspace folder is open) as the working directory
|
||||
workingDirectory = { mode = 'location' },
|
||||
codeAction = {
|
||||
disableRuleComment = {
|
||||
enable = true,
|
||||
location = 'separateLine',
|
||||
},
|
||||
showDocumentation = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_new_config = function(config, new_root_dir)
|
||||
-- The "workspaceFolder" is a VSCode concept. It limits how far the
|
||||
-- server will traverse the file system when locating the ESLint config
|
||||
-- file (e.g., .eslintrc).
|
||||
config.settings.workspaceFolder = {
|
||||
uri = new_root_dir,
|
||||
name = vim.fn.fnamemodify(new_root_dir, ':t'),
|
||||
}
|
||||
|
||||
-- Support Yarn2 (PnP) projects
|
||||
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs')
|
||||
local pnp_js = util.path.join(new_root_dir, '.pnp.js')
|
||||
if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then
|
||||
config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd)
|
||||
end
|
||||
end,
|
||||
handlers = {
|
||||
['eslint/openDoc'] = function(_, result)
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
local sysname = vim.loop.os_uname().sysname
|
||||
if sysname:match 'Windows' then
|
||||
os.execute(string.format('start %q', result.url))
|
||||
elseif sysname:match 'Linux' then
|
||||
os.execute(string.format('xdg-open %q', result.url))
|
||||
else
|
||||
os.execute(string.format('open %q', result.url))
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
['eslint/confirmESLintExecution'] = function(_, result)
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
return 4 -- approved
|
||||
end,
|
||||
['eslint/probeFailed'] = function()
|
||||
vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN)
|
||||
return {}
|
||||
end,
|
||||
['eslint/noLibrary'] = function()
|
||||
vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN)
|
||||
return {}
|
||||
end,
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
EslintFixAll = {
|
||||
function()
|
||||
fix_all { sync = true, bufnr = 0 }
|
||||
end,
|
||||
description = 'Fix all eslint problems for this buffer',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript.
|
||||
It can be installed via `npm`:
|
||||
```sh
|
||||
npm i -g vscode-langservers-extracted
|
||||
```
|
||||
`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save:
|
||||
```vim
|
||||
autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll
|
||||
```
|
||||
See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options.
|
||||
Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary`
|
||||
Additional messages you can handle: `eslint/noConfig`
|
||||
]],
|
||||
},
|
||||
}
|
||||
100
nvim/lua/settings/lsp_config/handlers.lua
Normal file
100
nvim/lua/settings/lsp_config/handlers.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
local M = {}
|
||||
|
||||
-- TODO: backfill this to template
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
-- disable virtual text
|
||||
virtual_text = false,
|
||||
-- show signs
|
||||
signs = {
|
||||
active = signs,
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
end
|
||||
|
||||
local function lsp_highlight_document(client)
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
illuminate.on_attach(client)
|
||||
-- end
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
"n",
|
||||
"gl",
|
||||
'<cmd>lua vim.diagnostic.open_float({ border = "rounded" })<CR>',
|
||||
opts
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
-- vim.notify(client.name .. " starting...")
|
||||
-- TODO: refactor this into a method that checks if string in list
|
||||
if client.name == "tsserver" then
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
end
|
||||
lsp_keymaps(bufnr)
|
||||
lsp_highlight_document(client)
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
|
||||
|
||||
return M
|
||||
43
nvim/lua/settings/lsp_config/html.lua
Normal file
43
nvim/lua/settings/lsp_config/html.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local util = require 'lspconfig.util'
|
||||
|
||||
local bin_name = 'vscode-html-language-server'
|
||||
local cmd = { bin_name, '--stdio' }
|
||||
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = { 'html' },
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
init_options = {
|
||||
provideFormatter = true,
|
||||
embeddedLanguages = { css = true, javascript = true },
|
||||
configurationSection = { 'html', 'css', 'javascript' },
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
`vscode-html-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm i -g vscode-langservers-extracted
|
||||
```
|
||||
Neovim does not currently include built-in snippets. `vscode-html-language-server` only provides completions when snippet support is enabled.
|
||||
To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup.
|
||||
The code-formatting feature of the lsp can be controlled with the `provideFormatter` option.
|
||||
```lua
|
||||
--Enable (broadcasting) snippet capability for completion
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
require'lspconfig'.html.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
||||
17
nvim/lua/settings/lsp_config/jdtls.lua
Normal file
17
nvim/lua/settings/lsp_config/jdtls.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
settings = {
|
||||
|
||||
java = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
55
nvim/lua/settings/lsp_config/pyright.lua
Normal file
55
nvim/lua/settings/lsp_config/pyright.lua
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
local util = require 'lspconfig.util'
|
||||
|
||||
local bin_name = 'pyright-langserver'
|
||||
local cmd = { bin_name, '--stdio' }
|
||||
|
||||
if vim.fn.has 'win32' == 1 then
|
||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
||||
end
|
||||
|
||||
local root_files = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'pyrightconfig.json',
|
||||
}
|
||||
|
||||
local function organize_imports()
|
||||
local params = {
|
||||
command = 'pyright.organizeimports',
|
||||
arguments = { vim.uri_from_bufnr(0) },
|
||||
}
|
||||
vim.lsp.buf.execute_command(params)
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = { 'python' },
|
||||
root_dir = util.root_pattern(unpack(root_files)),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'workspace',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
PyrightOrganizeImports = {
|
||||
organize_imports,
|
||||
description = 'Organize Imports',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/microsoft/pyright
|
||||
`pyright`, a static type checker and language server for python
|
||||
]],
|
||||
},
|
||||
}
|
||||
16
nvim/lua/settings/lsp_config/sumneko_lua.lua
Normal file
16
nvim/lua/settings/lsp_config/sumneko_lua.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
settings = {
|
||||
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
16
nvim/lua/settings/lsp_config/texlab.lua
Normal file
16
nvim/lua/settings/lsp_config/texlab.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
settings = {
|
||||
|
||||
latex = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
14
nvim/lua/settings/lua_codeactions.lua
Normal file
14
nvim/lua/settings/lua_codeactions.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
local M = {}
|
||||
|
||||
local lsp_util = vim.lsp.util
|
||||
|
||||
function M.code_action_listener()
|
||||
local context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() }
|
||||
local params = lsp_util.make_range_params()
|
||||
params.context = context
|
||||
vim.lsp.buf_request(0, 'textDocument/codeAction', params, function(err, _, result)
|
||||
-- do something with result - e.g. check if empty and show some indication such as a sign
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
16
nvim/lua/settings/null-ls.lua
Normal file
16
nvim/lua/settings/null-ls.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd("nnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.formatting()<CR>")
|
||||
|
||||
-- format on save
|
||||
vim.cmd("autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting()")
|
||||
end
|
||||
|
||||
if client.server_capabilities.documentRangeFormattingProvider then
|
||||
vim.cmd("xnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.range_formatting({})<CR>")
|
||||
end
|
||||
end,
|
||||
})
|
||||
103
nvim/lua/settings/nvim-tree.lua
Normal file
103
nvim/lua/settings/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
-- following options are the default
|
||||
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
|
||||
|
||||
local status_ok, nvim_tree = pcall(require, "nvim-tree")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
|
||||
if not config_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- Replaces auto_close
|
||||
local tree_cb = nvim_tree_config.nvim_tree_callback
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
nested = true,
|
||||
callback = function()
|
||||
if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
|
||||
vim.cmd "quit"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
nvim_tree.setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {
|
||||
"startify",
|
||||
"dashboard",
|
||||
"alpha",
|
||||
},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {
|
||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
|
||||
{ key = "h", cb = tree_cb "close_node" },
|
||||
{ key = "v", cb = tree_cb "vsplit" },
|
||||
},
|
||||
},
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
quit_on_open = true,
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- unknown options as of 22.05
|
||||
--
|
||||
-- update_to_buf_dir = {
|
||||
-- enable = true,
|
||||
-- auto_open = true,
|
||||
-- },
|
||||
-- auto_resize = true,
|
||||
-- git_hl = 1,
|
||||
-- root_folder_modifier = ":t",
|
||||
|
||||
}
|
||||
33
nvim/lua/settings/options.lua
Normal file
33
nvim/lua/settings/options.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local options = {
|
||||
clipboard = "unnamedplus",
|
||||
mouse = "a",
|
||||
fileencoding = "utf-8",
|
||||
relativenumber = true,
|
||||
smartindent = true,
|
||||
smartcase = true,
|
||||
showmode = true,
|
||||
termguicolors = true,
|
||||
-- winbar = "",
|
||||
ignorecase = true,
|
||||
showtabline = 2,
|
||||
timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
undofile = true, -- enable persistent undoi updatetime = 300, -- faster completion (4000ms default)
|
||||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
expandtab = true, -- convert tabs to spaces
|
||||
shiftwidth = 2, -- the number of spaces inserted for each indentation
|
||||
tabstop = 2, -- insert 2 spaces for a tab
|
||||
cursorline = true,
|
||||
scrolloff = 8, -- is one of my fav
|
||||
sidescrolloff = 8,
|
||||
spell = true,
|
||||
spelllang = "en_us",
|
||||
mousemodel = "popup_setpos",
|
||||
}
|
||||
|
||||
--vim.opt.shortmess:append "c"
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
|
||||
33
nvim/lua/settings/pairs.lua
Normal file
33
nvim/lua/settings/pairs.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
-- Setup nvim-cmp.
|
||||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
npairs.setup {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
disable_filetype = { "TelescopePrompt", "spectre_panel" },
|
||||
fast_wrap = {
|
||||
map = "<M-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"
|
||||
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 = "" } })
|
||||
42
nvim/lua/settings/plugins.lua
Normal file
42
nvim/lua/settings/plugins.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local Plug = vim.fn['plug#']
|
||||
vim.call('plug#begin' ,'~/.config/nvim/plugged')
|
||||
Plug('folke/twilight.nvim')
|
||||
Plug('nvim-lua/popup.nvim') -- An implementation of the Popup API from vim in Neovim
|
||||
Plug('nvim-lua/plenary.nvim') -- Useful lua functions used ny lots of plugins
|
||||
Plug('EdenEast/nightfox.nvim')
|
||||
Plug('kyazdani42/nvim-web-devicons')
|
||||
Plug('feline-nvim/feline.nvim')
|
||||
Plug('lewis6991/gitsigns.nvim')
|
||||
Plug('tanvirtin/vgit.nvim')
|
||||
Plug('nvim-lua/plenary.nvim')
|
||||
Plug('b3nj5m1n/kommentary')
|
||||
Plug('antoinemadec/FixCursorHold.nvim')
|
||||
Plug('lambdalisue/fern.vim')
|
||||
Plug('neovim/nvim-lspconfig')
|
||||
Plug('nvim-treesitter/nvim-treesitter', {['do']= vim.fn[':TSUpdate']})
|
||||
Plug('williamboman/nvim-lsp-installer')
|
||||
Plug('hrsh7th/nvim-cmp')
|
||||
Plug('hrsh7th/cmp-nvim-lsp')
|
||||
Plug('hrsh7th/cmp-buffer')
|
||||
Plug('hrsh7th/cmp-path')
|
||||
Plug('hrsh7th/cmp-cmdline')
|
||||
Plug('saadparwaiz1/cmp_luasnip')
|
||||
Plug('L3MON4D3/LuaSnip')
|
||||
Plug('kyazdani42/nvim-tree.lua')
|
||||
Plug('windwp/nvim-autopairs')
|
||||
Plug('akinsho/bufferline.nvim')
|
||||
Plug('numToStr/Comment.nvim')
|
||||
Plug('lukas-reineke/indent-blankline.nvim')
|
||||
Plug('lewis6991/impatient.nvim')
|
||||
Plug('lewis6991/spellsitter.nvim')
|
||||
Plug('moll/vim-bbye')
|
||||
Plug('nvim-telescope/telescope.nvim')
|
||||
Plug('ahmedkhalf/project.nvim')
|
||||
Plug('goolord/alpha-nvim')
|
||||
Plug('lervag/vimtex')
|
||||
Plug('weilbith/nvim-code-action-menu')
|
||||
Plug('mfussenegger/nvim-lint')
|
||||
Plug 'jose-elias-alvarez/null-ls.nvim'
|
||||
Plug 'MunifTanjim/prettier.nvim'
|
||||
vim.call('plug#end')
|
||||
|
||||
19
nvim/lua/settings/prettier.lua
Normal file
19
nvim/lua/settings/prettier.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
local prettier = require("prettier")
|
||||
|
||||
prettier.setup({
|
||||
bin = 'prettier', -- or `prettierd`
|
||||
filetypes = {
|
||||
"css",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"less",
|
||||
"markdown",
|
||||
"scss",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yaml",
|
||||
},
|
||||
})
|
||||
48
nvim/lua/settings/project.lua
Normal file
48
nvim/lua/settings/project.lua
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
local status_ok, project = pcall(require, "project_nvim")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
project.setup({
|
||||
---@usage set to false to disable project.nvim.
|
||||
--- This is on by default since it's currently the expected behavior.
|
||||
active = true,
|
||||
|
||||
on_config_done = nil,
|
||||
|
||||
---@usage set to true to disable setting the current-woriking directory
|
||||
--- Manual mode doesn't automatically change your root directory, so you have
|
||||
--- the option to manually do so using `:ProjectRoot` command.
|
||||
manual_mode = false,
|
||||
|
||||
---@usage Methods of detecting the root directory
|
||||
--- Allowed values: **"lsp"** uses the native neovim lsp
|
||||
--- **"pattern"** uses vim-rooter like glob pattern matching. Here
|
||||
--- order matters: if one is not detected, the other is used as fallback. You
|
||||
--- can also delete or rearangne the detection methods.
|
||||
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
|
||||
detection_methods = { "pattern" },
|
||||
|
||||
---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
|
||||
|
||||
---@ Show hidden files in telescope when searching for files in a project
|
||||
show_hidden = false,
|
||||
|
||||
---@usage When set to false, you will get a message when project.nvim changes your directory.
|
||||
-- When set to false, you will get a message when project.nvim changes your directory.
|
||||
silent_chdir = true,
|
||||
|
||||
---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
|
||||
ignore_lsp = {},
|
||||
|
||||
---@type string
|
||||
---@usage path to store the project history for use in telescope
|
||||
datapath = vim.fn.stdpath("data"),
|
||||
})
|
||||
|
||||
local tele_status_ok, telescope = pcall(require, "telescope")
|
||||
if not tele_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
telescope.load_extension('projects')
|
||||
57
nvim/lua/settings/test.log
Normal file
57
nvim/lua/settings/test.log
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
**
|
||||
(test.tex
|
||||
LaTeX2e <2020-10-01> patch level 4
|
||||
L3 programming layer <2021-02-18> (article.cls
|
||||
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
|
||||
(size10.clo
|
||||
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
|
||||
)
|
||||
\c@part=\count175
|
||||
\c@section=\count176
|
||||
\c@subsection=\count177
|
||||
\c@subsubsection=\count178
|
||||
\c@paragraph=\count179
|
||||
\c@subparagraph=\count180
|
||||
\c@figure=\count181
|
||||
\c@table=\count182
|
||||
\abovecaptionskip=\skip47
|
||||
\belowcaptionskip=\skip48
|
||||
\bibindent=\dimen138
|
||||
) (l3backend-xetex.def
|
||||
File: l3backend-xetex.def 2021-03-18 L3 backend support: XeTeX
|
||||
\c__kernel_sys_dvipdfmx_version_int=\count183
|
||||
\l__color_backend_stack_int=\count184
|
||||
\g__color_backend_stack_int=\count185
|
||||
\g__graphics_track_int=\count186
|
||||
\l__pdf_internal_box=\box47
|
||||
\g__pdf_backend_object_int=\count187
|
||||
\g__pdf_backend_annotation_int=\count188
|
||||
\g__pdf_backend_link_int=\count189
|
||||
) (test.aux)
|
||||
\openout1 = `test.aux'.
|
||||
|
||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 2.
|
||||
LaTeX Font Info: Trying to load font information for TS1+cmr on input line 2
|
||||
.
|
||||
(ts1cmr.fd
|
||||
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
|
||||
)
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2.
|
||||
LaTeX Font Info: ... okay on input line 2.
|
||||
[1
|
||||
|
||||
] (test.aux) )
|
||||
Output written on test.xdv (1 page, 624 bytes).
|
||||
21
nvim/lua/settings/treesitter.lua
Normal file
21
nvim/lua/settings/treesitter.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local status_ok, _ = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "latex" , "c", "cpp" , "lua", "haskell" , "java" , "javascript" , "typescript" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
local status_ok2, _ = pcall(require, "spellsitter")
|
||||
if not status_ok2 then
|
||||
return
|
||||
end
|
||||
|
||||
require("spellsitter").setup()
|
||||
|
||||
8
nvim/lua/settings/vimtex.lua
Normal file
8
nvim/lua/settings/vimtex.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
--vim.cmd('let g:vimtex_view_method = "zathura"')
|
||||
|
||||
vim.cmd('let g:vimtex_view_general_viewer = "okular"')
|
||||
--let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
|
||||
|
||||
vim.cmd('let g:vimtex_compiler_method = "latexmk"')
|
||||
|
||||
--let maplocalleader = ","
|
||||
Loading…
Add table
Add a link
Reference in a new issue