diff --git a/init.lua b/init.lua index b98ffc61..a90640e8 100644 --- a/init.lua +++ b/init.lua @@ -87,8 +87,8 @@ P.S. You can delete this when you're done too. It's your config now! :) -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +vim.g.mapleader = ',' -- global keymap leader +vim.g.maplocalleader = ',' -- global keymap leader -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = false @@ -110,6 +110,145 @@ vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.o.showmode = false +-- Make line numbers default +vim.wo.number = true + +-- do not wrap lines to the next line +vim.wo.wrap = false + +-- no swap file +vim.opt.swapfile = false + +-- Case insensitive searching UNLESS /C or capital in search +vim.o.incsearch = true +vim.o.hlsearch = true + +vim.o.timeout = true + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +vim.cmd 'set inccommand=split' +vim.cmd [[set list listchars=tab:\ \ ,trail:·,nbsp:·]] +vim.cmd [[set wildignore+=*/.git/*,*/.hg/*,*/.svn/*.,*/.DS_Store,*/node_modules/*]] + +-- set working directory to current buffer's directory +vim.cmd [[autocmd BufEnter * silent! cd %:p:h]] + +-- remove whitespace on save +vim.cmd [[autocmd BufWritePre * :%s/\s\+$//e]] + +vim.wo.cursorline = true +vim.wo.signcolumn = 'yes' +vim.o.hidden = true + +vim.cmd [[set expandtab]] +vim.bo.tabstop = 2 +vim.bo.shiftwidth = 2 +vim.cmd 'set ts=2' +vim.cmd 'set sw=2' +vim.o.shiftround = true +vim.cmd [[autocmd BufNewFile,BufReadPost *.js,*.ts,*.tsx setl colorcolumn=80,100,120]] +vim.cmd [[autocmd BufNewFile,BufReadPost *.js,*.ts,*.tsx set ts=2]] +vim.cmd [[autocmd BufNewFile,BufReadPost *.js,*.ts,*.tsx set sw=2]] + + + +local map = function(mode, key, action, opts) + local options = { noremap = true } + if opts then + options = vim.tbl_extend('force', options, opts) + end + return vim.keymap.set(mode, key, action, options) +end + +local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group +local autocmd = vim.api.nvim_create_autocmd -- Create autocommand + +local setup_keymaps = function() + map('n', 'ev', ':e ~/.config/nvim/init.lua') + map('n', 'ed', ':e ~/dotfiles/install.sh') + + map('i', 'jj', '') + map('t', 'jj', [[]]) + + map('n', '', ':nohlsearch') + map('n', '', '') + + map('n', ';', ':') + map('v', ';', ':') + map('n', '', 'o') + map('n', '', 'il') + + -- Better split switching + map('n', '', 'j') + map('n', '', 'k') + map('n', '', 'h') + map('n', '', 'l') + + -- easy splits | for vertical _ for horizontal + map('n', '', ':vsp') + map('n', '_', [[Hmx``szz`x``]]) + + -- tabs + map('n', 'tt', ':tabe %') + map('n', '[t', ':tabprev') + map('n', 't[', ':tabprev') + map('n', ']t', ':tabnext') + map('n', 't]', ':tabnext') + map('n', '[T', ':tabfirst') + map('n', ']T', ':tablast') + + map('n', ']f', ':cnext') + map('n', '[f', ':cprev') + + -- Diagnostic keymaps + map('n', '[q', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) + map('n', ']q', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) + map('n', 'd', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) + -- map('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) + -- map('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + + -- quickfix things + map('n', 'qo', ':copen', { desc = '[q]uickfix: [o]pen' }) + map('n', 'qc', ':cclose', { desc = '[q]uickfix: [c]lose' }) + map('n', 'qn', ':cnext', { desc = '[q]uickfix: [n]ext' }) + map('n', 'qp', ':cprev', { desc = '[q]uickfix: [p]revious' }) +end +setup_keymaps() + +local setup_autocmds = function() + augroup('QuickfixKeybinds', { clear = true }) + autocmd('Filetype', { + group = 'QuickfixKeybinds', + pattern = 'qf', + callback = function() + -- map('n', '', ":.cc", { desc = "open file under cursor", }) + end, + }) + + -- [[ Highlight on yank ]] + -- See `:help vim.highlight.on_yank()` + augroup('YankHighlight', { clear = true }) + autocmd('TextYankPost', { + group = 'YankHighlight', + pattern = '*', + callback = function() + vim.highlight.on_yank() + end, + }) +end +setup_autocmds() + + + -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -159,7 +298,7 @@ vim.o.inccommand = 'split' vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.o.scrolloff = 10 +vim.o.scrolloff = 5 -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) @@ -246,6 +385,83 @@ rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup({ + { + 'tpope/vim-fugitive', + config = function() + vim.keymap.set('n', 'gg', ':vertical G', { desc = '[g]it Open Fu[g]itive Window' }) + vim.keymap.set('n', 'gb', ':0G', { desc = '[g]it Open Fugitive Window in [b]uffer' }) + end, + }, + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + { + -- Theme inspired by twitch colors + 'usirin/bleed-purple.nvim', + priority = 1000, + branch = 'phoenix-occupative', + dependencies = { + 'rktjmp/lush.nvim', + }, + config = function() + -- vim.cmd.colorscheme 'bleed-purple' + end, + }, + + { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup { 'css', 'javascript', 'json', 'typescriptreact', 'typescript', 'lua' } + end, + }, + { + 'projekt0n/github-nvim-theme', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('github-theme').setup {} + + vim.cmd 'colorscheme github_dark_default' + -- vim.cmd 'colorscheme github_light' + vim.cmd [[highlight CursorLine guibg=#1c1d26]] + end, + }, + + { + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + opts = { + indent = { char = '┊', tab_char = '┊' }, + scope = { show_start = false }, + }, + }, + + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + { 'Marskey/telescope-sg' }, + require 'kickstart.plugins.autoformat', + { import = 'phoenix.plugins' }, + { import = 'custom.plugins' }, + + + + + + + + + + + + + + + + + + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically @@ -282,6 +498,13 @@ require('lazy').setup({ changedelete = { text = '~' }, }, }, + on_attach = function(bufnr) + local gs = require('gitsigns') + vim.keymap.set('n', '[c', gs.prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' }) + vim.keymap.set('n', ']c', gs.next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' }) + vim.keymap.set('n', 'ph', gs.preview_hunk, { buffer = bufnr, desc = 'Preview Hunk' }) + vim.keymap.set('n', 'gv', gs.select_hunk, { buffer = bufnr, desc = 'Select Hunk' }) + end, }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. @@ -298,7 +521,7 @@ require('lazy').setup({ -- Then, because we use the `opts` key (recommended), the configuration runs -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -379,7 +602,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -413,6 +636,18 @@ require('lazy').setup({ -- }, -- }, -- pickers = {} + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + path_display = { + shorten = { len = 1, exclude = { -2, -1 } }, + }, + dynamic_preview_title = true, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -423,6 +658,8 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension 'ast_grep') + pcall(require('telescope').load_extension, 'sg') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' @@ -437,6 +674,27 @@ require('lazy').setup({ vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + -- See `:help telescope.builtin` + vim.keymap.set('n', '?', builtin.oldfiles, { desc = '[?] Find recently opened files' }) + vim.keymap.set('n', 'b', builtin.buffers, { desc = '[B] Find existing buffers' }) + vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sg', ':Telescope ast_grep', { desc = '[S]earch by AST [G]rep' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', '', builtin.git_files, { desc = 'Git files' }) + vim.keymap.set('n', 'gs', builtin.git_status, { desc = '[G]it [S]tatus' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = 'Telescope resume' }) + -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. @@ -482,13 +740,13 @@ require('lazy').setup({ -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'mason-org/mason.nvim', opts = {} }, - 'mason-org/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', + { 'mason-org/mason.nvim', opts = {} }, -- Mason is a package manager for Neovim that helps you install LSPs, DAPs, linters, etc. + 'mason-org/mason-lspconfig.nvim', -- Automatically install LSPs and related tools to stdpath for Neovim + 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Automatically install LSPs and related tools to stdpath for Neovim -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, - + { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Fidget is a plugin that shows LSP status updates in a floating window + 'folke/neodev.nvim', -- Neovim Lua development plugin, provides LSP support for Neovim APIs -- Allows extra capabilities provided by blink.cmp 'saghen/blink.cmp', }, @@ -545,6 +803,7 @@ require('lazy').setup({ -- Find references for the word under your cursor. map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. @@ -719,8 +978,39 @@ require('lazy').setup({ }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + ensure_installed = { + -- gopls = { + -- format = { enable = true }, + -- }, + -- graphql = {}, + ts_ls = {}, + -- prismals = {}, + jsonls = { + format = { enable = false }, + }, + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, + eslint = { + format = { enable = true }, + }, + elixirls = { + -- dialyzer = { use = false }, + }, + biome = { + -- root_dir = lspconfig.util.root_pattern('biome.jsonc', 'biome.json'), + single_file_support = true, + format = { enable = true }, + }, + rust_analyzer = {}, + }, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) automatic_installation = false, handlers = { function(server_name) @@ -944,17 +1234,73 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'cpp', 'go', 'rust', 'tsx', 'typescript', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, -- Autoinstall languages that are not installed - auto_install = true, + auto_install = false, highlight = { enable = true, -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, + -- additional_vim_regex_highlighting = { 'ruby' }, }, - indent = { enable = true, disable = { 'ruby' } }, + indent = { enable = true, disable = { '' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + 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 = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + }, + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', }, -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: @@ -964,6 +1310,14 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, + vim.filetype.add { + extension = { + mdx = 'markdown.mdx', + }, + } + + + -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. @@ -1012,5 +1366,127 @@ require('lazy').setup({ }, }) + +-- [[ Configure LSP ]] +-- 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 + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('w', vim.lsp.buf.code_action, '[C]ode [A]ction') + -- nmap('', vim.lsp.buf.code_action, '[C]ode [A]ction') + -- nmap('w', ':Lspsaga code_action', '[C]ode [A]ction') + + nmap('gd', require('telescope.builtin').lsp_definitions, '[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('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + -- nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + -- nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('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 + +-- local lspconfig = require 'lspconfig' + +-- 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 = { +-- -- gopls = { +-- -- format = { enable = true }, +-- -- }, +-- -- graphql = {}, +-- ts_ls = {}, +-- -- prismals = {}, +-- jsonls = { +-- format = { enable = false }, +-- }, +-- lua_ls = { +-- Lua = { +-- workspace = { checkThirdParty = false }, +-- telemetry = { enable = false }, +-- }, +-- }, +-- eslint = { +-- format = { enable = true }, +-- }, +-- elixirls = { +-- -- dialyzer = { use = false }, +-- }, +-- biome = { +-- -- root_dir = lspconfig.util.root_pattern('biome.jsonc', 'biome.json'), +-- single_file_support = true, +-- format = { enable = true }, +-- }, +-- rust_analyzer = {}, +-- } + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et + +-- require('neodev').setup() + +-- 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) + +-- -- Ensure the servers above are installed +-- local mason_lspconfig = require("mason-lspconfig") + +-- -- Önce hangi LSP serverların kurulacağı belirtilmeli +-- mason_lspconfig.setup { +-- ensure_installed = vim.tbl_keys(servers), +-- } + +-- -- Sonra kurulumdan sonra handlerlar ayarlanır +-- mason_lspconfig.setup_handlers({ +-- function(server_name) -- default handler +-- require("lspconfig")[server_name].setup { +-- capabilities = capabilities, +-- on_attach = on_attach, +-- settings = servers[server_name], +-- } +-- end, +-- }) + +-- require('lspconfig').relay_lsp.setup { +-- capabilities = capabilities, +-- on_attach = on_attach, +-- settings = { +-- auto_start_compiler = false, +-- }, +-- } +-- configure relay_lsp manually since mason doesn't know about it + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/kullanım.md b/kullanım.md new file mode 100644 index 00000000..aa85edb5 --- /dev/null +++ b/kullanım.md @@ -0,0 +1,59 @@ +tpope/vim-fugitive: +Git işlemlerini Vim içinde kolay yapmayı sağlar. +config fonksiyonunda iki kısayol tanımlanmış: + +gg: Dikey bölmede :G komutunu çalıştırır (Fugitive Git arayüzü). + +gb: :0G komutunu çalıştırır, buffer bazlı Fugitive. + +'tpope/vim-rhubarb': +GitHub ile entegrasyon sağlayan ufak eklenti (örneğin, :Gbrowse komutu verir). +Burada sadece tanımlanmış, config verilmemiş. + + + +---- + + +numToStr/Comment.nvim, Neovim/Vim için satır ve blok yorumlama işlemlerini kolaylaştırır. + +Hem normal modda hem de visual modda kısayollar sağlar. + +Varsayılan kullanım: +Normal mod: gcc → Bulunduğun satırı yorumlar / yorumunu kaldırır + +Visual mod: gc → Seçili satırları yorumlar / yorumunu kaldırır + +Yani gcc tek satır, gc ise seçili alan üzerinde çalışır. +Dosya tipine göre doğru yorum işareti (//, #, -- vb.) otomatik seçilir. + +--- + +nvim-telescope/telescope.nvim +-- Dosya arama +vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = 'Dosya Ara' }) + +-- Metin içinde arama +vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = 'Metin Ara' }) + +-- Açık buffer'lar arasında geçiş +vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = 'Buffer Ara' }) + +-- Yardım dökümanlarında arama +vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = 'Help Ara' }) + + +Kısayol Komut / Fonksiyon Açıklama +sh help_tags Neovim yardım dosyalarında arama yapar. +sk keymaps Tüm tanımlı keymap’leri listeler. +sf find_files Projede dosya ismine göre arar. +ss builtin Tüm Telescope picker’larını listeler. +sw grep_string İmlecin altındaki kelimeyi proje içinde arar. +sg live_grep Projede metin arar (ripgrep gerekir). +sd diagnostics LSP’den gelen hataları ve uyarıları listeler. +sr resume En son yapılan Telescope aramasını tekrar açar. +s. oldfiles Son açılan dosyaları listeler. + buffers Açık buffer’lar arasında geçiş yapar. +/ current_buffer_fuzzy_find Sadece açık olan buffer içinde bulanık arama yapar. +s/ live_grep { grep_open_files = true } Sadece açık olan dosyalarda arama yapar. +sn find_files { cwd = vim.fn.stdpath('config') } diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua new file mode 100644 index 00000000..3d3e9124 --- /dev/null +++ b/lua/kickstart/plugins/autoformat.lua @@ -0,0 +1,83 @@ +-- autoformat.lua +-- +-- Use your language server to automatically format your code on save. +-- Adds additional commands as well to manage the behavior + +return { + 'neovim/nvim-lspconfig', + config = function() + -- Switch for controlling whether you want autoformatting. + -- Use :KickstartFormatToggle to toggle autoformatting on or off + local format_is_enabled = true + vim.api.nvim_create_user_command('KickstartFormatToggle', function() + format_is_enabled = not format_is_enabled + print('Setting autoformatting to: ' .. tostring(format_is_enabled)) + end, {}) + + -- Create an augroup that is used for managing our formatting autocmds. + -- We need one augroup per client to make sure that multiple clients + -- can attach to the same buffer without interfering with each other. + local _augroups = {} + local get_augroup = function(client) + if not _augroups[client.id] then + local group_name = 'kickstart-lsp-format-' .. client.name + local id = vim.api.nvim_create_augroup(group_name, { clear = true }) + _augroups[client.id] = id + end + + return _augroups[client.id] + end + + -- Whenever an LSP attaches to a buffer, we will run this function. + -- + -- See `:help LspAttach` for more information about this autocmd event. + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), + -- This is where we attach the autoformatting for reasonable clients + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_client_by_id(client_id) + local bufnr = args.buf + + if client == nil then + return + end + + -- Only attach to clients that support document formatting + if not client.server_capabilities.documentFormattingProvider then + return + end + + -- Tsserver usually works poorly. Sorry you work with bad languages + -- You can remove this line if you know what you're doing :) + if client.name == 'ts_ls' then + return + end + + -- i want prettier to format json files + if client.name == 'jsonls' then + return + end + + -- Create an autocmd that will run *before* we save the buffer. + -- Run the formatting command for the LSP that has just attached. + vim.api.nvim_create_autocmd('BufWritePre', { + group = get_augroup(client), + buffer = bufnr, + callback = function() + if not format_is_enabled then + return + end + + vim.lsp.buf.format { + async = false, + filter = function(c) + return c.id == client.id + end, + } + end, + }) + end, + }) + end, +} diff --git a/lua/phoenix/bleed-purple/colors.lua b/lua/phoenix/bleed-purple/colors.lua new file mode 100644 index 00000000..0a636158 --- /dev/null +++ b/lua/phoenix/bleed-purple/colors.lua @@ -0,0 +1,27 @@ +local hsl = require('phoenix.utils.color').hsl + +local Colors = {} + +Colors.dark = { + black = hsl(240, 7, 13), + bblack = hsl(240, 7, 16), + red = hsl(1, 83, 40), + bred = hsl(1, 83, 50), + bgreen = hsl(156, 100, 48), + green = hsl(172, 100, 34), + yellow = hsl(40, 100, 74), + byellow = hsl(40, 100, 84), + blue = hsl(220, 100, 56), + bblue = hsl(220, 100, 66), + magenta = hsl(264, 100, 64), + bmagenta = hsl(264, 100, 72), + cyan = hsl(180, 98, 26), + bcyan = hsl(180, 100, 32), + white = hsl(240, 7, 84), + bwhite = hsl(240, 7, 94), +} + +Colors.dark.status_bg = Colors.dark.black +Colors.dark.dimmed_text = hsl(240, 7, 25) + +return Colors diff --git a/lua/phoenix/blurple/colors.lua b/lua/phoenix/blurple/colors.lua new file mode 100644 index 00000000..939b3b11 --- /dev/null +++ b/lua/phoenix/blurple/colors.lua @@ -0,0 +1,301 @@ +local M = {} + +M.colors = { + ['red.100'] = '#fef8f9', + ['red.130'] = '#fef4f4', + ['red.160'] = '#feeaea', + ['red.200'] = '#fdddde', + ['red.230'] = '#fbcdce', + ['red.260'] = '#fbbabb', + ['red.300'] = '#fba6a8', + ['red.330'] = '#fa9193', + ['red.345'] = '#fa777b', + ['red.360'] = '#f85b5f', + ['red.400'] = '#f23f43', + ['red.430'] = '#da373c', + ['red.460'] = '#bb3033', + ['red.500'] = '#a12829', + ['red.530'] = '#8f2022', + ['red.560'] = '#7f1c1e', + ['red.600'] = '#70181a', + ['red.630'] = '#651517', + ['red.660'] = '#5a1314', + ['red.700'] = '#501012', + ['red.730'] = '#460e0f', + ['red.760'] = '#3f0b0c', + ['red.800'] = '#360a0b', + ['red.830'] = '#2e090a', + ['red.860'] = '#280808', + ['red.900'] = '#220606', + ['orange.100'] = '#fff8f5', + ['orange.130'] = '#fff4ed', + ['orange.160'] = '#feeadf', + ['orange.200'] = '#fddecd', + ['orange.230'] = '#fccfb2', + ['orange.260'] = '#fcbd95', + ['orange.300'] = '#fbab70', + ['orange.330'] = '#fa9746', + ['orange.345'] = '#f1882a', + ['orange.360'] = '#db7628', + ['orange.400'] = '#c46926', + ['orange.430'] = '#ac591f', + ['orange.460'] = '#9b4c19', + ['orange.500'] = '#8c4013', + ['orange.530'] = '#7b3710', + ['orange.560'] = '#6d300e', + ['orange.600'] = '#5f2b0b', + ['orange.630'] = '#56260a', + ['orange.660'] = '#4c2209', + ['orange.700'] = '#431e09', + ['orange.730'] = '#3b1a07', + ['orange.760'] = '#331606', + ['orange.800'] = '#2d1305', + ['orange.830'] = '#261005', + ['orange.860'] = '#200e05', + ['orange.900'] = '#190d04', + ['yellow.100'] = '#fff8ef', + ['yellow.130'] = '#fff4e8', + ['yellow.160'] = '#ffebd3', + ['yellow.200'] = '#fee0b6', + ['yellow.230'] = '#fdd18c', + ['yellow.260'] = '#fcc145', + ['yellow.300'] = '#f0b232', + ['yellow.330'] = '#e1a42a', + ['yellow.345'] = '#d49824', + ['yellow.360'] = '#bf861c', + ['yellow.400'] = '#af7615', + ['yellow.430'] = '#9a650d', + ['yellow.460'] = '#8a5709', + ['yellow.500'] = '#7c4b04', + ['yellow.530'] = '#6d4104', + ['yellow.560'] = '#613803', + ['yellow.600'] = '#543203', + ['yellow.630'] = '#4c2d03', + ['yellow.660'] = '#432803', + ['yellow.700'] = '#3b2303', + ['yellow.730'] = '#351e02', + ['yellow.760'] = '#2e1a02', + ['yellow.800'] = '#271602', + ['yellow.830'] = '#221302', + ['yellow.860'] = '#1c1002', + ['yellow.900'] = '#160e02', + ['green.100'] = '#ecfef1', + ['green.130'] = '#defee7', + ['green.160'] = '#bdfcd3', + ['green.200'] = '#88fbb5', + ['green.230'] = '#58f39c', + ['green.260'] = '#48e58b', + ['green.300'] = '#3bd67f', + ['green.330'] = '#2dc771', + ['green.345'] = '#26b968', + ['green.360'] = '#23a55a', + ['green.400'] = '#24934e', + ['green.430'] = '#248045', + ['green.460'] = '#1f703c', + ['green.500'] = '#1a6334', + ['green.530'] = '#15562b', + ['green.560'] = '#124c24', + ['green.600'] = '#0e431f', + ['green.630'] = '#0c3c1c', + ['green.660'] = '#0a3618', + ['green.700'] = '#072f15', + ['green.730'] = '#052910', + ['green.760'] = '#03240e', + ['green.800'] = '#031f0c', + ['green.830'] = '#031b0a', + ['green.860'] = '#041708', + ['green.900'] = '#051307', + ['blue.100'] = '#f6fafe', + ['blue.130'] = '#f0f7fe', + ['blue.160'] = '#e2f0fd', + ['blue.200'] = '#cde8fd', + ['blue.230'] = '#b2ddfc', + ['blue.260'] = '#94d2fc', + ['blue.300'] = '#66c4fd', + ['blue.330'] = '#2eb6ff', + ['blue.345'] = '#00aafc', + ['blue.360'] = '#0097f2', + ['blue.400'] = '#0082eb', + ['blue.430'] = '#006be7', + ['blue.460'] = '#005cd1', + ['blue.500'] = '#0051b6', + ['blue.530'] = '#00489b', + ['blue.560'] = '#004088', + ['blue.600'] = '#003976', + ['blue.630'] = '#00336a', + ['blue.660'] = '#002d5f', + ['blue.700'] = '#002855', + ['blue.730'] = '#002348', + ['blue.760'] = '#001e3f', + ['blue.800'] = '#001a36', + ['blue.830'] = '#001630', + ['blue.860'] = '#00132b', + ['blue.900'] = '#001024', + ['teal.100'] = '#f4fbfd', + ['teal.130'] = '#e9f9fd', + ['teal.160'] = '#d3f4fb', + ['teal.200'] = '#b1eff9', + ['teal.230'] = '#7ee7f7', + ['teal.260'] = '#5edbef', + ['teal.300'] = '#47cbe2', + ['teal.330'] = '#35bcd5', + ['teal.345'] = '#2eb0c9', + ['teal.360'] = '#289fb6', + ['teal.400'] = '#248da1', + ['teal.430'] = '#207a8d', + ['teal.460'] = '#1b6b7c', + ['teal.500'] = '#175e6d', + ['teal.530'] = '#13525f', + ['teal.560'] = '#0f4954', + ['teal.600'] = '#0c4049', + ['teal.630'] = '#0a3942', + ['teal.660'] = '#08333a', + ['teal.700'] = '#062d34', + ['teal.730'] = '#05272d', + ['teal.760'] = '#042227', + ['teal.800'] = '#031d21', + ['teal.830'] = '#02191d', + ['teal.860'] = '#021619', + ['teal.900'] = '#011215', + ['white.100'] = '#ffffff', + ['white.130'] = '#ffffff', + ['white.160'] = '#ffffff', + ['white.200'] = '#ffffff', + ['white.230'] = '#ffffff', + ['white.260'] = '#ffffff', + ['white.300'] = '#ffffff', + ['white.330'] = '#ffffff', + ['white.345'] = '#ffffff', + ['white.360'] = '#ffffff', + ['white.400'] = '#ffffff', + ['white.430'] = '#ffffff', + ['white.460'] = '#ffffff', + ['white.500'] = '#ffffff', + ['white.530'] = '#e8e8e8', + ['white.560'] = '#cfcfcf', + ['white.600'] = '#adadad', + ['white.630'] = '#969696', + ['white.660'] = '#838383', + ['white.700'] = '#666666', + ['white.730'] = '#5f5f5f', + ['white.760'] = '#585858', + ['white.800'] = '#4d4d4d', + ['white.830'] = '#3b3b3b', + ['white.860'] = '#262626', + ['white.900'] = '#0d0d0d', + ['black.100'] = '#f2f2f2', + ['black.130'] = '#e8e8e8', + ['black.160'] = '#dadada', + ['black.200'] = '#cccccc', + ['black.230'] = '#bdbdbd', + ['black.260'] = '#acacac', + ['black.300'] = '#999999', + ['black.330'] = '#7a7a7a', + ['black.345'] = '#666666', + ['black.360'] = '#5c5c5c', + ['black.400'] = '#333333', + ['black.430'] = '#252525', + ['black.460'] = '#141414', + ['black.500'] = '#000000', + ['black.530'] = '#000000', + ['black.560'] = '#000000', + ['black.600'] = '#000000', + ['black.630'] = '#000000', + ['black.660'] = '#000000', + ['black.700'] = '#000000', + ['black.730'] = '#000000', + ['black.760'] = '#000000', + ['black.800'] = '#000000', + ['black.830'] = '#000000', + ['black.860'] = '#000000', + ['black.900'] = '#000000', + ['brand.100'] = '#f7f7fe', + ['brand.130'] = '#f0f1fe', + ['brand.160'] = '#e7e9fd', + ['brand.200'] = '#dee0fc', + ['brand.230'] = '#d4d7fc', + ['brand.260'] = '#c9cdfb', + ['brand.300'] = '#bcc1fa', + ['brand.330'] = '#a8aff8', + ['brand.345'] = '#9ba3f7', + ['brand.360'] = '#949cf7', + ['brand.400'] = '#7984f5', + ['brand.430'] = '#707bf4', + ['brand.460'] = '#6571f3', + ['brand.500'] = '#5865f2', + ['brand.530'] = '#505cdc', + ['brand.560'] = '#4752c4', + ['brand.600'] = '#3c45a5', + ['brand.630'] = '#343b8f', + ['brand.660'] = '#2d347d', + ['brand.700'] = '#232861', + ['brand.730'] = '#21265b', + ['brand.760'] = '#1e2353', + ['brand.800'] = '#1a1e49', + ['brand.830'] = '#141738', + ['brand.860'] = '#0d0f24', + ['brand.900'] = '#04050c', + ['primary.100'] = '#f9f9f9', + ['primary.130'] = '#f2f3f5', + ['primary.160'] = '#ebedef', + ['primary.200'] = '#e3e5e8', + ['primary.230'] = '#dbdee1', + ['primary.260'] = '#d2d5d9', + ['primary.300'] = '#c4c9ce', + ['primary.330'] = '#b5bac1', + ['primary.345'] = '#a5abb3', + ['primary.360'] = '#949ba4', + ['primary.400'] = '#80848e', + ['primary.430'] = '#6d6f78', + ['primary.460'] = '#5c5e66', + ['primary.500'] = '#4e5058', + ['primary.530'] = '#41434a', + ['primary.560'] = '#383a40', + ['primary.600'] = '#313338', + ['primary.630'] = '#2b2d31', + ['primary.645'] = '#282a2e', + ['primary.660'] = '#232428', + ['primary.700'] = '#1e1f22', + ['primary.730'] = '#1a1b1e', + ['primary.760'] = '#161719', + ['primary.800'] = '#111214', + ['primary.830'] = '#0c0c0d', + ['primary.860'] = '#060607', + ['primary.900'] = '#020202', + ['plum.0'] = '#f9f9fa', + ['plum.1'] = '#f3f3f4', + ['plum.2'] = '#ecedef', + ['plum.3'] = '#e4e5e8', + ['plum.4'] = '#dddee1', + ['plum.5'] = '#d3d5d9', + ['plum.6'] = '#c7c8ce', + ['plum.7'] = '#b8bac1', + ['plum.8'] = '#a8aab4', + ['plum.9'] = '#9597a3', + ['plum.10'] = '#828391', + ['plum.11'] = '#6d6f7e', + ['plum.12'] = '#5c5d6e', + ['plum.13'] = '#4e4f5f', + ['plum.14'] = '#414252', + ['plum.15'] = '#383948', + ['plum.16'] = '#31323f', + ['plum.17'] = '#2b2c38', + ['plum.18'] = '#262732', + ['plum.19'] = '#21222b', + ['plum.20'] = '#1c1d26', + ['plum.21'] = '#181921', + ['plum.22'] = '#15161d', + ['plum.23'] = '#121319', + ['plum.24'] = '#0f1015', + ['plum.25'] = '#0c0c10', + ['plum.26'] = '#08080b', +} + +M.themes = {} + +M.themes.darker = { + bg_primary = M.colors['plum.20'], + bg_secondary = M.colors['plum.18'], +} + +return M diff --git a/lua/phoenix/blurple/ex_colors.lua b/lua/phoenix/blurple/ex_colors.lua new file mode 100644 index 00000000..939b3b11 --- /dev/null +++ b/lua/phoenix/blurple/ex_colors.lua @@ -0,0 +1,301 @@ +local M = {} + +M.colors = { + ['red.100'] = '#fef8f9', + ['red.130'] = '#fef4f4', + ['red.160'] = '#feeaea', + ['red.200'] = '#fdddde', + ['red.230'] = '#fbcdce', + ['red.260'] = '#fbbabb', + ['red.300'] = '#fba6a8', + ['red.330'] = '#fa9193', + ['red.345'] = '#fa777b', + ['red.360'] = '#f85b5f', + ['red.400'] = '#f23f43', + ['red.430'] = '#da373c', + ['red.460'] = '#bb3033', + ['red.500'] = '#a12829', + ['red.530'] = '#8f2022', + ['red.560'] = '#7f1c1e', + ['red.600'] = '#70181a', + ['red.630'] = '#651517', + ['red.660'] = '#5a1314', + ['red.700'] = '#501012', + ['red.730'] = '#460e0f', + ['red.760'] = '#3f0b0c', + ['red.800'] = '#360a0b', + ['red.830'] = '#2e090a', + ['red.860'] = '#280808', + ['red.900'] = '#220606', + ['orange.100'] = '#fff8f5', + ['orange.130'] = '#fff4ed', + ['orange.160'] = '#feeadf', + ['orange.200'] = '#fddecd', + ['orange.230'] = '#fccfb2', + ['orange.260'] = '#fcbd95', + ['orange.300'] = '#fbab70', + ['orange.330'] = '#fa9746', + ['orange.345'] = '#f1882a', + ['orange.360'] = '#db7628', + ['orange.400'] = '#c46926', + ['orange.430'] = '#ac591f', + ['orange.460'] = '#9b4c19', + ['orange.500'] = '#8c4013', + ['orange.530'] = '#7b3710', + ['orange.560'] = '#6d300e', + ['orange.600'] = '#5f2b0b', + ['orange.630'] = '#56260a', + ['orange.660'] = '#4c2209', + ['orange.700'] = '#431e09', + ['orange.730'] = '#3b1a07', + ['orange.760'] = '#331606', + ['orange.800'] = '#2d1305', + ['orange.830'] = '#261005', + ['orange.860'] = '#200e05', + ['orange.900'] = '#190d04', + ['yellow.100'] = '#fff8ef', + ['yellow.130'] = '#fff4e8', + ['yellow.160'] = '#ffebd3', + ['yellow.200'] = '#fee0b6', + ['yellow.230'] = '#fdd18c', + ['yellow.260'] = '#fcc145', + ['yellow.300'] = '#f0b232', + ['yellow.330'] = '#e1a42a', + ['yellow.345'] = '#d49824', + ['yellow.360'] = '#bf861c', + ['yellow.400'] = '#af7615', + ['yellow.430'] = '#9a650d', + ['yellow.460'] = '#8a5709', + ['yellow.500'] = '#7c4b04', + ['yellow.530'] = '#6d4104', + ['yellow.560'] = '#613803', + ['yellow.600'] = '#543203', + ['yellow.630'] = '#4c2d03', + ['yellow.660'] = '#432803', + ['yellow.700'] = '#3b2303', + ['yellow.730'] = '#351e02', + ['yellow.760'] = '#2e1a02', + ['yellow.800'] = '#271602', + ['yellow.830'] = '#221302', + ['yellow.860'] = '#1c1002', + ['yellow.900'] = '#160e02', + ['green.100'] = '#ecfef1', + ['green.130'] = '#defee7', + ['green.160'] = '#bdfcd3', + ['green.200'] = '#88fbb5', + ['green.230'] = '#58f39c', + ['green.260'] = '#48e58b', + ['green.300'] = '#3bd67f', + ['green.330'] = '#2dc771', + ['green.345'] = '#26b968', + ['green.360'] = '#23a55a', + ['green.400'] = '#24934e', + ['green.430'] = '#248045', + ['green.460'] = '#1f703c', + ['green.500'] = '#1a6334', + ['green.530'] = '#15562b', + ['green.560'] = '#124c24', + ['green.600'] = '#0e431f', + ['green.630'] = '#0c3c1c', + ['green.660'] = '#0a3618', + ['green.700'] = '#072f15', + ['green.730'] = '#052910', + ['green.760'] = '#03240e', + ['green.800'] = '#031f0c', + ['green.830'] = '#031b0a', + ['green.860'] = '#041708', + ['green.900'] = '#051307', + ['blue.100'] = '#f6fafe', + ['blue.130'] = '#f0f7fe', + ['blue.160'] = '#e2f0fd', + ['blue.200'] = '#cde8fd', + ['blue.230'] = '#b2ddfc', + ['blue.260'] = '#94d2fc', + ['blue.300'] = '#66c4fd', + ['blue.330'] = '#2eb6ff', + ['blue.345'] = '#00aafc', + ['blue.360'] = '#0097f2', + ['blue.400'] = '#0082eb', + ['blue.430'] = '#006be7', + ['blue.460'] = '#005cd1', + ['blue.500'] = '#0051b6', + ['blue.530'] = '#00489b', + ['blue.560'] = '#004088', + ['blue.600'] = '#003976', + ['blue.630'] = '#00336a', + ['blue.660'] = '#002d5f', + ['blue.700'] = '#002855', + ['blue.730'] = '#002348', + ['blue.760'] = '#001e3f', + ['blue.800'] = '#001a36', + ['blue.830'] = '#001630', + ['blue.860'] = '#00132b', + ['blue.900'] = '#001024', + ['teal.100'] = '#f4fbfd', + ['teal.130'] = '#e9f9fd', + ['teal.160'] = '#d3f4fb', + ['teal.200'] = '#b1eff9', + ['teal.230'] = '#7ee7f7', + ['teal.260'] = '#5edbef', + ['teal.300'] = '#47cbe2', + ['teal.330'] = '#35bcd5', + ['teal.345'] = '#2eb0c9', + ['teal.360'] = '#289fb6', + ['teal.400'] = '#248da1', + ['teal.430'] = '#207a8d', + ['teal.460'] = '#1b6b7c', + ['teal.500'] = '#175e6d', + ['teal.530'] = '#13525f', + ['teal.560'] = '#0f4954', + ['teal.600'] = '#0c4049', + ['teal.630'] = '#0a3942', + ['teal.660'] = '#08333a', + ['teal.700'] = '#062d34', + ['teal.730'] = '#05272d', + ['teal.760'] = '#042227', + ['teal.800'] = '#031d21', + ['teal.830'] = '#02191d', + ['teal.860'] = '#021619', + ['teal.900'] = '#011215', + ['white.100'] = '#ffffff', + ['white.130'] = '#ffffff', + ['white.160'] = '#ffffff', + ['white.200'] = '#ffffff', + ['white.230'] = '#ffffff', + ['white.260'] = '#ffffff', + ['white.300'] = '#ffffff', + ['white.330'] = '#ffffff', + ['white.345'] = '#ffffff', + ['white.360'] = '#ffffff', + ['white.400'] = '#ffffff', + ['white.430'] = '#ffffff', + ['white.460'] = '#ffffff', + ['white.500'] = '#ffffff', + ['white.530'] = '#e8e8e8', + ['white.560'] = '#cfcfcf', + ['white.600'] = '#adadad', + ['white.630'] = '#969696', + ['white.660'] = '#838383', + ['white.700'] = '#666666', + ['white.730'] = '#5f5f5f', + ['white.760'] = '#585858', + ['white.800'] = '#4d4d4d', + ['white.830'] = '#3b3b3b', + ['white.860'] = '#262626', + ['white.900'] = '#0d0d0d', + ['black.100'] = '#f2f2f2', + ['black.130'] = '#e8e8e8', + ['black.160'] = '#dadada', + ['black.200'] = '#cccccc', + ['black.230'] = '#bdbdbd', + ['black.260'] = '#acacac', + ['black.300'] = '#999999', + ['black.330'] = '#7a7a7a', + ['black.345'] = '#666666', + ['black.360'] = '#5c5c5c', + ['black.400'] = '#333333', + ['black.430'] = '#252525', + ['black.460'] = '#141414', + ['black.500'] = '#000000', + ['black.530'] = '#000000', + ['black.560'] = '#000000', + ['black.600'] = '#000000', + ['black.630'] = '#000000', + ['black.660'] = '#000000', + ['black.700'] = '#000000', + ['black.730'] = '#000000', + ['black.760'] = '#000000', + ['black.800'] = '#000000', + ['black.830'] = '#000000', + ['black.860'] = '#000000', + ['black.900'] = '#000000', + ['brand.100'] = '#f7f7fe', + ['brand.130'] = '#f0f1fe', + ['brand.160'] = '#e7e9fd', + ['brand.200'] = '#dee0fc', + ['brand.230'] = '#d4d7fc', + ['brand.260'] = '#c9cdfb', + ['brand.300'] = '#bcc1fa', + ['brand.330'] = '#a8aff8', + ['brand.345'] = '#9ba3f7', + ['brand.360'] = '#949cf7', + ['brand.400'] = '#7984f5', + ['brand.430'] = '#707bf4', + ['brand.460'] = '#6571f3', + ['brand.500'] = '#5865f2', + ['brand.530'] = '#505cdc', + ['brand.560'] = '#4752c4', + ['brand.600'] = '#3c45a5', + ['brand.630'] = '#343b8f', + ['brand.660'] = '#2d347d', + ['brand.700'] = '#232861', + ['brand.730'] = '#21265b', + ['brand.760'] = '#1e2353', + ['brand.800'] = '#1a1e49', + ['brand.830'] = '#141738', + ['brand.860'] = '#0d0f24', + ['brand.900'] = '#04050c', + ['primary.100'] = '#f9f9f9', + ['primary.130'] = '#f2f3f5', + ['primary.160'] = '#ebedef', + ['primary.200'] = '#e3e5e8', + ['primary.230'] = '#dbdee1', + ['primary.260'] = '#d2d5d9', + ['primary.300'] = '#c4c9ce', + ['primary.330'] = '#b5bac1', + ['primary.345'] = '#a5abb3', + ['primary.360'] = '#949ba4', + ['primary.400'] = '#80848e', + ['primary.430'] = '#6d6f78', + ['primary.460'] = '#5c5e66', + ['primary.500'] = '#4e5058', + ['primary.530'] = '#41434a', + ['primary.560'] = '#383a40', + ['primary.600'] = '#313338', + ['primary.630'] = '#2b2d31', + ['primary.645'] = '#282a2e', + ['primary.660'] = '#232428', + ['primary.700'] = '#1e1f22', + ['primary.730'] = '#1a1b1e', + ['primary.760'] = '#161719', + ['primary.800'] = '#111214', + ['primary.830'] = '#0c0c0d', + ['primary.860'] = '#060607', + ['primary.900'] = '#020202', + ['plum.0'] = '#f9f9fa', + ['plum.1'] = '#f3f3f4', + ['plum.2'] = '#ecedef', + ['plum.3'] = '#e4e5e8', + ['plum.4'] = '#dddee1', + ['plum.5'] = '#d3d5d9', + ['plum.6'] = '#c7c8ce', + ['plum.7'] = '#b8bac1', + ['plum.8'] = '#a8aab4', + ['plum.9'] = '#9597a3', + ['plum.10'] = '#828391', + ['plum.11'] = '#6d6f7e', + ['plum.12'] = '#5c5d6e', + ['plum.13'] = '#4e4f5f', + ['plum.14'] = '#414252', + ['plum.15'] = '#383948', + ['plum.16'] = '#31323f', + ['plum.17'] = '#2b2c38', + ['plum.18'] = '#262732', + ['plum.19'] = '#21222b', + ['plum.20'] = '#1c1d26', + ['plum.21'] = '#181921', + ['plum.22'] = '#15161d', + ['plum.23'] = '#121319', + ['plum.24'] = '#0f1015', + ['plum.25'] = '#0c0c10', + ['plum.26'] = '#08080b', +} + +M.themes = {} + +M.themes.darker = { + bg_primary = M.colors['plum.20'], + bg_secondary = M.colors['plum.18'], +} + +return M diff --git a/lua/phoenix/plugins/autocomplete.lua b/lua/phoenix/plugins/autocomplete.lua new file mode 100644 index 00000000..3330792e --- /dev/null +++ b/lua/phoenix/plugins/autocomplete.lua @@ -0,0 +1,112 @@ +return { + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'petertriho/cmp-git', + }, + config = function() + -- [[ Configure nvim-cmp ]] + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + require('luasnip.loaders.from_vscode').lazy_load() + luasnip.config.setup {} + + cmp.setup { + view = { + entries = { name = 'custom', selection_order = 'near_cursor' }, + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm({ select = true }), + + -- [''] = cmp.mapping(function(fallback) + -- if cmp.visible() and cmp.get_active_entry() then + -- cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true } + -- else + -- fallback() + -- end + -- end, { 'i', 's' }), + -- [''] = cmp.mapping(function(fallback) + -- if cmp.visible() and has_words_before() then + -- cmp.select_next_item() + -- elseif luasnip.expand_or_locally_jumpable() then + -- luasnip.expand_or_jump() + -- else + -- fallback() + -- end + -- end, { 'i', 's' }), + -- [''] = cmp.mapping(function(fallback) + -- if cmp.visible() then + -- cmp.select_prev_item() + -- elseif luasnip.locally_jumpable(-1) then + -- luasnip.jump(-1) + -- else + -- fallback() + -- end + -- end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp', priority = 100 }, + -- { name = 'luasnip' }, + { name = 'buffer', keyword_length = 3 }, + { name = 'path' }, + }, + } + + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = 'buffer' }, + }), + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' }, + }, + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' }, + }, { + { name = 'cmdline' }, + }), + }) + end, + }, +} diff --git a/lua/phoenix/plugins/autopairs.lua b/lua/phoenix/plugins/autopairs.lua new file mode 100644 index 00000000..4082bd88 --- /dev/null +++ b/lua/phoenix/plugins/autopairs.lua @@ -0,0 +1,6 @@ +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup {} + end, +} diff --git a/lua/phoenix/plugins/copilot.lua b/lua/phoenix/plugins/copilot.lua new file mode 100644 index 00000000..1db13685 --- /dev/null +++ b/lua/phoenix/plugins/copilot.lua @@ -0,0 +1,65 @@ +return { + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = "InsertEnter", + build = ':Copilot auth', + config = function() + require('copilot').setup { + -- panel = { + -- enabled = false, -- using nvim-cmp to do this + -- -- enabled = true, + -- -- keymap = { open = '' }, + -- -- layout = { position = "right", ratio = 0.2 } + -- }, + suggestion = { enabled = true, auto_trigger = true, keymap = { accept = '' } }, + -- filetypes = { markdown = true, gitcommit = true, help = true }, + } + end, + }, + { + 'CopilotC-Nvim/CopilotChat.nvim', + branch = 'canary', + dependencies = { + { 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim + { 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper + }, + opts = {}, + keys = { + -- lazy.nvim keys + + -- Quick chat with Copilot + { + 'ccq', + function() + local input = vim.fn.input 'Quick Chat: ' + if input ~= '' then + require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) + end + end, + desc = 'CopilotChat - Quick chat', + }, + + -- lazy.nvim keys + + -- Show help actions with telescope + { + 'cch', + function() + local actions = require 'CopilotChat.actions' + require('CopilotChat.integrations.telescope').pick(actions.help_actions()) + end, + desc = 'CopilotChat - Help actions', + }, + -- Show prompts actions with telescope + { + 'ccp', + function() + local actions = require 'CopilotChat.actions' + require('CopilotChat.integrations.telescope').pick(actions.prompt_actions()) + end, + desc = 'CopilotChat - Prompt actions', + }, + }, + }, +} diff --git a/lua/phoenix/plugins/hop.lua b/lua/phoenix/plugins/hop.lua new file mode 100644 index 00000000..e4d6f176 --- /dev/null +++ b/lua/phoenix/plugins/hop.lua @@ -0,0 +1,9 @@ +return { + "phaazon/hop.nvim", + config = function() + require("hop").setup { + keys = "arstgmneiodh", + } + vim.keymap.set("n", "", "lua require'hop'.hint_words()", { noremap = true, silent = true }) + end +} diff --git a/lua/phoenix/plugins/init.lua b/lua/phoenix/plugins/init.lua new file mode 100644 index 00000000..32a0f634 --- /dev/null +++ b/lua/phoenix/plugins/init.lua @@ -0,0 +1,12 @@ +return { + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end + } +} diff --git a/lua/phoenix/plugins/lspsaga.lua b/lua/phoenix/plugins/lspsaga.lua new file mode 100644 index 00000000..0b41664b --- /dev/null +++ b/lua/phoenix/plugins/lspsaga.lua @@ -0,0 +1,38 @@ +local keymap = require 'phoenix.utils.keymap' + +return { + 'nvimdev/lspsaga.nvim', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-tree/nvim-web-devicons', + }, + config = function() + require('lspsaga').setup { + symbol_in_winbar = { + enable = false, + separator = ' › ', + hide_keyword = false, + show_file = true, + folder_level = 2, + color_mode = true, + delay = 300, + }, + lightbulb = { + enable = false, + sign = true, + debounce = 10, + sign_priority = 40, + virtual_text = false, + enable_in_insert = true, + }, + ui = { + code_action = "·", + devicon = false + } + } + + + keymap('n', 'lo', ':Lspsaga outline') + keymap('n', 'lf', ':Lspsaga finder') + end, +} diff --git a/lua/phoenix/plugins/lualine.lua b/lua/phoenix/plugins/lualine.lua new file mode 100644 index 00000000..3496561f --- /dev/null +++ b/lua/phoenix/plugins/lualine.lua @@ -0,0 +1,138 @@ +local colors = require('phoenix.bleed-purple.colors').dark +local fish_like_path = require 'phoenix.utils.fish_like_path' + +local dark_theme = { + normal = { + a = { bg = colors.bmagenta, fg = colors.bblack, gui = 'bold' }, + b = { bg = colors.bblack, fg = colors.black }, + c = { bg = colors.status_bg, fg = colors.white }, + }, + insert = { a = { bg = colors.green, fg = colors.black, gui = 'bold' } }, + visual = { a = { bg = colors.yellow, fg = colors.black, gui = 'bold' } }, + replace = { a = { bg = colors.red, fg = colors.black, gui = 'bold' } }, + command = { a = { bg = colors.bblue, fg = colors.black, gui = 'bold' } }, + inactive = { + a = { bg = colors.status_bg, fg = colors.dimmed_text }, + b = { bg = colors.status_bg, fg = colors.dimmed_text }, + c = { bg = colors.status_bg, fg = colors.dimmed_text }, + }, +} + +local light_theme = { + normal = { + a = { bg = colors.bmagenta, fg = colors.bblack, gui = 'bold' }, + b = { bg = colors.bgreen, fg = colors.black }, + c = { bg = colors.white, fg = colors.black }, + }, + insert = { a = { bg = colors.green, fg = colors.black, gui = 'bold' } }, + visual = { a = { bg = colors.yellow, fg = colors.black, gui = 'bold' } }, + replace = { a = { bg = colors.red, fg = colors.black, gui = 'bold' } }, + command = { a = { bg = colors.bblue, fg = colors.black, gui = 'bold' } }, + inactive = { + a = { bg = colors.white, fg = colors.dimmed_text }, + b = { bg = colors.white, fg = colors.dimmed_text }, + c = { bg = colors.white, fg = colors.dimmed_text }, + }, +} + +local file_status = function(is_modified) + if is_modified then + return '·' + else + return '' + end +end + +local fishpath = function(level) + return function() + local path = fish_like_path(vim.fn.expand '%:p', level) + local status = file_status(vim.bo.modified) + + if #status == 0 then + return path + end + + return path .. ' ' .. status + end +end + +local get_theme = function(bg) + if bg == 'light' then + return light_theme + end + return dark_theme +end + +vim.cmd [[ +autocmd ColorScheme * lua require'phoenix.plugins.lualine'.config() +autocmd OptionSet background lua require'phoenix.plugins.lualine'.config() +]] + +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + config = function() + require('lualine').setup { + options = { + icons_enabled = false, + globalstatus = true, + -- theme = 'onedark', + component_separators = '|', + section_separators = '', + -- theme = get_theme(vim.o.background), + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'diff' }, + lualine_c = { fishpath(4) }, + lualine_x = { 'filetype' }, + lualine_y = {}, + lualine_z = { 'location' }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { fishpath(2) }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {}, + }, + winbar = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { fishpath(3) }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + inactive_winbar = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { fishpath(3) }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + tabline = { + lualine_a = { + { + 'tabs', + mode = 1, + max_length = vim.o.columns / 3, + tabs_color = { + -- Same values as the general color option can be used here. + -- active = 'TabLineSel', -- Color for active tab. + -- inactive = 'TabLine', -- Color for inactive tab. + }, + }, + }, + lualine_b = {}, + lualine_c = {}, + -- lualine_x = { "require'phoenix.utils.lsp'.get_attached_clients()" }, + -- lualine_y = {"require'lsp-status'.status()"}, + lualine_z = { { 'branch', icons_enabled = true } }, + }, + } + end, +} diff --git a/lua/phoenix/plugins/neo-tree.lua b/lua/phoenix/plugins/neo-tree.lua new file mode 100644 index 00000000..2ef5848b --- /dev/null +++ b/lua/phoenix/plugins/neo-tree.lua @@ -0,0 +1,65 @@ +local keymap = require 'phoenix.utils.keymap' + +return { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + { + -- only needed if you want to use the commands with "_with_window_picker" suffix + 's1n7ax/nvim-window-picker', + name = 'window-picker', + event = 'VeryLazy', + version = '2.*', + config = function() + require('window-picker').setup { + hint = 'statusline-winbar', + selection_chars = 'arstgmneiodh', + + autoselect_one = true, + include_current_win = false, + filter_rules = { + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { 'neo-tree', 'neo-tree-popup', 'notify' }, + + -- if the buffer type is one of following, the window will be ignored + buftype = { 'terminal', 'quickfix' }, + }, + }, + -- other_win_hl_color = '#e35e4f', + } + end, + }, + }, + config = function() + -- Unless you are still migrating, remove the deprecated commands from v1.x + vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]] + + require('neo-tree').setup { + window = { + position = 'left', + }, + filesystem = { + bind_to_cwd = true, + cwd_target = { + sidebar = 'window', + current = 'window', + float = "window" + }, + window = { + mappings = { + ['o'] = 'open', + }, + }, + }, + } + + keymap('n', 'kk', ':Neotree toggle reveal_force_cwd position=float') + keymap('n', 'kc', ':Neotree toggle position=current') + keymap('n', 'kb', ':Neotree toggle reveal position=left') + keymap('n', 'kq', ':Neotree close') + end, +} diff --git a/lua/phoenix/plugins/neoconf.lua b/lua/phoenix/plugins/neoconf.lua new file mode 100644 index 00000000..e6367425 --- /dev/null +++ b/lua/phoenix/plugins/neoconf.lua @@ -0,0 +1,3 @@ +return { + "folke/neoconf.nvim" +} diff --git a/lua/phoenix/plugins/neogen.lua b/lua/phoenix/plugins/neogen.lua new file mode 100644 index 00000000..8490aeda --- /dev/null +++ b/lua/phoenix/plugins/neogen.lua @@ -0,0 +1,11 @@ +local keymap = require 'phoenix.utils.keymap' + +return { + 'danymat/neogen', + dependencies = 'nvim-treesitter/nvim-treesitter', + config = function() + require("neogen").setup({}) + + keymap('n', 'nf', ":lua require('neogen').generate()") + end, +} diff --git a/lua/phoenix/plugins/null-ls.lua b/lua/phoenix/plugins/null-ls.lua new file mode 100644 index 00000000..4bcdf83b --- /dev/null +++ b/lua/phoenix/plugins/null-ls.lua @@ -0,0 +1,52 @@ +return { + 'nvimtools/none-ls.nvim', + config = function() + local null_ls = require 'null-ls' + local b = null_ls.builtins + + local sources = { + -- formatting + -- b.formatting.prettierd, + b.formatting.biome.with { + condition = function(utils) + return utils.root_has_file { 'biome.jsonc' } + end, + filetypes = { 'javascript', 'javascriptreact', 'json', 'jsonc', 'typescript', 'typescriptreact' }, + args = { + 'check', + '--apply-unsafe', + '--formatter-enabled=true', + '--organize-imports-enabled=true', + '--skip-errors', + '--stdin-file-path=$FILENAME', + }, + }, + b.formatting.stylua.with { + condition = function(utils) + return utils.root_has_file { 'stylua.toml', '.stylua.toml' } + end, + }, + + -- b.formatting.goimports.with({ + -- args = { + -- "-srcdir", "$DIRNAME", "-w", "cmd", "errorutils", "internal", "loaders", "resolvers" + -- } + -- }), + + -- b.formatting.beautysh, + + -- require("typescript.extensions.null-ls.code-actions"), + + -- b.formatting.eslint_d, + + -- b.diagnostics.eslint_d, + -- b.code_actions.eslint_d, + } + + null_ls.setup { + -- debug = true, + sources = sources, + } + end, +} + diff --git a/lua/phoenix/plugins/projectroot.lua b/lua/phoenix/plugins/projectroot.lua new file mode 100644 index 00000000..5cbb3784 --- /dev/null +++ b/lua/phoenix/plugins/projectroot.lua @@ -0,0 +1,10 @@ +return { + "dbakker/vim-projectroot", + config = function() + vim.keymap.set( + "n", + "", + ":ProjectRootExe lua require('telescope.builtin').live_grep({debounce=100})", + { noremap = true, silent = true }) + end +} diff --git a/lua/phoenix/plugins/refactoring.lua b/lua/phoenix/plugins/refactoring.lua new file mode 100644 index 00000000..b0ea3009 --- /dev/null +++ b/lua/phoenix/plugins/refactoring.lua @@ -0,0 +1,14 @@ +local keymap = require 'phoenix.utils.keymap' + +return { + 'ThePrimeagen/refactoring.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + config = function() + require('refactoring').setup {} + -- prompt for a refactor to apply when the remap is triggered + keymap({ 'n', 'x' }, 'rr', require('refactoring').select_refactor) + end, +} diff --git a/lua/phoenix/plugins/tailwindcss-colors.lua b/lua/phoenix/plugins/tailwindcss-colors.lua new file mode 100644 index 00000000..fc4e70f3 --- /dev/null +++ b/lua/phoenix/plugins/tailwindcss-colors.lua @@ -0,0 +1,6 @@ +return { + "themaxmarchuk/tailwindcss-colors.nvim", + config = function() + require("tailwindcss-colors").setup() + end +} diff --git a/lua/phoenix/plugins/toggleterm.lua b/lua/phoenix/plugins/toggleterm.lua new file mode 100644 index 00000000..ff8bdbcf --- /dev/null +++ b/lua/phoenix/plugins/toggleterm.lua @@ -0,0 +1,16 @@ +local keymap = require 'phoenix.utils.keymap' + +return { + 'akinsho/toggleterm.nvim', + config = function() + require('toggleterm').setup { + open_mapping = [[tt]], + insert_mappings = false, + direction = 'float', + shade_terminals = false, + } + + keymap('n', 'tr', ':ToggleTerm 2 direction=vertical', { desc = 'Toggle terminal right' }) + keymap('n', 'tb', ':ToggleTerm 3 direction=horizontal', { desc = 'Toggle terminal bottom' }) + end, +} diff --git a/lua/phoenix/plugins/trouble.lua b/lua/phoenix/plugins/trouble.lua new file mode 100644 index 00000000..ac52ce18 --- /dev/null +++ b/lua/phoenix/plugins/trouble.lua @@ -0,0 +1,38 @@ +---@type function +---comment +---@param mode any +---@param keymap any +---@param trouble_fn any +---@param desc any +local map = function(mode, keymap, trouble_fn, desc) + vim.keymap.set(mode, keymap, function() + require('trouble').open(trouble_fn) + end, { desc = "Trouble: " .. desc }) +end + +return { + 'folke/trouble.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + auto_preview = false, + icons = false, + fold_open = 'v', -- icon used for open folds + fold_closed = '>', -- icon used for closed folds + signs = { + -- icons / text used for a diagnostic + error = 'error', + warning = 'warn', + hint = 'hint', + information = 'info', + }, + use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client + }, + config = function() + map('n', 'xx', nil, "show window") + map('n', 'xw', 'workspace_diagnostics', "show [w]orkspace diagnostics") + map('n', 'xd', 'document_diagnostics', "show [d]ocument diagnostics") + map('n', 'xq', 'quickfix', "show [q]uickfix list") + map('n', 'xl', 'loclist', "show [l]ocation list") + map('n', 'gR', 'lsp_references', "") + end, +} diff --git a/lua/phoenix/plugins/tsc.lua b/lua/phoenix/plugins/tsc.lua new file mode 100644 index 00000000..aa5cb055 --- /dev/null +++ b/lua/phoenix/plugins/tsc.lua @@ -0,0 +1,13 @@ +return { + { + 'dmmulroy/tsc.nvim', + lazy = false, + ft = { 'typescript', 'typescriptreact' }, + config = function() + require('tsc').setup { + auto_open_qflist = true, + pretty_errors = true, + } + end, + }, +} diff --git a/lua/phoenix/plugins/ui.lua b/lua/phoenix/plugins/ui.lua new file mode 100644 index 00000000..1e93dbbb --- /dev/null +++ b/lua/phoenix/plugins/ui.lua @@ -0,0 +1,137 @@ +-- UI related plugins, mostly fancy stuff +return { + -- Better `vim.notify()` + -- { + -- 'rcarriga/nvim-notify', + -- keys = { + -- { + -- 'un', + -- function() + -- require('notify').dismiss { silent = true, pending = true } + -- end, + -- desc = 'Dismiss all Notifications', + -- }, + -- }, + -- opts = { + -- timeout = 3000, + -- max_height = function() + -- return math.floor(vim.o.lines * 0.75) + -- end, + -- max_width = function() + -- return math.floor(vim.o.columns * 0.75) + -- end, + -- }, + -- }, + + -- better vim.ui + { + 'stevearc/dressing.nvim', + config = function() + require('dressing').setup { + input = { + enabled = true, + }, + select = { + enabled = true, + backend = { 'telescope', 'builtin' }, + telescope = require('telescope.themes').get_cursor(), + }, + } + end, + }, + + -- noicer ui + -- { + -- 'folke/noice.nvim', + -- event = 'VeryLazy', + -- opts = { + -- cmdline = { + -- enabled = true, + -- }, + -- lsp = { + -- override = { + -- ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + -- ['vim.lsp.util.stylize_markdown'] = true, + -- ['cmp.entry.get_documentation'] = true, + -- }, + -- }, + -- routes = { + -- { + -- filter = { + -- event = 'msg_show', + -- find = '%d+L, %d+B', + -- }, + -- view = 'mini', + -- }, + -- }, + -- presets = { + -- bottom_search = true, + -- -- command_palette = true, + -- long_message_to_split = true, + -- inc_rename = true, + -- }, + -- }, + -- keys = { + -- { + -- '', + -- function() + -- require('noice').redirect(vim.fn.getcmdline()) + -- end, + -- mode = 'c', + -- desc = 'Redirect Cmdline', + -- }, + -- { + -- 'snl', + -- function() + -- require('noice').cmd 'last' + -- end, + -- desc = 'Noice Last Message', + -- }, + -- { + -- 'snh', + -- function() + -- require('noice').cmd 'history' + -- end, + -- desc = 'Noice History', + -- }, + -- { + -- 'sna', + -- function() + -- require('noice').cmd 'all' + -- end, + -- desc = 'Noice All', + -- }, + -- { + -- 'snd', + -- function() + -- require('noice').cmd 'dismiss' + -- end, + -- desc = 'Dismiss All', + -- }, + -- { + -- '', + -- function() + -- if not require('noice.lsp').scroll(4) then + -- return '' + -- end + -- end, + -- silent = true, + -- expr = true, + -- desc = 'Scroll forward', + -- mode = { 'i', 'n', 's' }, + -- }, + -- { + -- '', + -- function() + -- if not require('noice.lsp').scroll(-4) then + -- return '' + -- end + -- end, + -- silent = true, + -- expr = true, + -- desc = 'Scroll backward', + -- mode = { 'i', 'n', 's' }, + -- }, + -- }, + -- }, +} diff --git a/lua/phoenix/plugins/vim-undodir-tree.lua b/lua/phoenix/plugins/vim-undodir-tree.lua new file mode 100644 index 00000000..53bb5699 --- /dev/null +++ b/lua/phoenix/plugins/vim-undodir-tree.lua @@ -0,0 +1,7 @@ +-- this needs to be here because doing it in init.lua is late for this plugin to work +vim.o.undofile = true +vim.o.undodir = '/tmp/.phoenix/undo' + +return { + 'pixelastic/vim-undodir-tree', +} diff --git a/lua/phoenix/utils/char_at.lua b/lua/phoenix/utils/char_at.lua new file mode 100644 index 00000000..54b9561c --- /dev/null +++ b/lua/phoenix/utils/char_at.lua @@ -0,0 +1,9 @@ +-- Helper function to return a character from a string. +-- @param str {string} +-- @param index {number} +-- @returns {string} +local char_at = function(str, index) + return string.sub(str, index, index) +end + +return char_at diff --git a/lua/phoenix/utils/color.lua b/lua/phoenix/utils/color.lua new file mode 100644 index 00000000..927a2df7 --- /dev/null +++ b/lua/phoenix/utils/color.lua @@ -0,0 +1,45 @@ +local hsl_convert = require 'lush.vivid.hsl.convert' + +local M = {} + +M.hsl = function(h, s, l) + return hsl_convert.hsl_to_hex { h = h, s = s, l = l } +end + +M.hex_to_rgb = function(hex) + hex = hex:gsub('#', '') + return { + r = tonumber('0x' .. hex:sub(1, 2)) / 255, + g = tonumber('0x' .. hex:sub(3, 4)) / 255, + b = tonumber('0x' .. hex:sub(5, 6)) / 255, + } +end + +M.rgb_to_hex = function(rgb) + return string.format('#%02x%02x%02x', rgb.r * 255, rgb.g * 255, rgb.b * 255) +end + +M.rgb_to_hsl = function(rgb) + local r, g, b = rgb.r, rgb.g, rgb.b + local max, min = math.max(r, g, b), math.min(r, g, b) + local h, s, l = (max + min) / 2, (max + min) / 2, (max + min) / 2 + + if max == min then + -- achromatic + h, s = 0, 0 + else + local delta = max - min + s = l > 0.5 and delta / (2 - max - min) or delta / (max + min) + if max == r then + h = (g - b) / delta + (g < b and 6 or 0) + elseif max == g then + h = (b - r) / delta + 2 + elseif max == b then + h = (r - g) / delta + 4 + end + h = h / 6 + end + return { h = h, s = s, l = l } +end + +return M diff --git a/lua/phoenix/utils/fish_like_path.lua b/lua/phoenix/utils/fish_like_path.lua new file mode 100644 index 00000000..4dcde55e --- /dev/null +++ b/lua/phoenix/utils/fish_like_path.lua @@ -0,0 +1,43 @@ +local slice_table = require("phoenix.utils.slice_table") +local char_at = require("phoenix.utils.char_at") + +local shrink_path = function(path) + if char_at(path, 1) == "." then + return char_at(path, 1) .. char_at(path, 2) + else + return char_at(path, 1) + end +end + +local substitute_home = function(path) + return vim.fn.substitute(path, vim.fn.expand("$HOME"), "~", "") +end + +local fish_like_path = function(path, level) + if path == "" then + return "[No Name]" + end + + local paths = vim.fn.split(substitute_home(path), "/") + + if #paths == 0 then + return "/" + elseif #paths == 1 then + if paths[1] == "~" then + return "~/" + else + return path + end + end + + local after = slice_table(paths, -level) + local before = slice_table(paths, 1, -level) + + for key, value in pairs(before) do + before[key] = shrink_path(value) + end + + return vim.fn.join(before, "/") .. "/" .. vim.fn.join(after, "/") +end + +return fish_like_path diff --git a/lua/phoenix/utils/keymap.lua b/lua/phoenix/utils/keymap.lua new file mode 100644 index 00000000..2b238009 --- /dev/null +++ b/lua/phoenix/utils/keymap.lua @@ -0,0 +1,14 @@ +---@param mode string Mode short-name, see |nvim_set_keymap()|. Can also be list of modes to create mapping on multiple modes. +---@param lhs string|table Left-hand side |{lhs}| of the mapping. +---@param rhs string|function Right-hand side |{rhs}| of the mapping, can be a Lua function. +---@param opts table|nil Table of |:map-arguments|. Defaults to `{noremap = true, silent = true}`. +---@see |nvim_set_keymap()| +local keymap = function(mode, key, action, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend('force', options, opts) + end + vim.keymap.set(mode, key, action, options) +end + +return keymap diff --git a/lua/phoenix/utils/slice_table.lua b/lua/phoenix/utils/slice_table.lua new file mode 100644 index 00000000..a10e5a0a --- /dev/null +++ b/lua/phoenix/utils/slice_table.lua @@ -0,0 +1,36 @@ +local checkers = require("phoenix.utils.type-checkers") + +-- Returns a shallow copy of a portion of a table into a new table +-- @param obj {table} +-- @param start {number} start value +-- @param finish {number} end value +-- @return {boolean} +local slice_table = function(obj, start, finish) + if checkers.is_empty(obj) or start == finish then + return {} + end + + local output = {} + local _finish = #obj + local _start = 1 + + if start >= 0 then + _start = start + elseif checkers.is_nil(finish) and start < 0 then + _start = #obj + start + 1 + end + + if finish and finish >= 0 then + _finish = finish - 1 + elseif finish and finish < 0 then + _finish = #obj + finish + end + + for i = _start, _finish do + table.insert(output, obj[i]) + end + + return output +end + +return slice_table diff --git a/lua/phoenix/utils/type-checkers.lua b/lua/phoenix/utils/type-checkers.lua new file mode 100644 index 00000000..85ca423b --- /dev/null +++ b/lua/phoenix/utils/type-checkers.lua @@ -0,0 +1,43 @@ +local checkers = {} + +-- Helper function to check if value passed by parameter is a table +-- @obj {table} +-- @returns {boolean} +checkers.is_table = function(obj) + return type(obj) == "table" +end + +-- Verify if table object works as an array +-- @param obj {table} +-- @return {boolean} +checkers.is_array = function(obj) + if not checkers.is_table(obj) then + return false + end + + local i = 0 + for _ in pairs(obj) do + i = i + 1 + if obj[i] == nil then + return false + end + end + + return true +end + +-- Checks wether value is nil +-- @obj {any} +-- @returns {boolean} +checkers.is_nil = function(value) + return value == nil +end + +-- Checks if parameter is an empty table +-- @param obj {table} +-- @return {boolean} +checkers.is_empty = function(obj) + return checkers.is_array(obj) and #obj == 0 +end + +return checkers