Compare commits
6 commits
619b721120
...
master
Author | SHA1 | Date | |
---|---|---|---|
f81c4bde28 | |||
f6d4e367d2 | |||
49cbc9197d | |||
ce9bd490ee | |||
2f1202a669 | |||
14b563ff20 |
15 changed files with 596 additions and 126 deletions
25
README.md
25
README.md
|
@ -5,7 +5,7 @@ My vim config written in lua designed for *smol boi minimal vibes*
|
||||||
Most of the code is in separate modules. Each will later be its own true plugin.
|
Most of the code is in separate modules. Each will later be its own true plugin.
|
||||||
|
|
||||||
|
|
||||||
### Install
|
### Installation
|
||||||
|
|
||||||
Install the package manager `paq` to start:
|
Install the package manager `paq` to start:
|
||||||
|
|
||||||
|
@ -14,6 +14,29 @@ git clone --depth=1 https://github.com/savq/paq-nvim.git \
|
||||||
"${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim
|
"${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### LSP servers
|
||||||
|
|
||||||
|
Scripts are supplied in `scripts/` for each server I use. Run these for the
|
||||||
|
corresponding server that you would like to be installed.
|
||||||
|
|
||||||
|
The process in no way is automated or "purely in lua or vimscript", but it more
|
||||||
|
just holds your hand a bit. There may be plans in the future to automate this
|
||||||
|
with our own package manager. But I might start writing my own editor by that
|
||||||
|
point. So we'll see.
|
||||||
|
|
||||||
|
If you'd like to add a new LSP server, feel free. Just make sure to ask the
|
||||||
|
user if all dependencies are installed. Currently, this is achieved using
|
||||||
|
`query_dep` in `query_dependency.sh`. All it does is ask the user if the
|
||||||
|
dependency is installed and quits the install script if any dependency is not
|
||||||
|
installed. *(don't even remind me how hacky that is)*
|
||||||
|
|
||||||
|
However, a proper package management system would be more prefered. So never
|
||||||
|
feel like this pattern is in any way enforced. I can't be biased toward which
|
||||||
|
packages for which package managers will get maintained. And I can't be
|
||||||
|
bothered to write a package for every package manager that ever exists. If it
|
||||||
|
bothers you enough, change it to specifically work with your system. And maybe
|
||||||
|
contribute so others maybe follow suit.
|
||||||
|
|
||||||
|
|
||||||
### Configure
|
### Configure
|
||||||
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
==============================================================================
|
|
||||||
1. custom config *custom-config*
|
|
||||||
|
|
||||||
An extensible and modular configuration of [Neovim](https://neovim.io).
|
|
||||||
This repository is to provide sensible defaults that can be further modified to
|
|
||||||
the user's liking. Customize and extend at your own disgression.
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
2. overview *cvoges-config-overview*
|
|
||||||
|
|
||||||
This config contains:
|
|
||||||
+ LSP configuration
|
|
||||||
* errors, warnings, info, hints
|
|
||||||
* extendable keybindings for
|
|
||||||
- goto_prev
|
|
||||||
- goto_next
|
|
||||||
- code actions
|
|
||||||
- locate definition
|
|
||||||
- locate declaration
|
|
||||||
- formatting
|
|
||||||
- hover menu
|
|
||||||
- renaming
|
|
||||||
- locate references
|
|
||||||
- document symbols
|
|
||||||
|
|
||||||
+ small plug-in manaegr
|
|
||||||
+ asynchronous configuration loading
|
|
||||||
+ modular status bar w/ by default:
|
|
||||||
* lsp module
|
|
||||||
* file path module
|
|
||||||
* file type module
|
|
||||||
* file percentage module
|
|
||||||
* columns,line number module
|
|
||||||
* ReadOnly or Modified flag module
|
|
||||||
|
|
||||||
+ support for multiple keyboard layouts
|
|
||||||
+ benchmark script
|
|
||||||
|
|
||||||
This config does **NOT** contain:
|
|
||||||
- language servers
|
|
7
init.lua
7
init.lua
|
@ -20,9 +20,14 @@ v = vim.v -- variables
|
||||||
env = vim.env -- environment variables
|
env = vim.env -- environment variables
|
||||||
|
|
||||||
local modules = {
|
local modules = {
|
||||||
|
'ui',
|
||||||
'general',
|
'general',
|
||||||
'keymap',
|
'keymap',
|
||||||
'ui'
|
'plugins',
|
||||||
|
'native-lsp',
|
||||||
|
'indent-blankline',
|
||||||
|
'gitsigns-nvim',
|
||||||
|
'lightbulb'
|
||||||
}
|
}
|
||||||
|
|
||||||
local async
|
local async
|
||||||
|
|
65
lua/gitsigns-nvim.lua
Normal file
65
lua/gitsigns-nvim.lua
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
require('gitsigns').setup {
|
||||||
|
signs = {
|
||||||
|
add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
|
||||||
|
change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
||||||
|
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
||||||
|
topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
||||||
|
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||||
|
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||||
|
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||||
|
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
keymaps = {
|
||||||
|
-- Default keymap options
|
||||||
|
noremap = true,
|
||||||
|
|
||||||
|
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'"},
|
||||||
|
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'"},
|
||||||
|
|
||||||
|
['n <leader>hs'] = '<cmd>Gitsigns stage_hunk<CR>',
|
||||||
|
['v <leader>hs'] = ':Gitsigns stage_hunk<CR>',
|
||||||
|
['n <leader>hu'] = '<cmd>Gitsigns undo_stage_hunk<CR>',
|
||||||
|
['n <leader>hr'] = '<cmd>Gitsigns reset_hunk<CR>',
|
||||||
|
['v <leader>hr'] = ':Gitsigns reset_hunk<CR>',
|
||||||
|
['n <leader>hR'] = '<cmd>Gitsigns reset_buffer<CR>',
|
||||||
|
['n <leader>hp'] = '<cmd>Gitsigns preview_hunk<CR>',
|
||||||
|
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line{full=true}<CR>',
|
||||||
|
['n <leader>hS'] = '<cmd>Gitsigns stage_buffer<CR>',
|
||||||
|
['n <leader>hU'] = '<cmd>Gitsigns reset_buffer_index<CR>',
|
||||||
|
|
||||||
|
-- Text objects
|
||||||
|
['o ih'] = ':<C-U>Gitsigns select_hunk<CR>',
|
||||||
|
['x ih'] = ':<C-U>Gitsigns select_hunk<CR>'
|
||||||
|
},
|
||||||
|
watch_gitdir = {
|
||||||
|
interval = 1000,
|
||||||
|
follow_files = true
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter_opts = {
|
||||||
|
relative_time = false
|
||||||
|
},
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
max_file_length = 40000,
|
||||||
|
preview_config = {
|
||||||
|
-- Options passed to nvim_open_win
|
||||||
|
border = 'single',
|
||||||
|
style = 'minimal',
|
||||||
|
relative = 'cursor',
|
||||||
|
row = 0,
|
||||||
|
col = 1
|
||||||
|
},
|
||||||
|
yadm = {
|
||||||
|
enable = false
|
||||||
|
},
|
||||||
|
}
|
5
lua/indent-blankline.lua
Normal file
5
lua/indent-blankline.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require("indent_blankline").setup {
|
||||||
|
-- for example, context is off by default, use this to turn it on
|
||||||
|
show_current_context = true,
|
||||||
|
show_current_context_start = true,
|
||||||
|
}
|
|
@ -275,64 +275,28 @@ end
|
||||||
map('n', '<leader>p', ':lua pm_sync()<CR>', {noremap = true})
|
map('n', '<leader>p', ':lua pm_sync()<CR>', {noremap = true})
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
function lsp_shortcuts()
|
local lsp_commands = {
|
||||||
local lsp_commands = {
|
new = {'h','d','D','r','f','n','i','s','S','<','>','a'},
|
||||||
new = {'d','r','f','t','x','a','c','C','h','s','m'},
|
old = {
|
||||||
old = {
|
'buf.hover', -- h
|
||||||
'#textDocument_definition', -- d
|
'buf.definition', -- d
|
||||||
'#textDocument_rename', -- r
|
'buf.declaration', -- D
|
||||||
'#textDocument_formatting', -- f
|
'buf.references', -- r
|
||||||
'#textDocument_typeDefinition', -- t
|
'buf.formatting', -- f
|
||||||
'#textDocument_references', -- x
|
'buf.rename', -- n
|
||||||
'_workspace_applyEdit', -- a
|
'buf.implementation', -- i
|
||||||
'#textDocument_completion', -- c
|
'buf.document_symbol', -- s
|
||||||
'#textDocument_codeAction', -- C
|
'buf.signature_help', -- S
|
||||||
'#textDocument_hover', -- h
|
'diagnostic.goto_prev', -- <
|
||||||
'_textDocument_documentSymbol', -- s
|
'diagnostic.goto_next', -- >
|
||||||
'_contextMenu' -- m
|
'buf.code_action' -- a
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for i = 1, #lspcommands.new do
|
}
|
||||||
for _,f in pairs(modes_map({'n'})) do
|
for i = 1, #lsp_commands.new do
|
||||||
f('<Leader>l'..key_pair.new[i],
|
for _,f in pairs(modes_map({'n'})) do
|
||||||
':call LanguageClient'..key_pair.old[i]..'()<CR>', {noremap = true})
|
f('<Leader>l'..lsp_commands.new[i],
|
||||||
end
|
'<cmd>lua vim.lsp.'..lsp_commands.old[i]..'()<CR>',
|
||||||
|
{noremap = true}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NERDTree defaults
|
|
||||||
map('n', '<Leader>n', ':NERDTree<CR>', {noremap = true})
|
|
||||||
vim.g.NERDTreeMapActivateNode = 'o' -- o
|
|
||||||
vim.g.NERDTreeMapPreview = 'go' -- go
|
|
||||||
vim.g.NERDTreeMapOpenInTab = 't' -- t
|
|
||||||
vim.g.NERDTreeMapOpenInTabSilent = 'T' -- T
|
|
||||||
vim.g.NERDTreeMapOpenVSplit = 'v' -- s
|
|
||||||
vim.g.NERDTreeMapPreviewVSplit = 'V' -- gs
|
|
||||||
vim.g.NERDTreeMapCustomOpen = '<CR>' -- <CR>
|
|
||||||
vim.g.NERDTreeMapOpenRecursively = 'O' -- O
|
|
||||||
vim.g.NERDTreeMapCloseDir = 'x' -- x
|
|
||||||
vim.g.NERDTreeMapCloseChildren = 'X' -- X
|
|
||||||
vim.g.NERDTreeMapOpenExpl = '<C-o>' -- e
|
|
||||||
vim.g.NERDTreeMapDeleteBookmark = 'd' -- D
|
|
||||||
vim.g.NERDTreeMapJumpRoot = 'P' -- P
|
|
||||||
vim.g.NERDTreeMapJumpParent = 'p' -- p
|
|
||||||
vim.g.NERDTreeMapUpdir = 'h' -- u
|
|
||||||
vim.g.NERDTreeMapUpdirKeepOpen = 'H' -- U
|
|
||||||
vim.g.NERDTreeMapRefresh = 'r' -- r
|
|
||||||
vim.g.NERDTreeMapRefreshRoot = 'R' -- R
|
|
||||||
vim.g.NERDTreeMapMenu = 'm' -- m
|
|
||||||
vim.g.NERDTreeMapChdir = 'c' -- cd
|
|
||||||
vim.g.NERDTreeMapCWD = 'C' -- CD
|
|
||||||
vim.g.NERDTreeMapToggleHidden = '.' -- I
|
|
||||||
vim.g.NERDTreeMapToggleFilters = 'F' -- f
|
|
||||||
vim.g.NERDTreeMapToggleFiles = 'f' -- F
|
|
||||||
vim.g.NERDTreeMapToggleBookmarks = 'b' -- B
|
|
||||||
vim.g.NERDTreeMapQuit = 'q' -- q
|
|
||||||
vim.g.NERDTreeMapToggleZoom = 'z' -- A
|
|
||||||
vim.g.NERDTreeMapHelp = '?' -- ?
|
|
||||||
|
|
||||||
-- Limelight
|
|
||||||
map('n', '<Leader>ul', ':call LimelightToggle()<CR>', {noremap = true})
|
|
||||||
|
|
||||||
-- Transparent
|
|
||||||
map('n', '<Leader>ut', ':TransparentToggle<CR>', {noremap = true})
|
|
||||||
|
|
1
lua/lightbulb.lua
Normal file
1
lua/lightbulb.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require('nvim-lightbulb').update_lightbulb()
|
41
lua/native-lsp/init.lua
Normal file
41
lua/native-lsp/init.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
-- see `:help` for any questions
|
||||||
|
-- use `&<var>` to show value of vimscript variable
|
||||||
|
|
||||||
|
|
||||||
|
-- API --
|
||||||
|
-- o = vim.o -- options
|
||||||
|
-- go = vim.go -- only-global options
|
||||||
|
-- bo = vim.bo -- buffer local options
|
||||||
|
-- wo = vim.wo -- window local options
|
||||||
|
|
||||||
|
-- cmd = vim.cmd -- vim commands
|
||||||
|
-- fn = vim.fn -- vim functions
|
||||||
|
-- opt = vim.opt -- vim option object
|
||||||
|
|
||||||
|
-- g = vim.g -- global variables
|
||||||
|
-- b = vim.b -- buffer local variables
|
||||||
|
-- w = vim.w -- window local variables
|
||||||
|
-- t = vim.t -- tab local variables
|
||||||
|
-- v = vim.v -- variables
|
||||||
|
-- env = vim.env -- environment variables
|
||||||
|
|
||||||
|
require("native-lsp/nvim-lsp-installer")
|
||||||
|
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
require('completion').on_attach()
|
||||||
|
end
|
||||||
|
|
||||||
|
local servers = {'zls'}
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
lspconfig[lsp].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
opt.completeopt = "menu,menuone,noselect"
|
||||||
|
g.completion_enable_auto_popup = 1
|
||||||
|
|
||||||
|
require("native-lsp/nvim-cmp")
|
154
lua/native-lsp/nvim-cmp.lua
Normal file
154
lua/native-lsp/nvim-cmp.lua
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
|
if not luasnip then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local lsp_symbols = {
|
||||||
|
Text = " (Text) ",
|
||||||
|
Method = " (Method)",
|
||||||
|
Function = " (Function)",
|
||||||
|
Constructor = " (Constructor)",
|
||||||
|
Field = " ﴲ (Field)",
|
||||||
|
Variable = " (Variable)",
|
||||||
|
Class = " (Class)",
|
||||||
|
Interface = " (Interface)",
|
||||||
|
Module = " (Module)",
|
||||||
|
Property = " 襁 (Property)",
|
||||||
|
Unit = " (Unit)",
|
||||||
|
Value = " (Value)",
|
||||||
|
Enum = " 練 (Enum)",
|
||||||
|
Keyword = " (Keyword)",
|
||||||
|
Snippet = " (Snippet)",
|
||||||
|
Color = " (Color)",
|
||||||
|
File = " (File)",
|
||||||
|
Reference = " (Reference)",
|
||||||
|
Folder = " (Folder)",
|
||||||
|
EnumMember = " (EnumMember)",
|
||||||
|
Constant = " (Constant)",
|
||||||
|
Struct = " (Struct)",
|
||||||
|
Event = " (Event)",
|
||||||
|
Operator = " (Operator)",
|
||||||
|
TypeParameter = " (TypeParameter)"
|
||||||
|
}
|
||||||
|
|
||||||
|
local has_words_before = function()
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = {
|
||||||
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||||
|
["<C-n>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<C-e>"] = 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" }),
|
||||||
|
['<C-CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
formatting = {
|
||||||
|
format = function(entry, item)
|
||||||
|
item.kind = lsp_symbols[item.kind] .. " " .. item.kind
|
||||||
|
-- set a name for each source
|
||||||
|
item.menu = ({
|
||||||
|
spell = "[Spell]",
|
||||||
|
buffer = "[Buffer]",
|
||||||
|
calc = "[Calc]",
|
||||||
|
emoji = "[Emoji]",
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
path = "[Path]",
|
||||||
|
look = "[Look]",
|
||||||
|
treesitter = "[treesitter]",
|
||||||
|
luasnip = "[LuaSnip]",
|
||||||
|
nvim_lua = "[Lua]",
|
||||||
|
latex_symbols = "[Latex]",
|
||||||
|
cmp_tabnine = "[Tab9]"
|
||||||
|
})[entry.source.name]
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'cmp_tabnine' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'latex_symbols'},
|
||||||
|
{ name = 'treesitter' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{
|
||||||
|
name = 'look',
|
||||||
|
keyword_length = 2,
|
||||||
|
option = {
|
||||||
|
convert_case = true,
|
||||||
|
loud = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ name = 'emoji' },
|
||||||
|
{ name = 'calc' }
|
||||||
|
},
|
||||||
|
|
||||||
|
cmp.setup.cmdline('-', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'cmdline' },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
local tabnine = require('cmp_tabnine.config')
|
||||||
|
|
||||||
|
tabnine:setup({
|
||||||
|
max_lines = 1000;
|
||||||
|
max_num_results = 20;
|
||||||
|
sort = true;
|
||||||
|
run_on_every_keystroke = true;
|
||||||
|
snippet_placeholder = '..';
|
||||||
|
ignored_file_types = { -- default is not to ignore
|
||||||
|
-- uncomment to ignore in lua:
|
||||||
|
-- lua = true
|
||||||
|
};
|
||||||
|
})
|
95
lua/native-lsp/nvim-compe.lua
Normal file
95
lua/native-lsp/nvim-compe.lua
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
-- see `:help` for any questions
|
||||||
|
-- use `&<var>` to show value of vimscript variable
|
||||||
|
|
||||||
|
|
||||||
|
-- API --
|
||||||
|
-- o = vim.o -- options
|
||||||
|
-- go = vim.go -- only-global options
|
||||||
|
-- bo = vim.bo -- buffer local options
|
||||||
|
-- wo = vim.wo -- window local options
|
||||||
|
|
||||||
|
-- cmd = vim.cmd -- vim commands
|
||||||
|
-- fn = vim.fn -- vim functions
|
||||||
|
-- opt = vim.opt -- vim option object
|
||||||
|
|
||||||
|
-- g = vim.g -- global variables
|
||||||
|
-- b = vim.b -- buffer local variables
|
||||||
|
-- w = vim.w -- window local variables
|
||||||
|
-- t = vim.t -- tab local variables
|
||||||
|
-- v = vim.v -- variables
|
||||||
|
-- env = vim.env -- environment variables
|
||||||
|
|
||||||
|
-- dependent on https://github.com/hrsh7th/nvim-compe
|
||||||
|
|
||||||
|
require'compe'.setup {
|
||||||
|
enabled = true;
|
||||||
|
autocomplete = true;
|
||||||
|
debug = false;
|
||||||
|
min_length = 1;
|
||||||
|
preselect = 'enable';
|
||||||
|
throttle_time = 80;
|
||||||
|
source_timeout = 200;
|
||||||
|
incomplete_delay = 400;
|
||||||
|
max_abbr_width = 100;
|
||||||
|
max_kind_width = 100;
|
||||||
|
max_menu_width = 100;
|
||||||
|
documentation = false;
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = true;
|
||||||
|
buffer = true;
|
||||||
|
calc = true;
|
||||||
|
vsnip = true;
|
||||||
|
nvim_lsp = true;
|
||||||
|
nvim_lua = true;
|
||||||
|
spell = true;
|
||||||
|
tags = true;
|
||||||
|
snippets_nvim = true;
|
||||||
|
treesitter = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = fn.col('.') - 1
|
||||||
|
if col == 0 or fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use (s-)tab to:
|
||||||
|
--- move to prev/next item in completion menuone
|
||||||
|
--- jump to prev/next snippet's placeholder
|
||||||
|
_G.tab_complete = function()
|
||||||
|
if fn.pumvisible() == 1 then
|
||||||
|
return t "<C-n>"
|
||||||
|
elseif fn.call("vsnip#available", {1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-expand-or-jump)"
|
||||||
|
elseif check_back_space() then
|
||||||
|
return t "<Tab>"
|
||||||
|
else
|
||||||
|
return fn['compe#complete']()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if fn.pumvisible() == 1 then
|
||||||
|
return t "<C-p>"
|
||||||
|
elseif fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
else
|
||||||
|
-- If <S-Tab> is not working in your terminal, change it to <C-h>
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
map("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
map("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
map("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
map("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
|
||||||
|
map('i', '<cr>', 'compe#confirm("<cr>")', { expr = true })
|
||||||
|
map('i', '<c-space>', 'compe#complete()', { expr = true })
|
75
lua/native-lsp/nvim-lsp-installer.lua
Normal file
75
lua/native-lsp/nvim-lsp-installer.lua
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
local lsp_installer = require("nvim-lsp-installer")
|
||||||
|
|
||||||
|
|
||||||
|
local lang_servers = {
|
||||||
|
"bashls",
|
||||||
|
"ccls",
|
||||||
|
"clangd",
|
||||||
|
"cmake",
|
||||||
|
"cssls",
|
||||||
|
"cssmodules_ls",
|
||||||
|
"diagnosticls",
|
||||||
|
"dockerls",
|
||||||
|
"dotls",
|
||||||
|
"efm",
|
||||||
|
--"eslint",
|
||||||
|
"emmet_ls",
|
||||||
|
--"grammarly",
|
||||||
|
"graphql",
|
||||||
|
"html",
|
||||||
|
--"hls",
|
||||||
|
"jsonls",
|
||||||
|
--"jdtls",
|
||||||
|
--"quick_lint_js",
|
||||||
|
"tsserver",
|
||||||
|
--"ltex",
|
||||||
|
"texlab",
|
||||||
|
"sumneko_lua",
|
||||||
|
"remark_ls",
|
||||||
|
--"zk",
|
||||||
|
"puppet",
|
||||||
|
--"jedi_language_server",
|
||||||
|
"pyright",
|
||||||
|
--"pylsp",
|
||||||
|
"sqlls",
|
||||||
|
--"sqls",
|
||||||
|
--"svelte",
|
||||||
|
"taplo",
|
||||||
|
--"tailwindcss",
|
||||||
|
--"tflint", -- going to use tsserver first
|
||||||
|
"lemminx",
|
||||||
|
"yamlls",
|
||||||
|
"zls",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name in pairs(lang_servers) do
|
||||||
|
local server_is_found, server = lsp_installer.get_server(name)
|
||||||
|
if server_is_found then
|
||||||
|
if not server:is_installed() then
|
||||||
|
print("Installing " .. name)
|
||||||
|
server:install()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lsp_installer.on_server_ready(function(server)
|
||||||
|
local opts = {}
|
||||||
|
opts.on_attach = on_attach
|
||||||
|
opts.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
|
server:setup(opts)
|
||||||
|
vim.cmd [[ do User LspAttachBuffers ]]
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
lsp_installer.settings({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
server_installed = "✓",
|
||||||
|
server_pending = "➜",
|
||||||
|
server_uninstalled = "✗"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -1,8 +1,58 @@
|
||||||
require "paq" {
|
require "paq" {
|
||||||
"savq/paq-nvim"; -- Let Paq manage itself
|
-- let paq manage itself
|
||||||
|
"savq/paq-nvim";
|
||||||
|
|
||||||
|
-- lsp
|
||||||
"neovim/nvim-lspconfig";
|
"neovim/nvim-lspconfig";
|
||||||
"hrsh7th/nvim-compe";
|
{"williamboman/nvim-lsp-installer", branch="dont-prepare-root-dir"};
|
||||||
|
|
||||||
|
-- cmp
|
||||||
|
"hrsh7th/nvim-cmp";
|
||||||
|
"hrsh7th/cmp-nvim-lsp";
|
||||||
|
"hrsh7th/cmp-buffer";
|
||||||
|
"hrsh7th/cmp-path";
|
||||||
|
"hrsh7th/cmp-cmdline";
|
||||||
|
"hrsh7th/cmp-nvim-lua";
|
||||||
|
"hrsh7th/cmp-calc";
|
||||||
|
"hrsh7th/cmp-emoji";
|
||||||
|
"hrsh7th/cmp-latex-symbols";
|
||||||
|
"octaltree/cmp-look";
|
||||||
|
{"tzachar/cmp-tabnine", run="./install.sh"};
|
||||||
|
|
||||||
|
-- lua snips
|
||||||
|
"L3MON4D3/LuaSnip";
|
||||||
|
"saadparwaiz1/cmp_luasnip";
|
||||||
|
|
||||||
|
-- diagnostics
|
||||||
|
"folke/trouble.nvim";
|
||||||
|
"kyazdani42/nvim-web-devicons";
|
||||||
|
|
||||||
|
-- pandoc
|
||||||
|
"vim-pandoc/vim-pandoc";
|
||||||
|
|
||||||
|
-- zig ls
|
||||||
|
"zigtools/zls";
|
||||||
|
|
||||||
|
-- theme
|
||||||
|
"rakr/vim-one";
|
||||||
|
|
||||||
|
"mattn/emmet-vim";
|
||||||
--{"lervag/vimtex", opt=true};
|
--{"lervag/vimtex", opt=true};
|
||||||
|
|
||||||
|
-- tree sitter
|
||||||
|
"nvim-treesitter/nvim-treesitter";
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects";
|
||||||
|
"ray-x/cmp-treesitter";
|
||||||
|
|
||||||
|
"lukas-reineke/indent-blankline.nvim";
|
||||||
|
|
||||||
|
"kosayoda/nvim-lightbulb";
|
||||||
|
|
||||||
|
"turbio/bracey.vim";
|
||||||
|
|
||||||
|
-- git symbols
|
||||||
|
"lewis6991/gitsigns.nvim";
|
||||||
|
"nvim-lua/plenary.nvim";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd 'PaqSync'
|
||||||
|
|
26
lua/tree-sitter.lua
Normal file
26
lua/tree-sitter.lua
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
cmd [[
|
||||||
|
TSInstall bash
|
||||||
|
TSInstall bibtex
|
||||||
|
TSInstall c
|
||||||
|
TSInstall cmake
|
||||||
|
TSInstall cpp
|
||||||
|
TSInstall css
|
||||||
|
TSInstall dockerfile
|
||||||
|
TSInstall dot
|
||||||
|
TSInstall graphql
|
||||||
|
TSInstall html
|
||||||
|
TSInstall http
|
||||||
|
TSInstall javascript
|
||||||
|
TSInstall latex
|
||||||
|
TSInstall llvm
|
||||||
|
TSInstall lua
|
||||||
|
TSInstall make
|
||||||
|
TSInstall python
|
||||||
|
TSInstall regex
|
||||||
|
TSInstall verilog
|
||||||
|
TSInstall vim
|
||||||
|
TSInstall yaml
|
||||||
|
TSInstall zig
|
||||||
|
TSUpdate
|
||||||
|
]]
|
||||||
|
|
|
@ -30,8 +30,8 @@ o.showmatch = true -- matching bracket
|
||||||
|
|
||||||
|
|
||||||
-- Completion Menu
|
-- Completion Menu
|
||||||
o.wildmenu = true
|
--o.wildmenu = true
|
||||||
o.wildmode = 'list:longest,full'
|
--o.wildmode = 'list:longest,full'
|
||||||
|
|
||||||
|
|
||||||
-- Character Representation
|
-- Character Representation
|
||||||
|
@ -104,6 +104,9 @@ autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929
|
||||||
autocmd BufEnter * match OverLength /\%71v.*/
|
autocmd BufEnter * match OverLength /\%71v.*/
|
||||||
]]) --rewrite in lua
|
]]) --rewrite in lua
|
||||||
|
|
||||||
|
-- Theme
|
||||||
|
o.background = "light"
|
||||||
|
cmd('colorscheme one')
|
||||||
|
|
||||||
--WIP
|
--WIP
|
||||||
-- Filetype: txt, md, tex
|
-- Filetype: txt, md, tex
|
||||||
|
|
|
@ -31,27 +31,30 @@ local function file_state()
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local function diagnostics()
|
--local function diagnostics()
|
||||||
local buffer_number = vim.fn.bufnr('%')
|
-- --local buffer_number = vim.fn.bufnr('%')
|
||||||
local severity_levels = {
|
-- local severity_levels = {
|
||||||
-- level,prefix
|
-- -- level,prefix
|
||||||
errors = {'Error', 'E:'},
|
-- errors = {'Error', 'E:'},
|
||||||
warnings = {'Warning', 'W:'},
|
-- warnings = {'Warning', 'W:'},
|
||||||
info = {'Information', 'I:'},
|
-- info = {'Information', 'I:'},
|
||||||
hints = {'Hint', 'H:'}
|
-- hints = {'Hint', 'H:'}
|
||||||
}
|
-- }
|
||||||
local out = ''
|
-- local out = ''
|
||||||
for _,v in pairs(severity_levels) do
|
-- for _,v in pairs(severity_levels) do
|
||||||
local d = vim.lsp.diagnostic.get_count(
|
-- local d = vim.diagnostic.get(
|
||||||
buffer_number,
|
-- 0,
|
||||||
v[1] -- level
|
-- )
|
||||||
)
|
-- --local d = vim.lsp.diagnostic.get_count(
|
||||||
if d > 0 then
|
-- -- buffer_number,
|
||||||
out = out .. v[2] .. d .. ' '
|
-- -- v[1] -- level
|
||||||
end
|
-- --)
|
||||||
end
|
-- if d > 0 then
|
||||||
return out
|
-- out = out .. v[2] .. d .. ' '
|
||||||
end
|
-- end
|
||||||
|
-- end
|
||||||
|
-- return out
|
||||||
|
--end
|
||||||
|
|
||||||
local function highlight(group, color)
|
local function highlight(group, color)
|
||||||
cmd('highlight ' .. group .. ' cterm='..color .. ' gui='..color)
|
cmd('highlight ' .. group .. ' cterm='..color .. ' gui='..color)
|
||||||
|
@ -100,7 +103,7 @@ function status_bar()
|
||||||
return table.concat(sections({
|
return table.concat(sections({
|
||||||
-- Stage Left
|
-- Stage Left
|
||||||
{'%f', file_state()},
|
{'%f', file_state()},
|
||||||
{diagnostics()},
|
--{diagnostics()},
|
||||||
'%=',
|
'%=',
|
||||||
-- Stage Right
|
-- Stage Right
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue