diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua index a2a4e38..9dd60aa 100644 --- a/after/plugin/colors.lua +++ b/after/plugin/colors.lua @@ -1,13 +1,6 @@ -require('rose-pine').setup({ - disable_background = true -}) - function ColorMyPencils(color) - color = color or "rose-pine" + color = color or "kanagawa-dragon" vim.cmd.colorscheme(color) - - vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) end ColorMyPencils() diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 29f5a62..bde4b4f 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,8 +1,22 @@ local builtin = require('telescope.builtin') -vim.keymap.set('n', 'pf', builtin.find_files, {}) -vim.keymap.set('n', '', builtin.git_files, {}) + +-- Function to check if the current directory is a git directory +local function is_git_directory() + return vim.fn.system('git rev-parse --is-inside-work-tree') == 1 +end + +-- Custom function that calls git_files if in a git directory, otherwise find_files +local function custom_git_files() + if is_git_directory() then + builtin.git_files() + else + builtin.find_files() + end +end + +-- Keybindings +vim.keymap.set('n', '', custom_git_files, {}) -- Use the custom function here vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) + builtin.grep_string({ search = vim.fn.input("Grep > ") }) end) vim.keymap.set('n', 'vh', builtin.help_tags, {}) - diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 459b92f..9e772fe 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,23 +1,23 @@ require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" - ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust" }, + -- A list of parser names, or "all" + ensure_installed = { "vimdoc", "javascript", "typescript", "c", "lua", "rust" }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, - highlight = { - -- `false` will disable the whole extension - enable = true, + highlight = { + -- `false` will disable the whole extension + enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = { "php" } + }, } diff --git a/lua/default/packer.lua b/lua/default/packer.lua index 14ef707..aed9868 100644 --- a/lua/default/packer.lua +++ b/lua/default/packer.lua @@ -1,43 +1,36 @@ -- This file can be loaded by calling `lua require('plugins')` from your init.vim -- Only required if you have packer configured as `opt` -vim.cmd.packadd('packer.nvim') +vim.cmd.packadd("packer.nvim") -return require('packer').startup(function(use) +return require("packer").startup(function(use) -- Packer can manage itself - use 'wbthomason/packer.nvim' + use "wbthomason/packer.nvim" use { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', - -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } + "nvim-telescope/telescope.nvim", tag = "0.1.0", + requires = { {"nvim-lua/plenary.nvim"} } } - use({ - 'rose-pine/neovim', - as = 'rose-pine', - config = function() - vim.cmd('colorscheme rose-pine') - end - }) + use("rebelot/kanagawa.nvim") - use('vuciv/vim-bujo') + use("vuciv/vim-bujo") use({ "folke/trouble.nvim", config = function() require("trouble").setup { - icons = false, + icons = true, } end }) - use('ThePrimeagen/refactoring.nvim') + use("ThePrimeagen/refactoring.nvim") use { - 'nvim-treesitter/nvim-treesitter', + "nvim-treesitter/nvim-treesitter", run = function() - local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) + local ts_update = require("nvim-treesitter.install").update({ with_sync = true }) ts_update() end,} use("nvim-treesitter/playground") @@ -46,25 +39,25 @@ return require('packer').startup(function(use) use("nvim-treesitter/nvim-treesitter-context"); use { - 'VonHeikemen/lsp-zero.nvim', + "VonHeikemen/lsp-zero.nvim", branch = 'v1.x', requires = { -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, + {"neovim/nvim-lspconfig"}, + {"williamboman/mason.nvim"}, + {"williamboman/mason-lspconfig.nvim"}, -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, + {"hrsh7th/nvim-cmp"}, + {"hrsh7th/cmp-buffer"}, + {"hrsh7th/cmp-path"}, + {"saadparwaiz1/cmp_luasnip"}, + {"hrsh7th/cmp-nvim-lsp"}, + {"hrsh7th/cmp-nvim-lua"}, -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, + {"L3MON4D3/LuaSnip"}, + {"rafamadriz/friendly-snippets"}, } } diff --git a/lua/default/remap.lua b/lua/default/remap.lua index 31f7ce2..857bad1 100644 --- a/lua/default/remap.lua +++ b/lua/default/remap.lua @@ -39,3 +39,31 @@ vim.keymap.set("n", "", function() vim.cmd("so") end) +-- Keybinding for deleting the current buffer using :bd +vim.keymap.set("n", "bd", function() + vim.cmd("bd") +end, {}) + +-- Define a function to execute the appropriate program based on file type +vim.keymap.set("n", "/", function() + local filetype = vim.bo.filetype + local app = "" + if filetype == "javascript" then + app = "node" + elseif filetype == "typescript" then + app = "ts-node" + elseif filetype == "lua" then + app = "lua" + elseif filetype == "python" then + app = "python" + elseif filetype == "rust" then + app = "cargo run" + elseif filetype == "go" then + app = "go run" + else + print("Unsupported file type: " .. filetype) + return + end + vim.cmd("terminal " .. app .. " %") +end, { noremap = true, silent = true }) +