From fd98a6b7054e10cc7fd11712f4f6ed2ad63357fe Mon Sep 17 00:00:00 2001 From: Darius Auding <Darius.auding@gmx.de> Date: Fri, 24 Mar 2023 13:53:08 +0100 Subject: [PATCH] Add Configuration --- .gitignore | 2 + init.lua | 38 +++++ lua/codecraft/core/colorscheme.lua | 56 ++++++ lua/codecraft/core/keymaps.lua | 77 +++++++++ lua/codecraft/core/options.lua | 63 +++++++ lua/codecraft/plugin-setup.lua | 160 ++++++++++++++++++ lua/codecraft/plugin/alpha.lua | 74 ++++++++ lua/codecraft/plugin/bufferline.lua | 26 +++ lua/codecraft/plugin/chatgpt.lua | 70 ++++++++ lua/codecraft/plugin/dap/dap.lua | 11 ++ lua/codecraft/plugin/dap/dapui.lua | 100 +++++++++++ lua/codecraft/plugin/dap/virtual-text.lua | 26 +++ lua/codecraft/plugin/gitsigns.lua | 42 +++++ lua/codecraft/plugin/indent-comments.lua | 10 ++ lua/codecraft/plugin/lsp/completion.lua | 43 +++++ lua/codecraft/plugin/lsp/lsp.lua | 112 ++++++++++++ lua/codecraft/plugin/lsp/navic.lua | 39 +++++ lua/codecraft/plugin/lsp/null-ls.lua | 38 +++++ lua/codecraft/plugin/lualine.lua | 17 ++ lua/codecraft/plugin/neodev.lua | 3 + lua/codecraft/plugin/nvimtree.lua | 42 +++++ lua/codecraft/plugin/projects.lua | 49 ++++++ lua/codecraft/plugin/telescope.lua | 50 ++++++ lua/codecraft/plugin/tmux-nvim-navigation.lua | 3 + lua/codecraft/plugin/treesitter.lua | 63 +++++++ lua/codecraft/utils/defaults.lua | 3 + lua/codecraft/utils/icons.lua | 155 +++++++++++++++++ lua/codecraft/vimlocale.lua | 2 + 28 files changed, 1374 insertions(+) create mode 100644 .gitignore create mode 100644 init.lua create mode 100644 lua/codecraft/core/colorscheme.lua create mode 100644 lua/codecraft/core/keymaps.lua create mode 100644 lua/codecraft/core/options.lua create mode 100644 lua/codecraft/plugin-setup.lua create mode 100644 lua/codecraft/plugin/alpha.lua create mode 100644 lua/codecraft/plugin/bufferline.lua create mode 100644 lua/codecraft/plugin/chatgpt.lua create mode 100644 lua/codecraft/plugin/dap/dap.lua create mode 100644 lua/codecraft/plugin/dap/dapui.lua create mode 100644 lua/codecraft/plugin/dap/virtual-text.lua create mode 100644 lua/codecraft/plugin/gitsigns.lua create mode 100644 lua/codecraft/plugin/indent-comments.lua create mode 100644 lua/codecraft/plugin/lsp/completion.lua create mode 100644 lua/codecraft/plugin/lsp/lsp.lua create mode 100644 lua/codecraft/plugin/lsp/navic.lua create mode 100644 lua/codecraft/plugin/lsp/null-ls.lua create mode 100644 lua/codecraft/plugin/lualine.lua create mode 100644 lua/codecraft/plugin/neodev.lua create mode 100644 lua/codecraft/plugin/nvimtree.lua create mode 100644 lua/codecraft/plugin/projects.lua create mode 100644 lua/codecraft/plugin/telescope.lua create mode 100644 lua/codecraft/plugin/tmux-nvim-navigation.lua create mode 100644 lua/codecraft/plugin/treesitter.lua create mode 100644 lua/codecraft/utils/defaults.lua create mode 100644 lua/codecraft/utils/icons.lua create mode 100644 lua/codecraft/vimlocale.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8fad781 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/plugin +log diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a84fd32 --- /dev/null +++ b/init.lua @@ -0,0 +1,38 @@ +-- leader +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- load locale +require('codecraft.vimlocale') + +-- load plugins +require('codecraft.plugin-setup') + +-- core codecrafturation +require('codecraft.core.options') +require('codecraft.core.keymaps') +require('codecraft.core.colorscheme') + +-- plugin codecrafturation +require('codecraft.plugin.chatgpt') +require('codecraft.plugin.bufferline') +require('codecraft.plugin.nvimtree') +require('codecraft.plugin.gitsigns') +require('codecraft.plugin.lualine') +require('codecraft.plugin.telescope') +require('codecraft.plugin.treesitter') +require('codecraft.plugin.indent-comments') +require('codecraft.plugin.neodev') +require('codecraft.plugin.tmux-nvim-navigation') +require('codecraft.plugin.projects') + +-- LSP +require('codecraft.plugin.lsp.navic') +require('codecraft.plugin.lsp.lsp') +require('codecraft.plugin.lsp.completion') +require('codecraft.plugin.lsp.null-ls') + +-- DAP +require('codecraft.plugin.dap.dap') +require('codecraft.plugin.dap.virtual-text') +require('codecraft.plugin.dap.dapui') diff --git a/lua/codecraft/core/colorscheme.lua b/lua/codecraft/core/colorscheme.lua new file mode 100644 index 0000000..43eae9d --- /dev/null +++ b/lua/codecraft/core/colorscheme.lua @@ -0,0 +1,56 @@ +-- gruvbox +-- vim.cmd[[colorscheme gruvbox]] +-- tokyonight +-- vim.cmd[[colorscheme tokyonight]] +-- vim.cmd[[colorscheme tokyonight-night]] +-- vim.cmd[[colorscheme tokyonight-storm]] +-- vim.cmd[[colorscheme tokyonight-day]] +-- vim.cmd[[colorscheme tokyonight-moon]] + +-- LUNAR +vim.cmd[[colorscheme lunar]] + +-- ONEDARK +-- Set colorscheme +-- config +require('onedark').setup { + -- Main options -- + style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' + transparent = true, -- Show/hide background + term_colors = false, -- Change terminal color as per the selected theme style + ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden + cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu + + -- toggle theme style --- + toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts" + toggle_style_list = { 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light' }, -- List of styles to toggle between + + -- Change code style --- + -- Options are italic, bold, underline, none + -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' + code_style = { + comments = 'italic', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'none' + }, + + -- Lualine options -- + lualine = { + transparent = true, -- lualine center bar transparency + }, + + -- Custom Highlights -- + colors = {}, -- Override default colors + highlights = {}, -- Override highlight groups + + -- Plugins Config -- + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = false, -- use background color for virtual text + }, +} + +-- vim.cmd[[colorscheme onedark]] diff --git a/lua/codecraft/core/keymaps.lua b/lua/codecraft/core/keymaps.lua new file mode 100644 index 0000000..2db0773 --- /dev/null +++ b/lua/codecraft/core/keymaps.lua @@ -0,0 +1,77 @@ +local map = vim.keymap + +-- Keymaps for better default experience +map.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) + +-- end of line semicolon and comma +map.set('n', ';', 'A;<ESC>') +map.set('n', ',', 'A,<ESC>') + +-- Remap for dealing with word wrap +-- map.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +-- map.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- exit terminal mode +map.set('t', '<ESC>', '<C-\\><C-n>') + +-- WINDOWS +map.set('n', '<C-p>', '<C-w>v') -- vertical split +map.set('n', '<C-i>', '<C-w>s') -- horizontal split +-- moving +map.set('n', '<C-h>', '<CMD>NvimTmuxNavigateLeft<CR>') +map.set('n', '<C-j>', '<CMD>NvimTmuxNavigateDown<CR>') +map.set('n', '<C-k>', '<CMD>NvimTmuxNavigateUp<CR>') +map.set('n', '<C-l>', '<CMD>NvimTmuxNavigateRight<CR>') +-- map.set('n', '<C-\\>', '<Cmd>NvimTmuxNavigateLastActive<CR>') +-- map.set('n', '<C-Space>', '<Cmd>NvimTmuxNavigateNext<CR>') + +-- Diagnostic keymaps +map.set('n', '[d', vim.diagnostic.goto_prev) +map.set('n', ']d', vim.diagnostic.goto_next) +map.set('n', '<leader>e', vim.diagnostic.open_float) +map.set('n', '<leader>q', vim.diagnostic.setloclist) + +-- BUFFERLINE +map.set('n', 'H', '<CMD>BufferLineCyclePrev<CR>', { desc = '[?] Go to previous BufferLine Buffer' }) -- Go to previous tab +map.set('n', 'L', '<CMD>BufferLineCycleNext<CR>', { desc = '[?] Go to next BufferLine Buffer' }) -- Go to next tab +map.set('n', 'F', '<CMD>BufferLinePick<CR>', { desc = '[?] Go to specific Buffer, with selecting' }) -- pick tab +map.set('n', 'X', '<CMD>bp<bar>sp<bar>bn<bar>bd!<CR>') -- close tab + +-- NVIM TREE +map.set('n', '<C-n>', '<CMD>NvimTreeToggle<CR>') +map.set('n', '<C-t>', '<CMD>NvimTreeOpen<CR>') + +-- dap +map.set('n', '<F5>', '<CMD>lua require"dap".continue()<CR>') +map.set('n', '<F10>', '<CMD>lua require"dap".step_over()<CR>') +map.set('n', '<F11>', '<CMD>lua require"dap".step_into()<CR>') +map.set('n', '<F12>', '<CMD>lua require"dap".step_out()<CR>') +map.set('n', '<leader>b', '<CMD>lua require"dap".toggle_breakpoint()<CR>') +map.set('n', '<leader>B', '<CMD>lua require"dap".set_breakpoint(vim.fn.input("Breakpoint condition: "))<CR>') +map.set('n', '<leader>lp', '<CMD>lua require"dap".set_breakpoint(nil, nil, vim.fn.input("Log point message: "))<CR>') +map.set('n', '<leader>dr', '<CMD>lua require"dap".repl.open()<CR>') + +-- dapui +map.set('n', '<F6>', '<CMD>lua require"dapui".close()<CR>') +map.set('n', '<F7>', '<CMD>lua require"dapui".toggle()<CR>') +map.set('n', '<F8>', '<CMD>lua require"dapui".float_element(<element ID>, <optional settings>)<CR>') +map.set({ 'n', 'v' },'<F9>', '<CMD>lua requir("dapui".eval(<expression>)<CR>') + +-- TELESCOPE +map.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +map.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +map.set('n', '<leader>/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer]' }) + +map.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +map.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +map.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +map.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +map.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + + diff --git a/lua/codecraft/core/options.lua b/lua/codecraft/core/options.lua new file mode 100644 index 0000000..f95e9fe --- /dev/null +++ b/lua/codecraft/core/options.lua @@ -0,0 +1,63 @@ +local opt = vim.opt +-- local g = vim.g +local o = vim.o +local wo = vim.wo + +-- Set highlight on search +o.hlsearch = false + +-- Make line numbers default +wo.number = true -- activate numbers +opt.nu = true -- right line number +opt.relativenumber = true -- relative + +-- keep cursor in the middle of the screen +opt.scrolloff = 25 + + +-- TABS +o.expandtab = true +o.tabstop = 4 +o.shiftwidth = 4 +opt.expandtab = true +opt.autoindent = true + +-- search settings +opt.ignorecase = true +opt.smartcase = true +opt.incsearch = true + +-- appearance +o.termguicolors = true +opt.background = 'dark' + +-- Enable mouse mode +o.mouse = 'a' + +-- Enable break indent +o.breakindent = true + +-- Save undo history +o.undofile = true + +-- Case insensitive searching UNLESS /C or capital in search +o.ignorecase = true +o.smartcase = true + +-- Decrease update time +o.updatetime = 250 +wo.signcolumn = 'yes' + +-- Set completeopt to have a better completion experience +o.completeopt = 'menuone,noselect' + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) diff --git a/lua/codecraft/plugin-setup.lua b/lua/codecraft/plugin-setup.lua new file mode 100644 index 0000000..75f644b --- /dev/null +++ b/lua/codecraft/plugin-setup.lua @@ -0,0 +1,160 @@ +-- Install packer +local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' +local is_bootstrap = false +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + is_bootstrap = true + vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path } + vim.cmd [[packadd packer.nvim]] +end + +require('packer').startup(function(use) + -- telescope filebrowser + use { + "nvim-telescope/telescope-file-browser.nvim", + requires = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" } + } + -- dashboard + use { + 'goolord/alpha-nvim', + requires = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require("codecraft.plugin.alpha").setup() + end + } + -- navicons + use { + "SmiteshP/nvim-navic", + requires = "neovim/nvim-lspconfig" + } + -- Project manager + use 'ahmedkhalf/project.nvim' + + use "alexghergh/nvim-tmux-navigation" + -- Package manager + use 'wbthomason/packer.nvim' + use 'jiangmiao/auto-pairs' + use 'alvan/vim-closetag' + + use 'tpope/vim-surround' + -- Chat GPT + use({ + "jackMort/ChatGPT.nvim", + requires = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim" + } + }) + + -- debugging + use 'mfussenegger/nvim-dap' + use 'jay-babu/mason-nvim-dap.nvim' + use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } + use 'theHamsta/nvim-dap-virtual-text' + use 'nvim-telescope/telescope-dap.nvim' + -- BufferLine + use { 'akinsho/bufferline.nvim', tag = "v3.*", requires = 'nvim-tree/nvim-web-devicons' } + -- Markdownpreview + use 'nvim-lua/completion-nvim' + -- emmet + -- use 'mattn/emmet-vim' + -- Markdownpreview + use({ + "iamcco/markdown-preview.nvim", + run = function() vim.fn["mkdp#util#install"]() end, + }) + use { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + requires = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + 'j-hui/fidget.nvim', + + -- Additional lua configuration, makes nvim stuff amazing + 'folke/neodev.nvim', + }, + } + + -- Formatting & Lintig + use 'jose-elias-alvarez/null-ls.nvim' + use 'jayp0521/mason-null-ls.nvim' + + use { -- Autocompletion + 'hrsh7th/nvim-cmp', + requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' }, + } + + use { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + run = function() + pcall(require('nvim-treesitter.install').update { with_sync = true }) + end, + } + + use { -- Additional text objects via treesitter + 'nvim-treesitter/nvim-treesitter-textobjects', + after = 'nvim-treesitter', + } + + -- NVIMTREE + use { + 'nvim-tree/nvim-tree.lua', + requires = { + 'nvim-tree/nvim-web-devicons', -- optional, for file icons + }, + } + -- Git related plugins + use 'tpope/vim-fugitive' + use 'tpope/vim-rhubarb' + use 'lewis6991/gitsigns.nvim' + + use 'navarasu/onedark.nvim' -- Theme inspired by Atom + use 'morhetz/gruvbox' + use 'folke/tokyonight.nvim' + use 'LunarVim/lunar.nvim' + use 'nvim-lualine/lualine.nvim' -- Fancier statusline + use 'lukas-reineke/indent-blankline.nvim' -- Add indentation guides even on blank lines + use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines + use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically + + -- Fuzzy Finder (files, lsp, etc) + use { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } + + -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua + local has_plugins, plugins = pcall(require, 'custom.plugins') + if has_plugins then + plugins(use) + end + + if is_bootstrap then + require('packer').sync() + end +end) + + +if is_bootstrap then + print '==================================' + print ' Plugins are being installed' + print ' Wait until Packer completes,' + print ' then restart nvim' + print '==================================' + return +end + +-- Automatically source and re-compile packer whenever you save this init.lua +local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) +vim.api.nvim_create_autocmd('BufWritePost', { + command = 'source <afile> | silent! LspStop | silent! LspStart | PackerCompile', + group = packer_group, + pattern = vim.fn.expand '$MYVIMRC', +}) +-- When we are bootstrapping a configuration, it doesn't +-- make sense to execute the rest of the init.lua. +-- +-- You'll need to restart nvim, and then it will work. diff --git a/lua/codecraft/plugin/alpha.lua b/lua/codecraft/plugin/alpha.lua new file mode 100644 index 0000000..10d3f31 --- /dev/null +++ b/lua/codecraft/plugin/alpha.lua @@ -0,0 +1,74 @@ +local M = {} + +function M.setup() + local status_ok, alpha = pcall(require, "alpha") + if not status_ok then + return + end + + local dashboard = require "alpha.themes.dashboard" + dashboard.section.header.val = { + [[]], + [[███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗]], + [[████╗ ██║ ██╔â•â•â•â•â•██╔â•â•â•██╗ ██║ ██║ ██║ ████╗ ████║]], + [[██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║]], + [[██║╚██╗██║ ██╔â•â•╠██║ ██║ ╚██╗ ██╔╠██║ ██║╚██╔â•██║]], + [[██║ ╚████║ ███████╗╚██████╔╠╚████╔╠██║ ██║ ╚â•╠██║]], + [[╚â•╠╚â•â•â•╠╚â•â•â•â•â•â•╠╚â•â•â•â•â•╠╚â•â•â•╠╚â•╠╚â•╠╚â•â•]], + [[]], + } + + dashboard.section.buttons.val = { + dashboard.button("f", codevim.icons.ui.FindFile .. " Find File", "<CMD>Telescope find_files<CR>"), + dashboard.button("n", codevim.icons.ui.NewFile .. " New File", "<CMD>ene!<CR>"), + dashboard.button("p", codevim.icons.ui.Project .. " Projects ", "<CMD>Telescope projects<CR>"), + dashboard.button("b", codevim.icons.ui.FolderOpen .. " File Browser", '<CMD>Telescope file_browser<CR>'), + dashboard.button("r", codevim.icons.ui.History .. " Recent files", "<CMD>Telescope oldfiles <CR>"), + dashboard.button("t", codevim.icons.ui.FindText .. " Find Text", "<CMD>Telescope live_grep<CR>"), + dashboard.button("c", codevim.icons.ui.Gear .. " Configuration", "<CMD>cd ~/.config/nvim/<CR><CMD>e init.lua<CR>"), + dashboard.button("q", codevim.icons.ui.Close .. " Quit", "<CMD>quit<CR>"), + } + + local function footer() + -- Number of plugins + local datetime = os.date "%d-%m-%Y %H:%M:%S" + local plugins_text = "  " + .. " ï”§ v" + .. vim.version().major + .. "." + .. vim.version().minor + .. "." + .. vim.version().patch + .. "  " + .. datetime + -- Quote + local fortune = require "alpha.fortune" + local quote = table.concat(fortune(), "\n") + + return plugins_text .. "\n" .. quote + end + + dashboard.section.buttons.opts = { + hl_shortcut = "Include", + spacing = 1, + } + + dashboard.section.footer.opts = { + position = "center", + hl = "Number", + } + dashboard.section.header.opts = { + position = "center", + hl = "Label", + } + dashboard.section.footer.val = footer() + + dashboard.section.footer.opts.hl = "Type" + dashboard.section.header.opts.hl = "Include" + dashboard.section.buttons.opts.hl = "Keyword" + + dashboard.opts.opts.noautocmd = true + alpha.setup(dashboard.opts) +end + +return M diff --git a/lua/codecraft/plugin/bufferline.lua b/lua/codecraft/plugin/bufferline.lua new file mode 100644 index 0000000..d2b0cf8 --- /dev/null +++ b/lua/codecraft/plugin/bufferline.lua @@ -0,0 +1,26 @@ +require('bufferline').setup { + options = { + offsets = { + { + filetype = 'NvimTree', + text = 'File Explorer', + text_align = 'center', + }, + buffer_close_icon = codevim.icons.ui.Close, + modified_icon = codevim.icons.ui.Circle, + close_icon = codevim.icons.ui.BoldClose, + left_trunc_marker = codevim.icons.ui.ArrowCircleLeft, + right_trunc_marker = codevim.icons.ui.ArrowCircleRight, + + }, + diagnostics = 'nvim_lsp', + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local s = " " + for e, n in pairs(diagnostics_dict) do + local sym = e == "error" and codevim.icons.diagnostics.Error or (e == "warning" and codevim.icons.diagnostics.Warning or codevim.icons.diagnostics.Information) + s = s .. n .. sym + end + return s + end + } +} diff --git a/lua/codecraft/plugin/chatgpt.lua b/lua/codecraft/plugin/chatgpt.lua new file mode 100644 index 0000000..e529e44 --- /dev/null +++ b/lua/codecraft/plugin/chatgpt.lua @@ -0,0 +1,70 @@ +require("chatgpt").setup({ + -- welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot + loading_text = "loading", + question_sign = "", -- you can use emoji if you want e.g. 🙂 + answer_sign = "ï®§", -- 🤖 + max_line_length = 120, + yank_register = "+", + chat_layout = { + relative = "editor", + position = "50%", + size = { + height = "80%", + width = "80%", + }, + }, + settings_window = { + border = { + style = "rounded", + text = { + top = " Settings ", + }, + }, + }, + chat_window = { + filetype = "chatgpt", + border = { + highlight = "FloatBorder", + style = "rounded", + text = { + top = " ChatGPT ", + }, + }, + }, + chat_input = { + prompt = " > ", + border = { + highlight = "FloatBorder", + style = "rounded", + text = { + top_align = "center", + top = " Prompt ", + }, + }, + }, + openai_params = { + model = "text-davinci-003", + frequency_penalty = 0, + presence_penalty = 0, + max_tokens = 300, + temperature = 0, + + top_p = 1, + n = 1, + }, + openai_edit_params = { + model = "code-davinci-edit-001", + temperature = 0, + top_p = 1, + n = 1, + }, + keymaps = { + close = { "<Esc>" }, + yank_last = "<C-y>", + scroll_up = "<C-u>", + scroll_down = "<C-d>", + toggle_settings = "<C-o>", + new_session = "<C-n>", + cycle_windows = "<Tab>", + }, +}) diff --git a/lua/codecraft/plugin/dap/dap.lua b/lua/codecraft/plugin/dap/dap.lua new file mode 100644 index 0000000..4164409 --- /dev/null +++ b/lua/codecraft/plugin/dap/dap.lua @@ -0,0 +1,11 @@ +local daps = { + codelldb = {}, + python = {}, +} + +require('mason').setup() +require('mason-nvim-dap').setup({ + ensure_installed = vim.tbl_keys(daps), + automatic_setup = true +}) +require('mason-nvim-dap').setup_handlers {} diff --git a/lua/codecraft/plugin/dap/dapui.lua b/lua/codecraft/plugin/dap/dapui.lua new file mode 100644 index 0000000..f6eefbd --- /dev/null +++ b/lua/codecraft/plugin/dap/dapui.lua @@ -0,0 +1,100 @@ +local dap, dapui = require("dap"), require("dapui") +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end + +dapui.setup({ + controls = { + element = "repl", + enabled = true, + icons = { + disconnect = "î«", + pause = "î«‘", + play = "î«“", + run_last = "", + step_back = "î®", + step_into = "î«”", + step_out = "î«•", + step_over = "î«–", + terminate = "î«—" + } + }, + element_mappings = {}, + expand_lines = true, + floating = { + border = "single", + mappings = { + close = { "q", "<Esc>" } + } + }, + force_buffers = true, + icons = { + collapsed = "î°", + current_frame = "î°", + expanded = "î®" + }, + layouts = { { + elements = { { + id = "scopes", + size = 0.25 + }, { + id = "breakpoints", + size = 0.25 + }, { + id = "stacks", + size = 0.25 + }, { + id = "watches", + size = 0.25 + } }, + position = "left", + size = 40 + }, { + elements = { { + id = "repl", + size = 0.5 + }, { + id = "console", + size = 0.5 + } }, + position = "bottom", + size = 10 + } }, + mappings = { + edit = "e", + expand = { "<CR>", "<2-LeftMouse>" }, + open = "o", + remove = "d", + repl = "r", + toggle = "t" + }, + render = { + indent = 1, + max_value_lines = 100 + } +}) + +local dapicons = { + breakpoint = { + text = codevim.icons.ui.Bug, + texthl = "DiagnosticSignError", + linehl = "", + numhl = "", + }, + breakpoint_rejected = { + text = codevim.icons.ui.Bug, + texthl = "DiagnosticSignError", + linehl = "", + numhl = "", + }, + stopped = { + text = codevim.icons.ui.BoldArrowRight, + texthl = "DiagnosticSignWarn", + linehl = "Visual", + numhl = "DiagnosticSignWarn", + }, +} + +vim.fn.sign_define("DapBreakpoint", dapicons.breakpoint) +vim.fn.sign_define("DapBreakpointRejected", dapicons.breakpoint_rejected) +vim.fn.sign_define("DapStopped", dapicons.stopped) diff --git a/lua/codecraft/plugin/dap/virtual-text.lua b/lua/codecraft/plugin/dap/virtual-text.lua new file mode 100644 index 0000000..cbc5a45 --- /dev/null +++ b/lua/codecraft/plugin/dap/virtual-text.lua @@ -0,0 +1,26 @@ +require("nvim-dap-virtual-text").setup { + enabled = true, -- enable this plugin (the default) + enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) + highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText + highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) + show_stop_reason = true, -- show stop reason when stopped for exceptions + commented = false, -- prefix virtual text with comment string + only_first_definition = true, -- only show virtual text at first definition (if there are multiple) + all_references = false, -- show virtual text on all all references of the variable (not only definitions) + --- A callback that determines how a variable is displayed or whether it should be omitted + --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable + --- @param buf number + --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame + --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) + --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed + display_callback = function(variable, _buf, _stackframe, _node) + return variable.name .. ' = ' .. variable.value + end, + + -- experimental features: + virt_text_pos = 'eol', -- position of virtual text, see `:h nvim_buf_set_extmark()` + all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. + virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) + virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) , + -- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()` +} diff --git a/lua/codecraft/plugin/gitsigns.lua b/lua/codecraft/plugin/gitsigns.lua new file mode 100644 index 0000000..698b261 --- /dev/null +++ b/lua/codecraft/plugin/gitsigns.lua @@ -0,0 +1,42 @@ +-- Gitsigns +-- See `:help gitsigns.txt` +require('gitsigns').setup { + signs = { + add = { text = codevim.icons.ui.BoldLineLeft }, + change = { text = codevim.icons.ui.BoldLineLeft }, + delete = { text = codevim.icons.ui.Triangle }, + topdelete = { text = codevim.icons.ui.Triangle }, + changedelete = { text = codevim.icons.ui.BoldLineLeft }, + }, + signcolumn = true, + numhl = false, + linehl = false, + word_diff = false, + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>", + sign_priority = 6, + status_formatter = nil, -- Use default + update_debounce = 200, + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "rounded", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { enable = false }, + +} diff --git a/lua/codecraft/plugin/indent-comments.lua b/lua/codecraft/plugin/indent-comments.lua new file mode 100644 index 0000000..2b7b7c5 --- /dev/null +++ b/lua/codecraft/plugin/indent-comments.lua @@ -0,0 +1,10 @@ +-- Enable Comment.nvim +require('Comment').setup() + +-- Enable `lukas-reineke/indent-blankline.nvim` +-- See `:help indent_blankline.txt` +require('indent_blankline').setup { + -- char = '┊', + show_trailing_blankline_indent = false, +} + diff --git a/lua/codecraft/plugin/lsp/completion.lua b/lua/codecraft/plugin/lsp/completion.lua new file mode 100644 index 0000000..5d30b87 --- /dev/null +++ b/lua/codecraft/plugin/lsp/completion.lua @@ -0,0 +1,43 @@ +-- nvim-cmp setup +local cmp = require 'cmp' +local luasnip = require 'luasnip' + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + ['<C-d>'] = cmp.mapping.scroll_docs( -4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<CR>'] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + ['<Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + ['<S-Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable( -1) then + luasnip.jump( -1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + diff --git a/lua/codecraft/plugin/lsp/lsp.lua b/lua/codecraft/plugin/lsp/lsp.lua new file mode 100644 index 0000000..5cd5323 --- /dev/null +++ b/lua/codecraft/plugin/lsp/lsp.lua @@ -0,0 +1,112 @@ +-- LSP settings. +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + if _.server_capabilities.documentSymbolProvider then + require('nvim-navic').attach(_, bufnr) + end + + nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition') + nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('<leader>K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('<leader>k', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('<leader>wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, { desc = 'Format current buffer with LSP' }) +end +-- Enable the following language servers +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- Add any additional override configuration in the following tables. They will be passed to +-- the `settings` field of the server config. You must look up that documentation yourself. +local servers = { + clangd = {}, + html = {}, + emmet_ls = {}, + cssls = {}, + tsserver = {}, + pyright = {}, + yamlls = {}, + rust_analyzer = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true + }, + }, + marksman = {}, + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, +} + +-- +require('completion') +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +capabilities.textDocument.completion.completionItem.snippetSupport = true +-- Setup mason so it can manage external tooling +require('mason').setup() + +-- Ensure the servers above are installed +local mason_lspconfig = require 'mason-lspconfig' +mason_lspconfig.setup { + ensure_installed = vim.tbl_keys(servers), +} + +mason_lspconfig.setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + } + end, +} +-- Turn on lsp status information +require('fidget').setup() diff --git a/lua/codecraft/plugin/lsp/navic.lua b/lua/codecraft/plugin/lsp/navic.lua new file mode 100644 index 0000000..a706b0b --- /dev/null +++ b/lua/codecraft/plugin/lsp/navic.lua @@ -0,0 +1,39 @@ +local navic = require('nvim-navic') + +navic.setup { + icons = { + File = " ", + Module = " ", + Namespace = "ï – ", + Package = " ", + Class = "ï – ", + Method = " ", + Property = "îž› ", + Field = " ", + Constructor = "ï¥ ", + Enum = "ï©—", + Interface = "ï©—", + Function = "ïž” ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = "â—© ", + Array = " ", + Object = " ", + Key = "ï Š ", + Null = "ï³ ", + EnumMember = "ï… ", + Struct = "ï – ", + Event = " ", + Operator = "ïš” ", + TypeParameter = " ", + }, + highlight = true, + separator = " > ", + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true +} + +vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}" diff --git a/lua/codecraft/plugin/lsp/null-ls.lua b/lua/codecraft/plugin/lsp/null-ls.lua new file mode 100644 index 0000000..2935bbe --- /dev/null +++ b/lua/codecraft/plugin/lsp/null-ls.lua @@ -0,0 +1,38 @@ +local null_ls = require('null-ls') +local mason_null_ls = require('mason-null-ls') + +local formatting = null_ls.builtins.formatting +local diagnostics = null_ls.builtins.diagnostics + +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + +local formatters_linters = { + prettier = {}, +} + +mason_null_ls.setup({ + ensure_installed = vim.tbl_keys(formatters_linters) +}) +null_ls.setup ({ + sources = { + formatting.prettier, + }, + on_attach = function(current_client, bufnr) + if current_client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == "null-ls" + end, + bufnr = bufnr, + }) + end, + }) + end + end, +}) diff --git a/lua/codecraft/plugin/lualine.lua b/lua/codecraft/plugin/lualine.lua new file mode 100644 index 0000000..31504aa --- /dev/null +++ b/lua/codecraft/plugin/lualine.lua @@ -0,0 +1,17 @@ +local navic = require("nvim-navic") +-- Set lualine as statusline +-- See `:help lualine.txt` +require('lualine').setup { + options = { + icons_enabled = true, + theme = nil, + component_separators = '|', + section_separators = '', + disabled_filetypes = { 'packer', 'NvimTree', 'alpha' }, + } + -- sections = { + -- lualine_c = { + -- { navic.get_location, cond = navic.is_available }, + -- } + -- } +} diff --git a/lua/codecraft/plugin/neodev.lua b/lua/codecraft/plugin/neodev.lua new file mode 100644 index 0000000..b9c0df1 --- /dev/null +++ b/lua/codecraft/plugin/neodev.lua @@ -0,0 +1,3 @@ +require('neodev').setup({ + library = { plugins = { 'nvim-dap-ui' }, types = true }, +}) diff --git a/lua/codecraft/plugin/nvimtree.lua b/lua/codecraft/plugin/nvimtree.lua new file mode 100644 index 0000000..696a0be --- /dev/null +++ b/lua/codecraft/plugin/nvimtree.lua @@ -0,0 +1,42 @@ +require("nvim-tree").setup({ + disable_netrw = true, + hijack_netrw = true, + diagnostics = { + enable = true, + }, + prefer_startup_root = false, + sync_root_with_cwd = true, + view = { + width = 30, + mappings = { + list = { + { key = "u", action = "dir_up" }, + { key = 'v', action = 'vsplit' } + }, + }, + }, + filters = {}, + renderer = { + group_empty = true, + }, + actions = { + open_file = { + resize_window = true + } + }, + git = { + ignore = false, + } +}) +vim.api.nvim_create_autocmd("BufEnter", { + nested = true, + callback = function() + if #vim.api.nvim_list_wins() == 1 and require("nvim-tree.utils").is_nvim_tree_buf() then + vim.cmd "quit" + end + end +}) + +-- Create an autocmd to keep the nvim-tree buffer open after saving changes +vim.cmd("autocmd VimEnter * NvimTreeOpen") +vim.cmd("autocmd VimEnter * wincmd p") diff --git a/lua/codecraft/plugin/projects.lua b/lua/codecraft/plugin/projects.lua new file mode 100644 index 0000000..21c0624 --- /dev/null +++ b/lua/codecraft/plugin/projects.lua @@ -0,0 +1,49 @@ +require('project_nvim').setup { + ---@usage set to false to disable project.nvim. + --- This is on by default since it's currently the expected behavior. + active = true, + + on_config_done = nil, + + ---@usage set to true to disable setting the current-woriking directory + --- Manual mode doesn't automatically change your root directory, so you have + --- the option to manually do so using `:ProjectRoot` command. + manual_mode = false, + + ---@usage Methods of detecting the root directory + --- Allowed values: **"lsp"** uses the native neovim lsp + --- **"pattern"** uses vim-rooter like glob pattern matching. Here + --- order matters: if one is not detected, the other is used as fallback. You + --- can also delete or rearangne the detection methods. + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, + + -- All the patterns used to detect root dir, when **"pattern"** is in + -- detection_methods + patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" }, + + -- Table of lsp clients to ignore by name + -- eg: { "efm", ... } + ignore_lsp = {}, + + -- Don't calculate root dir on specific directories + -- Ex: { "~/.cargo/*", ... } + exclude_dirs = {}, + + -- Show hidden files in telescope + show_hidden = false, + + -- When set to false, you will get a message when project.nvim changes your + -- directory. + silent_chdir = true, + + -- What scope to change the directory, valid options are + -- * global (default) + -- * tab + -- * win + scope_chdir = "global", + + ---@type string + ---@usage path to store the project history for use in telescope + datapath = vim.fn.stdpath("data"), +} diff --git a/lua/codecraft/plugin/telescope.lua b/lua/codecraft/plugin/telescope.lua new file mode 100644 index 0000000..03db441 --- /dev/null +++ b/lua/codecraft/plugin/telescope.lua @@ -0,0 +1,50 @@ +-- [[ Configure Telescope ]] +-- See `:help telescope` and `:help telescope.setup()` +-- THEMES +---@alias telescope_themes +---| "cursor" # see `telescope.themes.get_cursor()` +---| "dropdown" # see `telescope.themes.get_dropdown()` +---| "ivy" # see `telescope.themes.get_ivy()` +---| "center" # retain the default telescope theme +require('telescope').setup { + theme = "dropdown", ---@type telescope_themes + defaults = { + prompt_prefix = codevim.icons.ui.Telescope .. " ", + selection_caret = codevim.icons.ui.Forward .. " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + layout_config = {}, + mappings = { + i = { + ['<C-u>'] = false, + ['<C-d>'] = false, + }, + }, + file_ignore_patterns = {}, + path_display = { "smart" }, + winblend = 0, + border = {}, + borderchars = nil, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- Default = nil + }, + pickers = { + planets = { + show_pluto = true, + show_moon = true, + }, + git_files = { + hidden = true, + show_untracked = true, + }, + colorscheme = { + enable_preview = true, + }, + }, +} +-- Enable telescope fzf native, if installed +pcall(require('telescope').load_extension, 'fzf') +pcall(require('telescope').load_extension, 'dap') +pcall(require('telescope').load_extension, 'projects') +pcall(require('telescope').load_extension, 'file_browser') diff --git a/lua/codecraft/plugin/tmux-nvim-navigation.lua b/lua/codecraft/plugin/tmux-nvim-navigation.lua new file mode 100644 index 0000000..917cb9f --- /dev/null +++ b/lua/codecraft/plugin/tmux-nvim-navigation.lua @@ -0,0 +1,3 @@ +require('nvim-tmux-navigation').setup { + -- config +} diff --git a/lua/codecraft/plugin/treesitter.lua b/lua/codecraft/plugin/treesitter.lua new file mode 100644 index 0000000..1ef6a10 --- /dev/null +++ b/lua/codecraft/plugin/treesitter.lua @@ -0,0 +1,63 @@ +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'vim', 'html' }, + + highlight = { enable = true }, + indent = { enable = true, disable = { 'python' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '<c-space>', + node_incremental = '<c-space>', + scope_incremental = '<c-s>', + node_decremental = '<c-backspace>', + }, + }, + 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', + }, + }, + }, +} + diff --git a/lua/codecraft/utils/defaults.lua b/lua/codecraft/utils/defaults.lua new file mode 100644 index 0000000..4410048 --- /dev/null +++ b/lua/codecraft/utils/defaults.lua @@ -0,0 +1,3 @@ +return { + icons = require('codecraft.utils.icons') +} diff --git a/lua/codecraft/utils/icons.lua b/lua/codecraft/utils/icons.lua new file mode 100644 index 0000000..b7ea852 --- /dev/null +++ b/lua/codecraft/utils/icons.lua @@ -0,0 +1,155 @@ +return { + kind = { + Array = "", + Boolean = "îª", + Class = "î›", + Color = "îœ", + Constant = "î", + Constructor = "", + Enum = "", + EnumMember = "îž", + Event = "", + Field = "îŸ", + File = "î©»", + Folder = "ïŠ", + Function = "", + Interface = "î¡", + Key = "", + Keyword = "î¢", + Method = "", + Module = "", + Namespace = "", + Null = "ï³ ", + Number = "îª", + Object = "", + Operator = "î¤", + Package = "", + Property = "î¥", + Reference = "", + Snippet = "î¦", + String = "î®", + Struct = "", + Text = "", + TypeParameter = "", + Unit = "", + Value = "", + Variable = "", + }, + git = { + LineAdded = "", + LineModified = "", + LineRemoved = "", + FileDeleted = "", + FileIgnored = "â—Œ", + FileRenamed = "î« ", + FileStaged = "S", + FileUnmerged = "", + FileUnstaged = "ï‘„", + FileUntracked = "U", + Diff = "î«¡", + Repo = "î©¢", + Octoface = "", + Branch = "", + }, + ui = { + ArrowCircleDown = "ï‚«", + ArrowCircleLeft = "", + ArrowCircleRight = "ï‚©", + ArrowCircleUp = "", + BoldArrowDown = "ï£", + BoldArrowLeft = "ï ", + BoldArrowRight = "ï¡", + BoldArrowUp = "ï¢", + BoldClose = "ï€", + BoldDividerLeft = "", + BoldDividerRight = "î‚°", + BoldLineLeft = "â–Ž", + BookMark = "", + BoxChecked = "ï†", + Bug = "", + Stacks = "", + Scopes = "", + Watches = "ï–¤", + DebugConsole = "î®›", + Calendar = "", + Check = "", + ChevronRight = ">", + ChevronShortDown = "", + ChevronShortLeft = "", + ChevronShortRight = "ï‘ ", + ChevronShortUp = "ï‘»", + Circle = "ï„‘", + Close = "", + CloudDownload = "î«‚", + Code = "î«„", + Comment = "î©«", + Dashboard = "î«", + DividerLeft = "", + DividerRight = "", + DoubleChevronRight = "»", + Ellipsis = "", + EmptyFolder = "ï„”", + EmptyFolderOpen = "ï„•", + File = "î©»", + FileSymlink = "î«®", + Files = "î«°", + FindFile = "ïœ", + FindText = "", + Fire = "", + Folder = "ïŠ", + FolderOpen = "ï¼", + FolderSymlink = "ï’‚", + Forward = "ï¤", + Gear = "", + History = "", + Lightbulb = "î©¡", + LineLeft = "â–", + LineMiddle = "│", + List = "", + Lock = "", + NewFile = "î©¿", + Note = "", + Package = "", + Pencil = "", + Plus = "ï‘", + Project = "î©¢", + Search = "î©", + SignIn = "", + SignOut = "î©®", + Tab = "ï ‘", + Table = "î®·", + Target = "󰀘", + Telescope = "î¨", + Text = "", + Tree = "", + Triangle = "契", + TriangleShortArrowDown = "ï‘‹", + TriangleShortArrowLeft = "ï¸", + TriangleShortArrowRight = "", + TriangleShortArrowUp = "", + }, + diagnostics = { + BoldError = "ï—", + Error = "", + BoldWarning = "ï±", + Warning = "", + BoldInformation = "ïš", + Information = "î©´", + BoldQuestion = "ï™", + Question = "", + BoldHint = "î©¡", + Hint = "ï µ", + Debug = "", + Trace = "✎", + }, + misc = { + Robot = "ï®§", + Squirrel = "î˜", + Tag = "", + Watch = "î¼", + Smiley = "î”", + Package = "", + CircuitBoard = "", + }, +} + diff --git a/lua/codecraft/vimlocale.lua b/lua/codecraft/vimlocale.lua new file mode 100644 index 0000000..b5bc17c --- /dev/null +++ b/lua/codecraft/vimlocale.lua @@ -0,0 +1,2 @@ +codevim = vim.deepcopy(require 'codecraft.utils.defaults') + -- GitLab