feat(config): add config example for utils
This commit is contained in:
parent
9ced86d6bc
commit
0d3e6a0ad2
6 changed files with 24 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ lua/cosmic/config/editor.lua
|
|||
lua/cosmic/config/config.lua
|
||||
lua/cosmic/config/mappings.lua
|
||||
lua/cosmic/config/plugins.lua
|
||||
lua/cosmic/config/utils.lua
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
-- Override Cosmic configuration options
|
||||
|
||||
--[[
|
||||
-- You can require null-ls if needed
|
||||
-- local null_ls = require('null-ls')
|
||||
|
||||
|
@ -33,9 +32,6 @@ config.lsp = {
|
|||
|
||||
servers = {
|
||||
|
||||
-- enable/disable server + formatting
|
||||
eslint = false,
|
||||
|
||||
-- enable non-default servers, use default lsp config
|
||||
-- check here for configs that will be used by default: https://github.com/williamboman/nvim-lsp-installer/tree/main/lua/nvim-lsp-installer/servers
|
||||
rust_analyzer = true,
|
||||
|
@ -48,18 +44,16 @@ config.lsp = {
|
|||
on_attach = function(client, bufnr) end,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- See Cosmic defaults lsp/providers/null_ls.lua
|
||||
null_ls = {}
|
||||
null_ls = {},
|
||||
},
|
||||
|
||||
-- See Cosmic defaults lsp/providers/tsserver.lua
|
||||
ts_utils = {}
|
||||
ts_utils = {},
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
]]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
-- Override Cosmic editor options
|
||||
--[[
|
||||
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
|
@ -9,5 +7,3 @@ g.mapleader = ','
|
|||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
|
||||
]]
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
-- To view maps set, use `:Telescope keymaps`
|
||||
-- or `:map`, `:map <leader>`
|
||||
|
||||
--[[
|
||||
|
||||
local cmd = vim.cmd
|
||||
local map = require('cosmic.utils').map
|
||||
|
||||
|
@ -18,5 +16,3 @@ map('i', 'jj', '<esc>', { noremap = true, silent = true })
|
|||
|
||||
-- Example: Disable find files keymap
|
||||
cmd('unmap <leader>f')
|
||||
|
||||
--]]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
-- Add additional plugins as well as disable some core plugins
|
||||
|
||||
--[[
|
||||
|
||||
local plugins = {
|
||||
add = {
|
||||
'ggandor/lightspeed.nvim',
|
||||
|
@ -29,5 +27,3 @@ local plugins = {
|
|||
}
|
||||
|
||||
return plugins
|
||||
|
||||
]]
|
||||
|
|
19
lua/cosmic/config/examples/utils.lua
Normal file
19
lua/cosmic/config/examples/utils.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- attach any functions you want to use to M
|
||||
local M = {}
|
||||
local diagnostics_active = true
|
||||
|
||||
function M.toggle_diagnostics()
|
||||
if diagnostics_active then
|
||||
vim.diagnostic.disable()
|
||||
diagnostics_active = false
|
||||
else
|
||||
vim.diagnostic.enable()
|
||||
diagnostics_active = true
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
-- In config/mappings.lua
|
||||
-- local map = require('cosmic.utils').map
|
||||
-- map('n', '<leader>tt', '<cmd>lua require("cosmic.config.utils").toggle_diagnostics()<cr>')
|
Loading…
Add table
Reference in a new issue