diff --git a/nvim/.luarc.json b/nvim/.luarc.json index ca7354a..babb57f 100644 --- a/nvim/.luarc.json +++ b/nvim/.luarc.json @@ -1,13 +1,15 @@ { "runtime.version": "LuaJIT", "runtime.path": ["lua/?.lua", "lua/?/init.lua"], - "diagnostics.globals": ["vim", - "ipairs", - "require", - "pairs", - "type", - "unpack", - "table"], + "diagnostics.globals": [ + "vim", + "ipairs", + "require", + "pairs", + "type", + "unpack", + "table" + ], "workspace.checkThirdParty": false, "workspace.library": ["$VIMRUNTIME", "./lua"] } diff --git a/nvim/lua/config/colorscheme.lua b/nvim/lua/config/colorscheme.lua index c1f7111..2bc3a67 100644 --- a/nvim/lua/config/colorscheme.lua +++ b/nvim/lua/config/colorscheme.lua @@ -1,25 +1,26 @@ return { flavour = "mocha", + transparent_background = true, color_overrides = { mocha = { - base = '#0E1019', - mantle = '#0D0F17', - crust = '#0C0D14', - surface0 = '#1a1c2d', - surface1 = '#343959', - surface2 = '#41476F', - overlay0 = '#3F4256', - overlay1 = '#5B5F7C', - overlay2 = '#767BA0', - text = '#eceef4', - } + base = "#0E1019", + mantle = "#0D0F17", + crust = "#0C0D14", + surface0 = "#1a1c2d", + surface1 = "#343959", + surface2 = "#41476F", + overlay0 = "#3F4256", + overlay1 = "#5B5F7C", + overlay2 = "#767BA0", + text = "#eceef4", + }, }, no_italic = true, no_bold = true, highlight_overrides = { mocha = function(colors) return { - Visual = { bg = colors.overlay1 }, + Visual = { bg = colors.overlay1 }, -- Floating windows NormalFloat = { fg = colors.text, bg = colors.mantle }, @@ -39,7 +40,7 @@ return { -- indent lines IblScope = { fg = colors.surface0 }, - IncSearch = { bg = colors.yellow }, + IncSearch = { bg = colors.yellow }, -- LSP -- LspReferenceText = { bg = colors.surface0 }, @@ -57,13 +58,13 @@ return { TelescopeSelection = { fg = colors.text, bg = colors.surface0 }, -- Statusline - StatusLine = { fg = colors.text, bg = colors.mantle }, - StatusLineNormal = { fg = colors.text, bg = colors.mantle }, - StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle }, + StatusLine = { fg = colors.text, bg = colors.mantle }, + StatusLineNormal = { fg = colors.text, bg = colors.mantle }, + StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle }, StatusLineInsert = { fg = colors.base, bg = colors.blue }, StatusLineVisual = { fg = colors.base, bg = colors.mauve }, StatusLineCommand = { fg = colors.base, bg = colors.yellow }, - StatusLineReplace = { fg = colors.base, bg = colors.maroon }, + StatusLineReplace = { fg = colors.base, bg = colors.maroon }, -- Syntax PreProc = { link = "Include" }, @@ -101,7 +102,7 @@ return { ["@namespace_name.php"] = { link = "@text" }, ["@namespace_alias.php"] = { link = "@text" }, } - end + end, }, integrations = { cmp = true, @@ -111,6 +112,6 @@ return { noice = true, telescope = { enabled = true, - } - } + }, + }, } diff --git a/nvim/lua/config/conform.lua b/nvim/lua/config/conform.lua index f8e476f..1ed2147 100644 --- a/nvim/lua/config/conform.lua +++ b/nvim/lua/config/conform.lua @@ -1,13 +1,13 @@ return { - format_options = { - async = true, - lsp_fallback = true, - }, - notify_on_error = true, - formatters_by_ft = { - bash = { "shfmt" }, - blade = { "blade-formatter" }, - lua = { "stylua" }, - ["_"] = { "prettier" } - } + format_options = { + async = true, + lsp_fallback = true, + }, + notify_on_error = true, + formatters_by_ft = { + bash = { "shfmt" }, + blade = { "blade-formatter" }, + lua = { "stylua" }, + ["_"] = { "prettier" }, + }, } diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index c48b41d..bd565bb 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -1,5 +1,6 @@ local cmd = vim.cmd local buffers = require('utils.buffers') +local telescope = require('utils.telescope') return { leader = " ", @@ -62,8 +63,7 @@ return { { 'n', "", "^=$" }, { 'x', "", "=", { desc = "auto indent selection" } }, { "i", "", "", { desc = "delete indent" } }, - - { 'n', "fs", [[:%s/\s\+$//g`']], desc = "Remove trailing spaces" }, + { 'n', "fs", [[:%s/\s\+$//g`']], { desc = "Remove trailing spaces" } }, -- fix paste -- {'n', "p", "p=$"}, @@ -95,16 +95,17 @@ return { }, whichkey = { mode = { "n", "v", "x" }, - ["r"] = { name = "+Rename" }, - ["b"] = { name = "+Buffers" }, - ["f"] = { name = "+Format" }, - ["fc"] = { name = "+Case" }, + ["r"] = { name = "+Rename" }, + ["b"] = { name = "+Buffers" }, + ["f"] = { name = "+Format" }, + ["fc"] = { name = "+Case" }, ["fcs"] = { name = "+snake_case" }, - ["fh"] = { name = "+Hex" }, - ["F"] = { name = "+Files" }, - ["d"] = { name = "+Diagnostics" }, - ["s"] = { name = "+Search" }, - ["g"] = { name = "+Git" }, + ["fh"] = { name = "+Hex" }, + ["F"] = { name = "+Files" }, + ["d"] = { name = "+Diagnostics" }, + ["s"] = { name = "+Search" }, + ["c"] = { name = "+Code" }, + ["g"] = { name = "+Git" }, }, oil = { { '.', function() require('oil').open_float() end, { desc = "Open parent directory" } } @@ -129,23 +130,22 @@ return { -- Keybinds for buffers with an LSP client attached lsp = { { 'K', function() vim.lsp.buf.hover() end, desc = '' }, - { 'ca', function() vim.lsp.buf.code_action() end, desc = 'Code action' }, + { 'ca', function() vim.lsp.buf.code_action() end, mode={'n', 'x'}, desc = 'Code action' }, { 'rs', function() vim.lsp.buf.rename() end, desc = 'Rename symbol' }, - { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, - { 'ss', 'Telescope lsp_document_symbols', desc = 'Search document symbols' }, - { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, - { 'si', 'Telescope lsp_implementations', desc = 'Search Inplementations' }, - { 'sp', 'Telescope lsp_workspace_symbols', desc = 'Search Workspace symbols' }, - { 'go', 'Telescope lsp_type_definitions', desc = "Goto type definition" }, - { 'gd', 'Telescope lsp_definitions', desc = 'Goto definition' }, + { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, + { 'ss', 'Telescope lsp_document_symbols', desc = 'Search document symbols' }, + { 'si', 'Telescope lsp_implementations', desc = 'Search Inplementations' }, + { 'sp', 'Telescope lsp_workspace_symbols', desc = 'Search Workspace symbols' }, + { 'go', 'Telescope lsp_type_definitions', desc = "Goto type definition" }, + { 'gd', 'Telescope lsp_definitions', desc = 'Goto definition' }, }, telescope = { { 'sf', 'Telescope find_files', desc = 'Search files' }, - { 'sF', 'lua require("telescope.builtin").find_files({no_ignore=true})', desc = 'Search all files' }, + { 'sF', telescope.all_files, desc = 'Search all files' }, { 'sb', 'Telescope buffers', desc = 'Search buffers' }, - --{ 'sb', 'lua require("utils.telescope").buffers()', desc = 'Search buffers' }, { 'sa', 'Telescope live_grep', desc = 'Search in files' }, { 'sg', 'Telescope git_files', desc = 'Search Git files' }, + { 'sG', 'Telescope git_status', desc = 'Search Git status' }, { 'so', 'Telescope oldfiles', desc = 'Search Old files' }, { 'sw', 'Telescope grep_string', desc = 'Search for word under cursor' }, { 'sd', 'Telescope diagnostics', desc = 'Search Diagnostics' }, diff --git a/nvim/lua/utils/keys.lua b/nvim/lua/utils/keys.lua index f0895e8..bb8d46b 100644 --- a/nvim/lua/utils/keys.lua +++ b/nvim/lua/utils/keys.lua @@ -3,5 +3,11 @@ return function(v, opts) local lhs = table.remove(c, 1) local rhs = table.remove(c, 1) opts = vim.tbl_deep_extend("force", c, opts or {}) - vim.keymap.set('n', lhs, rhs, opts) + + local mode = 'n' + if opts.mode then + mode = opts.mode + opts.mode = nil + end + vim.keymap.set(mode, lhs, rhs, opts) end diff --git a/nvim/lua/utils/telescope.lua b/nvim/lua/utils/telescope.lua new file mode 100644 index 0000000..bb44471 --- /dev/null +++ b/nvim/lua/utils/telescope.lua @@ -0,0 +1,6 @@ + +local M = {} + +function M.all_files() require("telescope.builtin").find_files({no_ignore=true}) end + +return M