Update config

This commit is contained in:
Simon Lasbrugnas 2023-07-25 03:44:24 +02:00
parent e769cd88ba
commit 27b9212cf8
Signed by untrusted user who does not match committer: simon
GPG key ID: 86039876BA6ED8DE
5 changed files with 86 additions and 58 deletions

View file

@ -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()

View file

@ -1,8 +1,22 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', 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', '<C-p>', custom_git_files, {}) -- Use the custom function here
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})

View file

@ -17,7 +17,7 @@ require'nvim-treesitter.configs'.setup {
-- 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,
additional_vim_regex_highlighting = { "php" }
},
}

View file

@ -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"},
}
}

View file

@ -39,3 +39,31 @@ vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")
end)
-- Keybinding for deleting the current buffer using :bd
vim.keymap.set("n", "<leader>bd", function()
vim.cmd("bd")
end, {})
-- Define a function to execute the appropriate program based on file type
vim.keymap.set("n", "<leader>/", 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 })