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

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

@ -12,13 +12,24 @@ local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
sources = { sources = {
null_ls.builtins.formatting.autopep8, require("null-ls-embedded").nls_source,
null_ls.builtins.formatting.nimpretty, 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({ require("mason-null-ls").setup({
automatic_installation = true automatic_installation = true,
ensure_installed = {}
}) })
-- Add additional capabilities supported by nvim-cmp -- Add additional capabilities supported by nvim-cmp
@ -79,67 +90,37 @@ cmp.setup {
luasnip = "[SNIP]", luasnip = "[SNIP]",
}, },
symbol_map = { symbol_map = {
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 = ""
}, },
}), }),
}, },
} }
require("luasnip.loaders.from_snipmate").lazy_load() 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 -- neovim/nvim-lspconfig
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
@ -164,3 +145,14 @@ require'lspconfig'.jdtls.setup{
}, },
cmd = { 'jdtls' } 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