more settings
parent
47636ad127
commit
e5843d4ca4
12
init.lua
12
init.lua
|
@ -124,7 +124,8 @@ require('lazy').setup({
|
|||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
||||
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
|
||||
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
||||
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
||||
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
||||
end,
|
||||
|
@ -486,4 +487,11 @@ luasnip.config.setup {}
|
|||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
require 'lua.custom'
|
||||
require('custom.options')
|
||||
require('custom.keymaps')
|
||||
require('custom.catppuccin')
|
||||
require('custom.startup')
|
||||
require('custom.lua-line')
|
||||
require('custom.telescope')
|
||||
require('custom.lspconfig')
|
||||
vim.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]])
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
-- vim.cmd([[colorscheme gruvbox]])
|
||||
-- local status, _ = pcall(vim.cmd, "colorscheme gruvbox")
|
||||
-- if not status then
|
||||
-- print("Colorscheme not found!") -- print error if colorscheme not installed
|
||||
-- return
|
||||
-- end
|
||||
|
||||
require("catppuccin").setup({
|
||||
flavour = "frappe", -- latte, frappe, macchiato, mocha
|
||||
background = { -- :h background
|
||||
light = "latte",
|
||||
dark = "mocha",
|
||||
},
|
||||
transparent_background = true,
|
||||
term_colors = false,
|
||||
dim_inactive = {
|
||||
enabled = false,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
no_italic = false, -- Force no italic
|
||||
no_bold = false, -- Force no bold
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
conditionals = { "italic" },
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
},
|
||||
color_overrides = {},
|
||||
custom_highlights = {},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
nvimtree = true,
|
||||
telescope = true,
|
||||
notify = false,
|
||||
mini = false,
|
||||
-- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations)
|
||||
},
|
||||
})
|
||||
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
|
@ -30,9 +30,9 @@ keymap.set('n', '<leader>y', '"+yy')
|
|||
-- Plugin Keybinds
|
||||
----------------------
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>', { silent = true }) -- toggle file explorer
|
||||
keymap.set('n', '<leader>gt', ':NvimTreeFindFile<CR>', { silent = true }) -- toggle file explorer
|
||||
-- neo-tree
|
||||
keymap.set('n', '<leader>e', ':Neotree toggle<CR>', { noremap = true, silent = true }) -- toggle file explorer
|
||||
keymap.set('n', '<leader>gt', ':Neotree toggle left reveal_force_cwd<CR>', { silent = true }) -- toggle file explorer
|
||||
|
||||
-- telescope
|
||||
keymap.set('n', '<leader>sf', '<cmd>Telescope find_files<cr>', { silent = true }) -- find files within current working directory, respects .gitignore
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
-- import lspconfig plugin safely
|
||||
local lspconfig_status, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import cmp-nvim-lsp plugin safely
|
||||
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not cmp_nvim_lsp_status then
|
||||
return
|
||||
end
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- enable keybinds only for when lsp server available
|
||||
local on_attach = function(_, bufnr)
|
||||
-- keybind options
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
keymap.set("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
||||
keymap.set("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
keymap.set("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration
|
||||
keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) -- see definition and make edits in window
|
||||
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
|
||||
keymap.set("n", "<leader>l", "<cmd>lua vim.lsp.buf.format()<CR>", opts) -- format code
|
||||
keymap.set("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) -- format code
|
||||
keymap.set("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) -- see available code actions
|
||||
keymap.set("n", "<leader>ed", "<cmd>Telescope diagnostics<CR>", opts) -- jump to previous diagnostic in buffer
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>cbf",
|
||||
":!phpcbf -w --standard=PSR12 %<CR>",
|
||||
{ noremap = true, silent = false, buffer = bufnr }
|
||||
)
|
||||
|
||||
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
|
||||
end
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
|
||||
lspconfig["bashls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "sh", "bin" },
|
||||
})
|
||||
|
||||
-- XML LSP
|
||||
lspconfig["lemminx"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "xml" },
|
||||
})
|
||||
|
||||
-- yaml LSP
|
||||
lspconfig["yamlls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "yaml", "yml" },
|
||||
})
|
||||
-- json LSP
|
||||
lspconfig["jsonls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "json" },
|
||||
})
|
||||
|
||||
lspconfig["pyright"].setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
filetypes = { "py" },
|
||||
})
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html" },
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
lspconfig["eslint"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- rust
|
||||
lspconfig["rust_analyzer"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = lsp_flags,
|
||||
-- Server-specific settings...
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
-- enable clippy on save
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig["yamlls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "yml", "yaml" },
|
||||
})
|
||||
|
||||
-- -- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = { -- custom settings for lua
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { "lua" },
|
||||
})
|
||||
|
||||
lspconfig["phpactor"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
},
|
||||
filetypes = { "php" },
|
||||
})
|
||||
|
||||
lspconfig["intelephense"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "php" },
|
||||
})
|
|
@ -0,0 +1,45 @@
|
|||
-- import lualine plugin safely
|
||||
local status, lualine = pcall(require, "lualine")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- get lualine nightfly theme
|
||||
local lualine_nightfly = require("lualine.themes.nightfly")
|
||||
local lualine_codedark = require("lualine.themes.codedark")
|
||||
|
||||
-- new colors for theme
|
||||
local new_colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
black = "#000000",
|
||||
red = "#b23232",
|
||||
}
|
||||
|
||||
-- change nightlfy theme colors
|
||||
lualine_nightfly.normal.a.bg = new_colors.blue
|
||||
lualine_nightfly.insert.a.bg = new_colors.red
|
||||
lualine_nightfly.visual.a.bg = new_colors.violet
|
||||
lualine_nightfly.command = {
|
||||
a = {
|
||||
gui = "bold",
|
||||
bg = new_colors.yellow,
|
||||
fg = new_colors.black, -- black
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = lualine_nightfly,
|
||||
-- theme = lualine_codedark,
|
||||
},
|
||||
sections = {
|
||||
lualine_c = {
|
||||
{ "filename", path = 1 },
|
||||
"lsp_progress",
|
||||
},
|
||||
},
|
||||
})
|
|
@ -2,4 +2,16 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
-- add, delete, change surroundings it's awesome
|
||||
"tpope/vim-surround",
|
||||
-- -- commenting with gc
|
||||
"numToStr/Comment.nvim",
|
||||
|
||||
"arkav/lualine-lsp-progress",
|
||||
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
||||
"nvim-telescope/telescope-project.nvim",
|
||||
"catppuccin/nvim",
|
||||
as = "catppuccin",
|
||||
{ "startup-nvim/startup.nvim", dependencies = "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
-- import comment plugin safely
|
||||
local setup, startup = pcall(require, "startup")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- enable startup
|
||||
startup.setup()
|
|
@ -0,0 +1,36 @@
|
|||
-- import telescope plugin safely
|
||||
local telescope_setup, telescope = pcall(require, "telescope")
|
||||
if not telescope_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- import telescope actions safely
|
||||
local actions_setup, actions = pcall(require, "telescope.actions")
|
||||
if not actions_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure telescope
|
||||
telescope.setup({
|
||||
-- configure custom mappings
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("project")
|
||||
-- telescope.load_extension("dap")
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<C-p>",
|
||||
":lua require'telescope'.extensions.project.project{}<CR>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
Loading…
Reference in New Issue