This commit is contained in:
Oluwatobi 2023-10-31 12:00:00 +01:00
parent 2100726468
commit 3a76bbf0c6
14 changed files with 397 additions and 178 deletions

View file

@ -0,0 +1,46 @@
require('catppuccin').setup {
flavour = 'macchiato', -- mocha, frappe, latte, mocha
background = { -- :h background
light = 'latte',
dark = 'mocha',
},
transparent_background = false, -- disables setting the background color.
show_end_of_buffer = false, -- shows the '~' characters after the end of buffers
term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`)
dim_inactive = {
enabled = false, -- dims the background color of inactive window
shade = 'dark',
percentage = 0.15, -- percentage of the shade to apply to the inactive window
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
no_underline = false, -- Force no underline
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
comments = { 'italic' }, -- Change the style of comments
conditionals = { 'italic' },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
color_overrides = {},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = false,
mini = {
enabled = true,
indentscope_color = '',
},
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
},
}

View file

@ -1,5 +1,6 @@
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
vim.api.nvim_set_hl(0, 'CmpGhostText', { link = 'Comment', default = true })
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
@ -43,5 +44,9 @@ cmp.setup {
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{
{ name = 'buffer' },
},
},
}

View file

@ -42,9 +42,6 @@ lsp.set_preferences {
lsp.on_attach(function(_, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set('n', 'gd', function()
vim.lsp.buf.definition()
end, opts)
vim.keymap.set('n', 'gD', function()
vim.lsp.buf.declaration()
end, opts)
@ -57,23 +54,39 @@ lsp.on_attach(function(_, bufnr)
vim.keymap.set('n', '<leader>vd', function()
vim.diagnostic.open_float()
end, opts)
vim.keymap.set('n', '[d', function()
vim.diagnostic.goto_next()
end, opts)
vim.keymap.set('n', ']d', function()
vim.diagnostic.goto_prev()
end, opts)
vim.keymap.set('n', '<leader>ca', function()
vim.lsp.buf.code_action()
end, opts)
vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts)
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
vim.keymap.set('n', '<leader>rn', function()
vim.lsp.buf.rename()
end, opts)
--[[ vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) ]]
vim.keymap.set('n', '<leader>lf', function()
require('conform').format()
end, { desc = 'Format Buffer' })
-- Add WorkSpace
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
-- Remove WorkSpace
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
-- List WorkSpace
vim.keymap.set('n', '<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
end)
lsp.setup()

View file

@ -0,0 +1,39 @@
require('mini.comment').setup {
-- Options which control module behavior
options = {
-- Function to compute custom 'commentstring' (optional)
custom_commentstring = function()
return require('ts_context_commentstring.internal').calculate_commentstring() or vim.bo.commentstring
end,
-- Whether to ignore blank lines
ignore_blank_line = false,
-- Whether to recognize as comment only lines without indent
start_of_line = false,
-- Whether to ensure single space pad for comment parts
pad_comment_parts = true,
},
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
-- Toggle comment (like `gcip` - comment inner paragraph) for both
-- Normal and Visual modes
comment = '++',
-- Toggle comment on current line
comment_line = '++',
-- Define 'comment' textobject (like `dgc` - delete whole comment block)
textobject = '++',
},
-- Hook functions to be executed at certain stage of commenting
hooks = {
-- Before successful commenting. Does nothing by default.
pre = function() end,
-- After successful commenting. Does nothing by default.
post = function() end,
},
}

View file

@ -19,9 +19,25 @@
}
end, 0) ]]
require'nvim-treesitter.configs'.setup {
require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all"
ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust", "go", "python", "tsx", "vim" },
ensure_installed = {
'c',
'css',
'lua',
'rust',
'go',
'python',
'vim',
'vimdoc',
'tsx',
'html',
'javascript',
'typescript',
},
context_commentstring = {
enable = true,
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
@ -40,4 +56,59 @@ require'nvim-treesitter.configs'.setup {
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}

View file

@ -0,0 +1 @@
require('ts_context_commentstring').setup {}