v1.0
This commit is contained in:
parent
a22976111e
commit
f8596bb0c6
16 changed files with 1252 additions and 79 deletions
212
init.lua
212
init.lua
|
|
@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
|
|||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.opt.relativenumber = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
|
@ -160,12 +160,15 @@ vim.opt.scrolloff = 10
|
|||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- For conciseness
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
|
|
@ -190,6 +193,45 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- Keymaps to save, quit and old habbits
|
||||
vim.keymap.set('n', '<leader>w', '<cmd>w!<CR>', { desc = 'Save file' })
|
||||
-- save file without auto-formatting
|
||||
vim.keymap.set('n', '<leader>W', '<cmd>noautocmd w <CR>', { desc = 'Save without formatting' })
|
||||
vim.keymap.set('n', '<leader>q', '<cmd>q!<CR>', { desc = 'Close file' })
|
||||
|
||||
-- Keep last yanked when pasting
|
||||
vim.keymap.set('v', 'p', '"_dP', opts)
|
||||
|
||||
-- Vertical scroll and center
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz', opts)
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz', opts)
|
||||
|
||||
-- Find and center
|
||||
vim.keymap.set('n', 'n', 'nzzzv', opts)
|
||||
vim.keymap.set('n', 'N', 'Nzzzv', opts)
|
||||
|
||||
-- Window management
|
||||
vim.keymap.set('n', '<leader>v', '<C-w>v', opts) -- split window vertically
|
||||
vim.keymap.set('n', '<leader>h', '<C-w>s', opts) -- split window horizontally
|
||||
vim.keymap.set('n', '<leader>se', '<C-w>=', opts) -- make split windows equal width & height
|
||||
vim.keymap.set('n', '<leader>xs', ':close<CR>', opts) -- close current split window
|
||||
|
||||
-- Navigate between splits
|
||||
vim.keymap.set('n', '<C-k>', ':wincmd k<CR>', opts)
|
||||
vim.keymap.set('n', '<C-j>', ':wincmd j<CR>', opts)
|
||||
vim.keymap.set('n', '<C-h>', ':wincmd h<CR>', opts)
|
||||
vim.keymap.set('n', '<C-l>', ':wincmd l<CR>', opts)
|
||||
|
||||
-- Tabs
|
||||
vim.keymap.set('n', '<leader>to', ':tabnew<CR>', opts) -- open new tab
|
||||
vim.keymap.set('n', '<leader>tx', ':tabclose<CR>', opts) -- close current tab
|
||||
vim.keymap.set('n', '<leader>tn', ':tabn<CR>', opts) -- go to next tab
|
||||
vim.keymap.set('n', '<leader>tp', ':tabp<CR>', opts) -- go to previous tab
|
||||
|
||||
-- Stay in indent mode
|
||||
vim.keymap.set('v', '<', '<gv', opts)
|
||||
vim.keymap.set('v', '>', '>gv', opts)
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
|
@ -243,19 +285,19 @@ require('lazy').setup({
|
|||
-- require('gitsigns').setup({ ... })
|
||||
--
|
||||
-- See `:help gitsigns` to understand what the configuration keys do
|
||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- { -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- 'lewis6991/gitsigns.nvim',
|
||||
-- opts = {
|
||||
-- signs = {
|
||||
-- add = { text = '+' },
|
||||
-- change = { text = '~' },
|
||||
-- delete = { text = '_' },
|
||||
-- topdelete = { text = '‾' },
|
||||
-- changedelete = { text = '~' },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||
--
|
||||
-- This is often very useful to both group configuration, as well as handle
|
||||
|
|
@ -317,8 +359,8 @@ require('lazy').setup({
|
|||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>f', group = '[S]earch' },
|
||||
-- { '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
|
|
@ -401,19 +443,19 @@ require('lazy').setup({
|
|||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>fs', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>fc', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>fw', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>f<CR>', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
|
|
@ -423,12 +465,12 @@ require('lazy').setup({
|
|||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
-- vim.keymap.set('n', '<leader>s/', function()
|
||||
-- builtin.live_grep {
|
||||
-- grep_open_files = true,
|
||||
-- prompt_title = 'Live Grep in Open Files',
|
||||
-- }
|
||||
-- end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
|
|
@ -533,15 +575,15 @@ require('lazy').setup({
|
|||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
-- map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
map('<leader>ln', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
map('<leader>la', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
|
|
@ -580,11 +622,11 @@ require('lazy').setup({
|
|||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
-- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
-- map('<leader>th', function()
|
||||
-- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
-- end, '[T]oggle Inlay [H]ints')
|
||||
-- end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -605,6 +647,18 @@ require('lazy').setup({
|
|||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
intelephense = {
|
||||
settings = {
|
||||
intelephense = {
|
||||
diagnostics = {
|
||||
undefinedProperties = false,
|
||||
undefinedMethods = false,
|
||||
undefinedTypes = false,
|
||||
undefinedFunctions = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
|
|
@ -728,12 +782,12 @@ require('lazy').setup({
|
|||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
|
@ -824,23 +878,23 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- You can easily change to a different colorscheme.
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
end,
|
||||
},
|
||||
-- { -- You can easily change to a different colorscheme.
|
||||
-- -- Change the name of the colorscheme plugin below, and then
|
||||
-- -- change the command in the config to whatever the name of that colorscheme is.
|
||||
-- --
|
||||
-- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
-- 'folke/tokyonight.nvim',
|
||||
-- priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
-- init = function()
|
||||
-- -- Load the colorscheme here.
|
||||
-- -- Like many other themes, this one has different styles, and you could load
|
||||
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||
--
|
||||
-- -- You can configure highlights by doing something like:
|
||||
-- vim.cmd.hi 'Comment gui=none'
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||
|
|
@ -888,7 +942,7 @@ 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', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'php', 'javascript' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
@ -929,25 +983,25 @@ require('lazy').setup({
|
|||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
cmd = '⌘',
|
||||
config = '🛠',
|
||||
event = '📅',
|
||||
ft = '📂',
|
||||
init = '⚙',
|
||||
keys = '🗝',
|
||||
plugin = '🔌',
|
||||
runtime = '💻',
|
||||
require = '🌙',
|
||||
source = '📄',
|
||||
start = '🚀',
|
||||
task = '📌',
|
||||
lazy = '💤 ',
|
||||
-- cmd = '⌘',
|
||||
-- config = '🛠',
|
||||
-- event = '📅',
|
||||
-- ft = '📂',
|
||||
-- init = '⚙',
|
||||
-- keys = '🗝',
|
||||
-- plugin = '🔌',
|
||||
-- runtime = '💻',
|
||||
-- require = '🌙',
|
||||
-- source = '📄',
|
||||
-- start = '🚀',
|
||||
-- task = '📌',
|
||||
-- lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue