nvim: expanded null ls to markdown and embeded code

master
tiyn 1 year ago
parent 933819855f
commit edd82ee7d9

@ -1,3 +1,5 @@
-- autocmd
-- read files correctly
vim.filetype.add({
extension = {
@ -19,7 +21,7 @@ vim.api.nvim_create_autocmd({'BufWritePre'},
command = [[%s/\s\+$//e]],
})
-- c
-- settings for filetype: c
vim.api.nvim_create_autocmd({'VimLeave'},
{pattern = {'c'},
@ -31,7 +33,7 @@ vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
command = 'set colorcolumn=80'
})
-- java
-- settings for filetype: java
vim.api.nvim_create_autocmd({'FileType'},
{pattern = {'java'},
@ -43,14 +45,14 @@ vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
command = 'set colorcolumn=100'
})
-- javascript
-- settings for filetype: javascript
vim.api.nvim_create_autocmd({'FileType'},
{pattern = {'javascript'},
command = 'setlocal shiftwidth=2 softtabstop=2',
})
-- lua
-- settings for filetype: lua
vim.api.nvim_create_autocmd({'FileType'},
{pattern = {'lua'},
@ -62,7 +64,7 @@ vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
command = 'set colorcolumn=100'
})
-- markdown
-- settings for filetype: markdown
vim.api.nvim_create_autocmd({'FileType'},
{pattern = {'markdown'},
@ -79,21 +81,21 @@ vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
command = 'set conceallevel=2'
})
-- nim
-- settings for filetype: nim
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
{pattern = {'nim'},
command = 'set colorcolumn=80'
})
-- python
-- settings for filetype: python
vim.api.nvim_create_autocmd({'BufEnter', 'FileType'},
{pattern = {'python'},
command = 'set colorcolumn=80'
})
-- tex
-- settings for filetype: tex
vim.api.nvim_create_autocmd({'VimLeave'},
{pattern = {'tex'},

@ -56,6 +56,7 @@ return require("packer").startup(function(use)
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'jose-elias-alvarez/null-ls.nvim',
'LostNeophyte/null-ls-embedded',
'nvim-lua/plenary.nvim',
'jay-babu/mason-null-ls.nvim'}}

@ -12,13 +12,24 @@ local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.autopep8,
null_ls.builtins.formatting.nimpretty,
require("null-ls-embedded").nls_source,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.mdformat,
},
})
require("null-ls").setup({
sources = {
require("null-ls-embedded").nls_source.with({
-- default filetypes:
filetypes = { "markdown" },
}),
},
})
require("mason-null-ls").setup({
automatic_installation = true
automatic_installation = true,
ensure_installed = {}
})
-- Add additional capabilities supported by nvim-cmp
@ -79,67 +90,37 @@ cmp.setup {
luasnip = "[SNIP]",
},
symbol_map = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Text = "",
Method = "",
Function = "φ",
Constructor = "",
Field = "",
Variable = "β",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "π",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
Operator = "",
TypeParameter = ""
},
}),
},
}
require("luasnip.loaders.from_snipmate").lazy_load()
-- local on_attach = function(client, bufnr)
-- if client.server_capabilities.documentHighlightProvider then
-- vim.cmd [[
-- hi! LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
-- hi! LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
-- hi! LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
-- ]]
-- vim.api.nvim_create_augroup('lsp_document_highlight', {
-- clear = false
-- })
-- vim.api.nvim_clear_autocmds({
-- buffer = bufnr,
-- group = 'lsp_document_highlight',
-- })
-- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
-- group = 'lsp_document_highlight',
-- buffer = bufnr,
-- callback = vim.lsp.buf.document_highlight,
-- })
-- vim.api.nvim_create_autocmd('CursorMoved', {
-- group = 'lsp_document_highlight',
-- buffer = bufnr,
-- callback = vim.lsp.buf.clear_references,
-- })
-- end
-- end
--
-- vim.g.cursorhold_updatetime = 100
-- neovim/nvim-lspconfig
local nvim_lsp = require('lspconfig')
@ -163,4 +144,15 @@ require'lspconfig'.jdtls.setup{
debounce_text_changes = 150
},
cmd = { 'jdtls' }
}
}
require'lspconfig'.lua_ls.setup {
settings = {
Lua = {
runtime = { version = 'LuaJIT' },
diagnostics = { globals = {'vim'} },
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false },
},
},
}

Loading…
Cancel
Save