Special treatment for .txt and .md files
This commit is contained in:
parent
f266777b2b
commit
f45414fe0e
@ -5,6 +5,8 @@ local lsp = require('lsp-zero').preset({})
|
||||
|
||||
lsp.on_attach(function(_, bufnr)
|
||||
lsp.default_keymaps({buffer = bufnr})
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
|
||||
end)
|
||||
|
||||
local lsp_config = require('lspconfig')
|
||||
|
18
lua/cam123/autocmd.lua
Normal file
18
lua/cam123/autocmd.lua
Normal file
@ -0,0 +1,18 @@
|
||||
vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
|
||||
pattern = "*.txt,*.md",
|
||||
callback = function ()
|
||||
vim.api.nvim_set_option_value("spell", true, { scope = "local" })
|
||||
vim.api.nvim_set_option_value("wrap", true, { scope = "local" })
|
||||
vim.api.nvim_set_option_value("linebreak", true, { scope = "local" })
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWrite", {
|
||||
callback = function (opts)
|
||||
local filetype = vim.bo[opts.buf].filetype
|
||||
if filetype == "text" or filetype == "markdown" then
|
||||
return
|
||||
end
|
||||
vim.api.nvim_exec2("%s/[ \\t]\\+$//e", { output = false })
|
||||
end
|
||||
})
|
@ -1,4 +1,5 @@
|
||||
require("cam123.set")
|
||||
require("cam123.autocmd")
|
||||
require("cam123.remap")
|
||||
require("cam123.lazy")
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
vim.keymap.set("n", "<Escape>", function () vim.opt.hlsearch = false end)
|
||||
|
Loading…
Reference in New Issue
Block a user