Remove .config/nvim/conf.d/config.lua

Remove .config/nvim/conf.d/lsp.lua
Remove .config/nvim/conf.d/tree-sitter.lua
This commit is contained in:
Anthony Rodriguez 2024-07-25 15:05:55 +02:00
parent b76cef8ca5
commit eb400f5812
3 changed files with 0 additions and 134 deletions

View file

@ -1,15 +0,0 @@
-- general settings
vim.cmd.colorscheme "catppuccin-frappe"
vim.g.mapleader = " "
vim.wo.relativenumber = true
-- CHADTree
vim.api.nvim_set_keymap('n', '<leader>v', '<cmd>CHADopen<CR>', { noremap = true, silent = true })
-- Telescope
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

View file

@ -1,78 +0,0 @@
-- LSP settings
vim.g.coq_settings = { auto_start = 'shut-up' }
local coq = require "coq"
-- Function to get root directory
local function get_root_dir(fname, patterns)
local dir = vim.fs.dirname(fname)
for _, pattern in ipairs(patterns) do
local match = vim.fn.globpath(dir, pattern)
if match ~= "" then
return dir
end
end
return nil
end
-- Function to start LSP
local function start_lsp(server_name, cmd, patterns)
return function(args)
local root_dir = get_root_dir(vim.api.nvim_buf_get_name(args.buf), patterns)
if root_dir then
vim.lsp.start(coq.lsp_ensure_capabilities({
name = server_name,
cmd = cmd,
root_dir = root_dir,
}))
end
end
end
-- Create autocommands for different file types
vim.api.nvim_create_autocmd('FileType', {
pattern = 'python',
callback = start_lsp('pyright', {'pyright-langserver', '--stdio'}, {'setup.py', 'pyproject.toml'})
})
vim.api.nvim_create_autocmd('FileType', {
pattern = {'javascript', 'typescript'},
callback = start_lsp('tsserver', {'typescript-language-server', '--stdio'}, {'package.json', 'tsconfig.json'})
})
vim.api.nvim_create_autocmd('FileType', {
pattern = 'go',
callback = start_lsp('gopls', {'gopls'}, {'go.mod'})
})
-- Enable signature completion
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if vim.tbl_contains({ 'null-ls' }, client.name) then -- blacklist lsp
return
end
require("lsp_signature").on_attach({
-- ... setup options here ...
}, bufnr)
end,
})
-- Function to format the current buffer on save
local function lsp_format_on_save(bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
-- Create an autocmd for LspAttach event
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local bufnr = args.buf
-- Set up the buffer-local autocmd for formatting on save
lsp_format_on_save(bufnr)
end,
})

View file

@ -1,41 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}