initial commit
This commit is contained in:
commit
23d4795228
99 changed files with 6691 additions and 0 deletions
1
config/nvim/after/ftplugin/c.lua
Normal file
1
config/nvim/after/ftplugin/c.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.o.shiftwidth = 2
|
||||
1
config/nvim/after/ftplugin/cpp.lua
Normal file
1
config/nvim/after/ftplugin/cpp.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.opt.indentkeys:remove(':')
|
||||
2
config/nvim/after/ftplugin/fugitive.lua
Normal file
2
config/nvim/after/ftplugin/fugitive.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bmap({ 'n', '<leader>Gh', '<cmd>diffget //2<cr>' })
|
||||
bmap({ 'n', '<leader>Gl', '<cmd>diffget //3<cr>' })
|
||||
5
config/nvim/after/ftplugin/help.lua
Normal file
5
config/nvim/after/ftplugin/help.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
vim.o.number = true
|
||||
vim.o.conceallevel = 0
|
||||
vim.o.relativenumber = true
|
||||
|
||||
bmap({ 'n', 'q', vim.cmd.helpclose })
|
||||
2
config/nvim/after/ftplugin/html.lua
Normal file
2
config/nvim/after/ftplugin/html.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
vim.o.shiftwidth = 2
|
||||
vim.o.textwidth = 80
|
||||
1
config/nvim/after/ftplugin/htmldjango.lua
Normal file
1
config/nvim/after/ftplugin/htmldjango.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.o.shiftwidth = 2
|
||||
2
config/nvim/after/ftplugin/javascript.lua
Normal file
2
config/nvim/after/ftplugin/javascript.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
vim.o.shiftwidth = 2
|
||||
vim.o.makeprg = 'node %'
|
||||
2
config/nvim/after/ftplugin/man.lua
Normal file
2
config/nvim/after/ftplugin/man.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
2
config/nvim/after/ftplugin/markdown.lua
Normal file
2
config/nvim/after/ftplugin/markdown.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
vim.o.conceallevel = 1
|
||||
vim.o.textwidth = 80
|
||||
1
config/nvim/after/ftplugin/python.lua
Normal file
1
config/nvim/after/ftplugin/python.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.o.makeprg = 'python %'
|
||||
1
config/nvim/after/ftplugin/rust.lua
Normal file
1
config/nvim/after/ftplugin/rust.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.o.makeprg = 'cargo run'
|
||||
1
config/nvim/after/ftplugin/sh.lua
Normal file
1
config/nvim/after/ftplugin/sh.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.o.makeprg = 'sh %'
|
||||
103
config/nvim/after/plugin/lsp.lua
Normal file
103
config/nvim/after/plugin/lsp.lua
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
local lsp = require('config.lsp')
|
||||
|
||||
vim.diagnostic.config({
|
||||
signs = false,
|
||||
float = {
|
||||
format = function(diagnostic)
|
||||
return ('%s (%s)'):format(diagnostic.message, diagnostic.source)
|
||||
end,
|
||||
header = '',
|
||||
prefix = ' ',
|
||||
},
|
||||
jump = { float = true },
|
||||
})
|
||||
|
||||
local function prepare_capabilities()
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = false
|
||||
|
||||
local ok, blink = pcall(require, 'blink.cmp')
|
||||
|
||||
return ok and blink.get_lsp_capabilities(capabilities) or capabilities
|
||||
end
|
||||
|
||||
vim.lsp.config('*', {
|
||||
on_attach = lsp.on_attach,
|
||||
capabilities = prepare_capabilities(),
|
||||
flags = { debounce_text_changes = 0 },
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(opts)
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
|
||||
if
|
||||
client
|
||||
and (
|
||||
client:supports_method('textDocument/formatting')
|
||||
or client:supports_method('formatting')
|
||||
)
|
||||
then
|
||||
local modes = { 'n' }
|
||||
|
||||
if
|
||||
client:supports_method('textDocument/rangeFormatting')
|
||||
or client:supports_method('rangeFormatting')
|
||||
then
|
||||
table.insert(modes, 'x')
|
||||
end
|
||||
|
||||
bmap({
|
||||
modes,
|
||||
'gF',
|
||||
lsp.format,
|
||||
}, { buffer = opts.buf, silent = false })
|
||||
end
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup('ALspFormat', { clear = true }),
|
||||
})
|
||||
|
||||
for _, server in ipairs({
|
||||
'bashls',
|
||||
'basedpyright',
|
||||
'clangd',
|
||||
'cssls',
|
||||
'emmet_language_server',
|
||||
'eslint',
|
||||
'html',
|
||||
'mdx_analyzer',
|
||||
'jsonls',
|
||||
'vtsls',
|
||||
'pytest_lsp',
|
||||
'lua_ls',
|
||||
'ruff',
|
||||
'tinymist',
|
||||
}) do
|
||||
local ok, config = pcall(require, 'lsp.' .. server)
|
||||
if ok and config then
|
||||
vim.lsp.config(server, config)
|
||||
else
|
||||
vim.lsp.config(server, {})
|
||||
end
|
||||
vim.lsp.enable(server)
|
||||
end
|
||||
|
||||
-- remove duplicate entries from goto defintion list
|
||||
-- example: https://github.com/LuaLS/lua-language-server/issues/2451
|
||||
local locations_to_items = vim.lsp.util.locations_to_items
|
||||
vim.lsp.util.locations_to_items = function(locations, offset_encoding)
|
||||
local lines = {}
|
||||
local loc_i = 1
|
||||
for _, loc in ipairs(vim.deepcopy(locations)) do
|
||||
local uri = loc.uri or loc.targetUri
|
||||
local range = loc.range or loc.targetSelectionRange
|
||||
if lines[uri .. range.start.line] then
|
||||
table.remove(locations, loc_i)
|
||||
else
|
||||
loc_i = loc_i + 1
|
||||
end
|
||||
lines[uri .. range.start.line] = true
|
||||
end
|
||||
|
||||
return locations_to_items(locations, offset_encoding)
|
||||
end
|
||||
5
config/nvim/after/queries/html/highlights.scm.disabled
Normal file
5
config/nvim/after/queries/html/highlights.scm.disabled
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
;; extends
|
||||
(attribute (attribute_name) @att_name (#eq? @att_name "class")
|
||||
(quoted_attribute_value (attribute_value) @att_val (#set! @att_val conceal ".")
|
||||
)
|
||||
)
|
||||
5
config/nvim/after/queries/javascript/highlights.scm
Normal file
5
config/nvim/after/queries/javascript/highlights.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
;; extends
|
||||
(jsx_attribute (property_identifier) @att_name (#eq? @att_name "className")
|
||||
(string (string_fragment) @att_val (#set! @att_val conceal ".")
|
||||
)
|
||||
)
|
||||
2
config/nvim/after/queries/jsx/highlights.scm
Normal file
2
config/nvim/after/queries/jsx/highlights.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
;; inherits: jsx
|
||||
;; extends
|
||||
2
config/nvim/after/queries/tsx/highlights.scm
Normal file
2
config/nvim/after/queries/tsx/highlights.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
;; inherits: jsx
|
||||
;; extends
|
||||
Loading…
Add table
Add a link
Reference in a new issue