Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2646541406 | ||
|
|
b512fd2ff3 | ||
|
|
095ee1e73e | ||
|
|
38709a3b71 | ||
|
|
391b30bd7a | ||
|
|
0af71243a3 | ||
|
|
d0ea7c50a0 | ||
|
|
233275c160 | ||
|
|
ccd0319364 | ||
|
|
f11dae4fce | ||
|
|
09e50948e4 | ||
|
|
d1167c2fe9 | ||
|
|
04f1abe4d1 | ||
|
|
821f9bee27 | ||
|
|
fbcc0b8d61 | ||
|
|
6a326d7321 | ||
|
|
36bb19fc4e | ||
|
|
8850a7cc27 | ||
|
|
480e35d011 | ||
|
|
95d3e129ad | ||
|
|
2e55a01664 | ||
|
|
a233f6e7f2 | ||
|
|
8f4d2e287e | ||
|
|
a660f0c788 | ||
|
|
f75def6081 | ||
|
|
71dac4d82f | ||
|
|
04e5478570 |
@@ -44,11 +44,31 @@ vim.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]])
|
|||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
---------- treesitter.start guard >------------------------------
|
||||||
|
-- Neovim's own bundled ftplugin/<lang>.lua calls vim.treesitter.start()
|
||||||
|
-- unconditionally. When the system's bundled highlight queries are ahead of
|
||||||
|
-- the currently available parser/grammar (a packaging/version skew, not a
|
||||||
|
-- config issue), that call throws and takes down the whole FileType autocmd
|
||||||
|
-- chain for the buffer (breaking omnifunc/foldexpr along with it). Guard it
|
||||||
|
-- here, before any buffer can trigger it, so a mismatch just falls back to
|
||||||
|
-- regex syntax highlighting instead of erroring.
|
||||||
|
do
|
||||||
|
local orig_start = vim.treesitter.start
|
||||||
|
vim.treesitter.start = function(...)
|
||||||
|
local ok, err = pcall(orig_start, ...)
|
||||||
|
if not ok then
|
||||||
|
vim.notify_once('treesitter.start failed, falling back to regex highlighting: ' .. tostring(err),
|
||||||
|
vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
---------- </treesitter.start guard ------------------------------
|
||||||
|
|
||||||
-- Install package manager
|
-- Install package manager
|
||||||
-- https://github.com/folke/lazy.nvim
|
-- https://github.com/folke/lazy.nvim
|
||||||
-- `:help lazy.nvim.txt` for more info
|
-- `:help lazy.nvim.txt` for more info
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
vim.fn.system {
|
vim.fn.system {
|
||||||
'git',
|
'git',
|
||||||
'clone',
|
'clone',
|
||||||
@@ -75,25 +95,10 @@ require('lazy').setup({
|
|||||||
-- Detect tabstop and shiftwidth automatically
|
-- Detect tabstop and shiftwidth automatically
|
||||||
'tpope/vim-sleuth',
|
'tpope/vim-sleuth',
|
||||||
|
|
||||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
-- seems i need this regardless
|
||||||
-- The configuration is done below. Search for lspconfig to find it below.
|
'neovim/nvim-lspconfig',
|
||||||
{
|
'williamboman/mason.nvim',
|
||||||
-- LSP Configuration & Plugins
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
|
||||||
{ 'williamboman/mason.nvim', config = true },
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
||||||
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
|
||||||
'folke/neodev.nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
@@ -147,7 +152,7 @@ require('lazy').setup({
|
|||||||
-- Fuzzy Finder (files, lsp, etc)
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
branch = '0.1.x',
|
version = '*',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
@@ -167,31 +172,26 @@ require('lazy').setup({
|
|||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
branch = "main",
|
||||||
|
lazy = false,
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
|
||||||
opts = {
|
|
||||||
ensure_installed = { 'bash', 'php', 'rust', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
|
||||||
-- Autoinstall languages that are not installed
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
||||||
-- If you are experiencing weird indenting issues, add the language to
|
|
||||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
},
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
branch = "main"
|
||||||
},
|
},
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
init = function()
|
||||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
local ensureInstalled = {
|
||||||
--
|
'lua', 'python', 'typescript',
|
||||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
-- ... your parsers
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
}
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
local alreadyInstalled = require('nvim-treesitter.config').get_installed()
|
||||||
|
local parsersToInstall = vim.iter(ensureInstalled)
|
||||||
|
:filter(function(parser)
|
||||||
|
return not vim.tbl_contains(alreadyInstalled, parser)
|
||||||
|
end)
|
||||||
|
:totable()
|
||||||
|
require('nvim-treesitter').install(parsersToInstall)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
@@ -210,48 +210,8 @@ require('lazy').setup({
|
|||||||
{ import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
|
||||||
-- See `:help vim.o`
|
|
||||||
-- NOTE: You can change these options as you wish!
|
|
||||||
|
|
||||||
-- Set highlight on search
|
|
||||||
vim.o.hlsearch = false
|
|
||||||
|
|
||||||
-- Make line numbers default
|
|
||||||
vim.wo.number = true
|
|
||||||
|
|
||||||
-- Enable mouse mode
|
|
||||||
vim.o.mouse = 'a'
|
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
|
||||||
-- See `:help 'clipboard'`
|
|
||||||
vim.o.clipboard = 'unnamedplus'
|
|
||||||
|
|
||||||
-- Enable break indent
|
|
||||||
vim.o.breakindent = true
|
|
||||||
|
|
||||||
-- Save undo history
|
|
||||||
vim.o.undofile = true
|
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or capital in search
|
|
||||||
vim.o.ignorecase = true
|
|
||||||
vim.o.smartcase = true
|
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
|
||||||
vim.wo.signcolumn = 'yes'
|
|
||||||
|
|
||||||
-- Decrease update time
|
|
||||||
vim.o.updatetime = 250
|
|
||||||
vim.o.timeoutlen = 300
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
|
||||||
|
|
||||||
-- NOTE: You should make sure your terminal supports this
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
|
-- See lua/custom/options.lua for vim.opt settings
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
-- Keymaps for better default experience
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
@@ -274,96 +234,19 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Configure Telescope ]]
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
require('telescope').setup {
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
['<C-u>'] = false,
|
|
||||||
['<C-d>'] = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Enable telescope fzf native, if installed
|
-- Enable telescope fzf native, if installed
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
|
||||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
|
||||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
|
||||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
||||||
winblend = 10,
|
|
||||||
previewer = false,
|
|
||||||
})
|
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
||||||
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end,
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
{ desc = 'Go to previous diagnostic message' })
|
||||||
vim.keymap.set('n', '<leader>dd', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
vim.keymap.set('n', ']d', function() vim.diagnostic.jump({ count = 1 }) end, { desc = 'Go to next diagnostic message' })
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
-- [[ Configure LSP ]]
|
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
|
||||||
local on_attach = function(_, bufnr)
|
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
||||||
-- many times.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local nmap = function(keys, func, desc)
|
|
||||||
if desc then
|
|
||||||
desc = 'LSP: ' .. desc
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
||||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
|
||||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
||||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
|
||||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
|
||||||
nmap('<leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, '[W]orkspace [L]ist Folders')
|
|
||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
||||||
vim.lsp.buf.format()
|
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
|
||||||
require('neodev').setup()
|
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
-- [[ Configure nvim-cmp ]]
|
||||||
-- See `:help cmp`
|
-- See `:help cmp`
|
||||||
local cmp = require 'cmp'
|
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
luasnip.config.setup {}
|
luasnip.config.setup {}
|
||||||
@@ -377,17 +260,17 @@ end
|
|||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
||||||
|
-- options.lua sets vim.opt.termguicolors, which colorizer.lua (and others) need
|
||||||
|
-- already set by the time they run their setup() calls, so it loads first
|
||||||
|
require('custom.options')
|
||||||
require('custom.catppuccin')
|
require('custom.catppuccin')
|
||||||
-- require('custom.startup')
|
|
||||||
require('custom.lua-line')
|
require('custom.lua-line')
|
||||||
require('custom.telescope')
|
require('custom.telescope')
|
||||||
require('custom.lspconfig')
|
require('custom.lspconfig')
|
||||||
require('custom.lspsaga')
|
|
||||||
require('custom.nvim-cmp')
|
require('custom.nvim-cmp')
|
||||||
require('custom.toggleterm')
|
require('custom.toggleterm')
|
||||||
require('custom.autopairs')
|
require('custom.autopairs')
|
||||||
require('custom.colorizer')
|
require('custom.colorizer')
|
||||||
require('custom.options')
|
|
||||||
require('custom.keymaps')
|
require('custom.keymaps')
|
||||||
require('custom.harpoon')
|
require('custom.harpoon')
|
||||||
require('custom.mason')
|
require('custom.mason')
|
||||||
|
|||||||
@@ -47,5 +47,4 @@ require("catppuccin").setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- setup must be called before loading
|
-- colorscheme is applied in custom/colortheme.lua, loaded after this file
|
||||||
vim.cmd.colorscheme "catppuccin"
|
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ if not setup then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- configure/enable colorizer
|
-- configure/enable colorizer
|
||||||
colorizer.setup()
|
colorizer.setup({
|
||||||
|
options = { parsers = { css = true } },
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
vim.g.mapleader = ' '
|
|
||||||
|
|
||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
|
|
||||||
keymap.set('i', 'jj', '<ESC>')
|
keymap.set('i', 'jj', '<ESC>')
|
||||||
@@ -56,16 +54,11 @@ keymap.set('n', '<leader>gh', ':DiffviewFileHistory %<CR>', { silent = true })
|
|||||||
-- toggleterm
|
-- toggleterm
|
||||||
keymap.set('n', '<M-1>', '<cmd>ToggleTerm direction=horizontal<cr>', { silent = true })
|
keymap.set('n', '<M-1>', '<cmd>ToggleTerm direction=horizontal<cr>', { silent = true })
|
||||||
|
|
||||||
-- vim-sneak
|
|
||||||
-- keymap.set('n', 'f', '<Plug>Sneak_s', { silent = true })
|
|
||||||
-- keymap.set('n', 'F', '<Plug>Sneak_S', { silent = true })
|
|
||||||
-- keymap.set('n', 's', 's', { silent = true })
|
|
||||||
|
|
||||||
|
|
||||||
-- easymotion
|
-- easymotion
|
||||||
keymap.set('n', '<leader>f', '<Plug>(easymotion-prefix)', { silent = true })
|
keymap.set('n', '<leader>f', '<Plug>(easymotion-prefix)', { silent = true })
|
||||||
keymap.set('n', '<leader>fs', '<Plug>(easymotion-sn)', { silent = true })
|
keymap.set('n', '<leader>fs', '<Plug>(easymotion-sn)', { silent = true })
|
||||||
keymap.set('n', '<leader>w', '<Plug>(easymotion-overwin-f2)', { silent = true })
|
keymap.set('n', '<leader>w', '<Plug>(easymotion-overwin-f2)', { silent = true })
|
||||||
|
keymap.set('n', 'gl', '<Plug>(easymotion-sl)', { silent = true })
|
||||||
|
|
||||||
vim.g.EasyMotion_smartcase = 1
|
vim.g.EasyMotion_smartcase = 1
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,6 @@ vim.filetype.add({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-k>", ":lua require('kulala').jump_prev()<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-j>", ":lua require('kulala').jump_next()<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-l>", ":lua require('kulala').run()<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-v>", ":lua require('kulala').toggle_view()<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-e>", ":lua require('kulala').set_selected_env()<CR>",
|
|
||||||
-- { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-k>", ":lua require('kulala').jump_prev()<CR>", { noremap = true, silent = true })
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<C-A-j>", ":lua require('kulala').jump_next()<CR>", { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>rr", ":lua require('kulala').run()<CR>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<leader>rr", ":lua require('kulala').run()<CR>", { noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("n", "<leader>rv", ":lua require('kulala').toggle_view()<CR>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<leader>rv", ":lua require('kulala').toggle_view()<CR>", { noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("n", "<leader>re", ":lua require('kulala').set_selected_env()<CR>",
|
vim.api.nvim_set_keymap("n", "<leader>re", ":lua require('kulala').set_selected_env()<CR>",
|
||||||
|
|||||||
+48
-67
@@ -1,30 +1,12 @@
|
|||||||
-- lsp.lua (replace your current file with this)
|
-- lsp.lua (replace your current file with this)
|
||||||
-- import cmp-nvim-lsp plugin safely
|
-- import cmp-nvim-lsp plugin safely
|
||||||
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
-- local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
if not cmp_nvim_lsp_status then
|
-- if not cmp_nvim_lsp_status then
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
-- smart format with null-ls if available
|
|
||||||
local function smart_format()
|
|
||||||
vim.lsp.buf.format({
|
|
||||||
filter = function(client)
|
|
||||||
local ft = vim.bo.filetype
|
|
||||||
if ft == "rust" then
|
|
||||||
return client.name == "rust_analyzer"
|
|
||||||
end
|
|
||||||
-- Prefer null-ls for all non-Rust, otherwise allow anything
|
|
||||||
if vim.tbl_contains({ "null-ls", "lua_ls", "jsonls", "tsserver" }, client.name) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
timeout_ms = 3000,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
---------- border >------------------------------
|
---------- border >------------------------------
|
||||||
do
|
do
|
||||||
local orig_floating_preview = vim.lsp.util.open_floating_preview
|
local orig_floating_preview = vim.lsp.util.open_floating_preview
|
||||||
@@ -55,8 +37,9 @@ local on_attach = function(_, bufnr)
|
|||||||
keymap.set("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
keymap.set("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
||||||
keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
keymap.set("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
keymap.set("n", "<leader>l", smart_format, opts)
|
keymap.set("n", "<leader>l", function()
|
||||||
keymap.set("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
vim.lsp.buf.format()
|
||||||
|
end, { desc = "Format code function" })
|
||||||
keymap.set(
|
keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>cbf",
|
"<leader>cbf",
|
||||||
@@ -73,19 +56,20 @@ local on_attach = function(_, bufnr)
|
|||||||
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts)
|
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts)
|
||||||
keymap.set("n", "ge", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)
|
keymap.set("n", "ge", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)
|
||||||
keymap.set("n", "<a-cr>", "<cmd>Lspsaga code_action<CR>", opts)
|
keymap.set("n", "<a-cr>", "<cmd>Lspsaga code_action<CR>", opts)
|
||||||
keymap.set("n", "<leader>d", "<cmd>Telescope diagnostics<CR>", opts)
|
-- keymap.set("n", "<leader>d", "<cmd>Telescope diagnostics<CR>", opts)
|
||||||
|
keymap.set("n", "<leader>da", "<cmd>Lspsaga show_workspace_diagnostics ++float<CR>", opts)
|
||||||
|
keymap.set("n", "<leader>db", "<cmd>Lspsaga show_buf_diagnostics ++float<CR>", opts)
|
||||||
keymap.set("n", "<leader>dn", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
keymap.set("n", "<leader>dn", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
||||||
keymap.set("n", "<leader>dp", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
keymap.set("n", "<leader>dp", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
||||||
|
|
||||||
keymap.set("n", "gj", "<cmd>lua require'nvim-treesitter.textobjects.move'.goto_next_start('@function.outer')<CR>",
|
keymap.set("n", "gj", "<cmd>lua require'nvim-treesitter-textobjects.move'.goto_next_start('@function.outer')<CR>",
|
||||||
opts)
|
opts)
|
||||||
keymap.set("n", "gk", "<cmd>lua require'nvim-treesitter.textobjects.move'.goto_previous_start('@function.outer')<CR>",
|
keymap.set("n", "gk", "<cmd>lua require'nvim-treesitter-textobjects.move'.goto_previous_start('@function.outer')<CR>",
|
||||||
opts)
|
opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- capabilities
|
-- capabilities
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
|
||||||
-- helper for registering server configs (lazy attach)
|
-- helper for registering server configs (lazy attach)
|
||||||
local function setup_server(name, config)
|
local function setup_server(name, config)
|
||||||
local cfg = vim.tbl_deep_extend("force", {
|
local cfg = vim.tbl_deep_extend("force", {
|
||||||
@@ -106,44 +90,50 @@ setup_server("pyright", { filetypes = { "py" } })
|
|||||||
setup_server("html", { filetypes = { "html" } })
|
setup_server("html", { filetypes = { "html" } })
|
||||||
setup_server("cssls",
|
setup_server("cssls",
|
||||||
{ filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" } })
|
{ filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" } })
|
||||||
setup_server("tailwindcss", {
|
|
||||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
|
||||||
})
|
|
||||||
setup_server("emmet_ls", {
|
|
||||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
|
||||||
})
|
|
||||||
setup_server("eslint", {
|
setup_server("eslint", {
|
||||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||||
})
|
})
|
||||||
setup_server("rust_analyzer", {
|
setup_server("rust_analyzer", {
|
||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = { checkOnSave = true },
|
["rust-analyzer"] = { checkOnSave = true, check = { command = "clippy" } },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
setup_server("lua_ls", { filetypes = { "lua" } })
|
|
||||||
-- setup_server("slint_lsp", { filetypes = { "slint" } })
|
|
||||||
|
|
||||||
-- PHP LSPs
|
-- PHP LSPs
|
||||||
local util = require("lspconfig.util")
|
|
||||||
root_dir = function(fname)
|
|
||||||
return util.root_pattern("composer.json", ".git")(fname)
|
|
||||||
or util.path.dirname(fname)
|
|
||||||
end
|
|
||||||
|
|
||||||
setup_server("phpactor", {
|
-- start it manually :LspStart phpactor
|
||||||
filetypes = { "php" },
|
-- setup_server("phpactor", {
|
||||||
root_dir = fallback_root_dir,
|
-- filetypes = { "php" },
|
||||||
init_options = {
|
-- -- root_dir = fallback_root_dir,
|
||||||
["language_server_phpstan.enabled"] = true,
|
-- init_options = {
|
||||||
["language_server_psalm.enabled"] = false,
|
-- ["language_server_phpstan.enabled"] = true,
|
||||||
},
|
-- ["language_server_psalm.enabled"] = false,
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
setup_server("lua_ls", {
|
||||||
|
filetypes = { "lua" },
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" } },
|
||||||
|
format = { enable = true },
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setup_server("intelephense", {
|
setup_server("intelephense", {
|
||||||
filetypes = { "php" },
|
filetypes = { "php" },
|
||||||
root_dir = fallback_root_dir,
|
-- root_dir = fallback_root_dir,
|
||||||
init_options = {
|
init_options = {
|
||||||
licenceKey = vim.fn.readfile(vim.fn.expand("$HOME/.config/intelephense/license.txt"))[1],
|
licenceKey = (function()
|
||||||
|
local license_path = vim.fn.expand("$HOME/.config/intelephense/license.txt")
|
||||||
|
if vim.fn.filereadable(license_path) == 1 then
|
||||||
|
return vim.fn.readfile(license_path)[1]
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end)(),
|
||||||
},
|
},
|
||||||
settings = {
|
settings = {
|
||||||
intelephense = {
|
intelephense = {
|
||||||
@@ -167,29 +157,20 @@ setup_server("intelephense", {
|
|||||||
-- phpcs / phpstan configs
|
-- phpcs / phpstan configs
|
||||||
vim.g.nvim_phpcs_config_phpcs_path = 'phpcs'
|
vim.g.nvim_phpcs_config_phpcs_path = 'phpcs'
|
||||||
vim.g.nvim_phpcs_config_phpcbf_path = 'phpcbf'
|
vim.g.nvim_phpcs_config_phpcbf_path = 'phpcbf'
|
||||||
vim.g.ale_php_phpstan_executable = '/home/mace/.config/composer/vendor/bin/phpstan'
|
|
||||||
|
|
||||||
local phpcs_config = "/home/mace/repos/configs/phpcs.xml"
|
local phpcs_config = "~/repos/configs/phpcs.xml"
|
||||||
local phpcs_config_new = "/home/mace/repos/dotfiles/phpcs.xml"
|
local phpcs_config_new = "~/repos/dotfiles/phpcs.xml"
|
||||||
if vim.loop.fs_stat(phpcs_config_new) then
|
if vim.uv.fs_stat(phpcs_config_new) then
|
||||||
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config_new
|
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config_new
|
||||||
elseif vim.loop.fs_stat(phpcs_config) then
|
elseif vim.uv.fs_stat(phpcs_config) then
|
||||||
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config
|
vim.g.nvim_phpcs_config_phpcs_standard = phpcs_config
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.lsp.config("lua_ls", {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
-- === ENABLE: tell Neovim to autostart these configs lazily (filetype + root_dir)
|
-- === ENABLE: tell Neovim to autostart these configs lazily (filetype + root_dir)
|
||||||
-- call this early in your init (so FileType autocommands are installed before opening files)
|
-- call this early in your init (so FileType autocommands are installed before opening files)
|
||||||
local enabled_servers = {
|
local enabled_servers = {
|
||||||
"bashls", "lemminx", "yamlls", "jsonls", "pyright", "html", "cssls",
|
"bashls", "lemminx", "yamlls", "jsonls", "pyright", "html", "cssls",
|
||||||
"tailwindcss", "emmet_ls", "eslint", "rust_analyzer", "lua_ls",
|
"eslint", "rust_analyzer", "lua_ls",
|
||||||
"phpactor", "intelephense"
|
"intelephense"
|
||||||
}
|
}
|
||||||
vim.lsp.enable(enabled_servers)
|
vim.lsp.enable(enabled_servers)
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
-- import lspsaga safely
|
|
||||||
-- local saga_status, saga = pcall(require, "lspsaga")
|
|
||||||
-- if not saga_status then
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
require("lazy").setup({
|
|
||||||
"glepnir/lspsaga.nvim",
|
|
||||||
event = "BufRead",
|
|
||||||
config = function()
|
|
||||||
require("lspsaga").setup({})
|
|
||||||
end,
|
|
||||||
dependencies = { { "nvim-tree/nvim-web-devicons" } },
|
|
||||||
-- keybinds for navigation in lspsaga window
|
|
||||||
move_in_saga = { prev = "<C-k>", next = "<C-j>" },
|
|
||||||
-- use enter to open file with finder
|
|
||||||
finder_action_keys = {
|
|
||||||
open = "<CR>",
|
|
||||||
},
|
|
||||||
-- use enter to open file with definition preview
|
|
||||||
definition_action_keys = {
|
|
||||||
edit = "<CR>",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
+39
-9
@@ -1,5 +1,20 @@
|
|||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
-- phpstan: use the project's own phpstan.neon when there is one, otherwise fall
|
||||||
|
-- back to the generic config in dotfiles.
|
||||||
|
local phpstan_global_config = vim.fn.expand("~/repos/dotfiles/php/phpstan-global.neon")
|
||||||
|
|
||||||
|
-- returns the config path to pass via -c, or nil when phpstan can discover a
|
||||||
|
-- local config itself (that also picks up its `includes:`, e.g. a baseline)
|
||||||
|
local function phpstan_config_arg(root)
|
||||||
|
for _, name in ipairs({ "phpstan.neon", "phpstan.neon.dist" }) do
|
||||||
|
if vim.uv.fs_stat(root .. "/" .. name) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return phpstan_global_config
|
||||||
|
end
|
||||||
|
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.formatting.phpcbf.with({
|
null_ls.builtins.formatting.phpcbf.with({
|
||||||
@@ -7,16 +22,32 @@ null_ls.setup({
|
|||||||
extra_args = { "--standard=PSR12", "--standard=phpcs.xml" },
|
extra_args = { "--standard=PSR12", "--standard=phpcs.xml" },
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.diagnostics.phpstan.with({
|
null_ls.builtins.diagnostics.phpstan.with({
|
||||||
command = "phpstan",
|
-- prefer the project's own phpstan (extensions and baselines are
|
||||||
args = {
|
-- version bound), fall back to the mason binary
|
||||||
"analyse",
|
dynamic_command = function(params, done)
|
||||||
"--error-format", "raw",
|
local local_bin = params.root .. "/vendor/bin/phpstan"
|
||||||
"--no-progress",
|
if vim.fn.executable(local_bin) == 1 then
|
||||||
"$FILENAME", -- or your project's entrypoint folder
|
return done(local_bin)
|
||||||
},
|
end
|
||||||
method = null_ls.methods.DIAGNOSTICS_ON_SAVE, -- or ON_OPEN or BOTH
|
return done("phpstan")
|
||||||
|
end,
|
||||||
|
args = function(params)
|
||||||
|
local args = { "analyse", "--error-format", "json", "--no-progress" }
|
||||||
|
local config = phpstan_config_arg(params.root)
|
||||||
|
if config then
|
||||||
|
vim.list_extend(args, { "-c", config })
|
||||||
|
end
|
||||||
|
table.insert(args, "$FILENAME")
|
||||||
|
return args
|
||||||
|
end,
|
||||||
|
-- analyse the file on disk, not a copy in /tmp: phpstan needs the
|
||||||
|
-- project's autoloader and its configured paths/scanDirectories
|
||||||
|
method = null_ls.methods.DIAGNOSTICS_ON_SAVE,
|
||||||
|
to_temp_file = false,
|
||||||
|
timeout = 60000, -- a cold run easily exceeds null-ls' 5s default
|
||||||
condition = function(utils)
|
condition = function(utils)
|
||||||
return utils.root_has_file({ "phpstan.neon", "phpstan.neon.dist" })
|
return utils.root_has_file({ "phpstan.neon", "phpstan.neon.dist" })
|
||||||
|
or vim.uv.fs_stat(phpstan_global_config) ~= nil
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.diagnostics.phpcs.with({
|
null_ls.builtins.diagnostics.phpcs.with({
|
||||||
@@ -38,5 +69,4 @@ null_ls.setup({
|
|||||||
-- no extra_args needed if config file is correctly named and in root
|
-- no extra_args needed if config file is correctly named and in root
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
})
|
||||||
|
|||||||
+32
-7
@@ -19,6 +19,11 @@ end
|
|||||||
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
||||||
require("luasnip/loaders/from_vscode").lazy_load()
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
|
local function has_words_before()
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
end
|
||||||
|
|
||||||
vim.opt.completeopt = "menu,menuone,noselect"
|
vim.opt.completeopt = "menu,menuone,noselect"
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
@@ -34,20 +39,40 @@ cmp.setup({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
["<C-k>"] = cmp.mapping(function(fallback)
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
["<C-j>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
}),
|
}),
|
||||||
-- sources for autocompletion
|
-- sources for autocompletion
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" }, -- lsp
|
{ name = "nvim_lsp" }, -- lsp
|
||||||
{ name = "luasnip" }, -- snippets
|
{ name = "luasnip" }, -- snippets
|
||||||
{ name = "buffer", keyword_length = 5 }, -- text within current buffer
|
{ name = "buffer", keyword_length = 5 }, -- text within current buffer
|
||||||
{ name = "path" }, -- file system paths
|
{ name = "path" }, -- file system paths
|
||||||
}),
|
}),
|
||||||
-- configure lspkind for vs-code like icons
|
-- configure lspkind for vs-code like icons
|
||||||
formatting = {
|
formatting = {
|
||||||
|
|||||||
+10
-1
@@ -15,9 +15,10 @@ opt.expandtab = true
|
|||||||
opt.autoindent = true
|
opt.autoindent = true
|
||||||
|
|
||||||
opt.wrap = false
|
opt.wrap = false
|
||||||
|
opt.breakindent = true
|
||||||
|
|
||||||
-- scroll offset
|
-- scroll offset
|
||||||
vim.opt.scrolloff = 8
|
opt.scrolloff = 8
|
||||||
|
|
||||||
-- search settings
|
-- search settings
|
||||||
opt.smartcase = true
|
opt.smartcase = true
|
||||||
@@ -29,6 +30,9 @@ opt.termguicolors = true
|
|||||||
opt.background = 'dark'
|
opt.background = 'dark'
|
||||||
opt.signcolumn = 'yes'
|
opt.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- mouse
|
||||||
|
opt.mouse = 'a'
|
||||||
|
|
||||||
-- clipboard
|
-- clipboard
|
||||||
opt.clipboard:append 'unnamedplus'
|
opt.clipboard:append 'unnamedplus'
|
||||||
|
|
||||||
@@ -37,3 +41,8 @@ opt.splitright = true
|
|||||||
opt.splitbelow = true
|
opt.splitbelow = true
|
||||||
|
|
||||||
opt.iskeyword:append '-'
|
opt.iskeyword:append '-'
|
||||||
|
|
||||||
|
-- undo & responsiveness
|
||||||
|
opt.undofile = true
|
||||||
|
opt.updatetime = 250
|
||||||
|
opt.timeoutlen = 300
|
||||||
|
|||||||
+26
-31
@@ -22,20 +22,25 @@ return {
|
|||||||
|
|
||||||
-- vs-code like icons for autocompletion
|
-- vs-code like icons for autocompletion
|
||||||
"onsails/lspkind.nvim",
|
"onsails/lspkind.nvim",
|
||||||
"catppuccin/nvim",
|
{ "catppuccin/nvim", name = "catppuccin" },
|
||||||
as = "catppuccin",
|
|
||||||
{ "startup-nvim/startup.nvim", dependencies = "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"glepnir/lspsaga.nvim",
|
'nvimdev/lspsaga.nvim',
|
||||||
event = "BufRead",
|
|
||||||
config = function()
|
config = function()
|
||||||
require("lspsaga").setup({})
|
require('lspsaga').setup({
|
||||||
|
-- use enter to open file from the finder
|
||||||
|
finder = {
|
||||||
|
keys = { toggle_or_open = "<CR>" },
|
||||||
|
},
|
||||||
|
-- use enter to open file with definition preview
|
||||||
|
definition = {
|
||||||
|
keys = { edit = "<CR>" },
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "nvim-tree/nvim-web-devicons" },
|
'nvim-treesitter/nvim-treesitter', -- optional
|
||||||
--Please make sure you install markdown and markdown_inline parser
|
'nvim-tree/nvim-web-devicons', -- optional
|
||||||
{ "nvim-treesitter/nvim-treesitter" },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -52,7 +57,6 @@ return {
|
|||||||
"theHamsta/nvim-dap-virtual-text",
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
dependencies = "mfussenegger/nvim-dap",
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
},
|
},
|
||||||
"nvim-telescope/telescope-dap.nvim",
|
|
||||||
-- autoclose parens, brackets, quotes, etc...
|
-- autoclose parens, brackets, quotes, etc...
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
|
|
||||||
@@ -62,30 +66,23 @@ return {
|
|||||||
config = true
|
config = true
|
||||||
},
|
},
|
||||||
|
|
||||||
"norcalli/nvim-colorizer.lua",
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"catgoose/nvim-colorizer.lua",
|
||||||
dependencies = {
|
event = "BufReadPre",
|
||||||
{
|
opts = {},
|
||||||
"SmiteshP/nvim-navbuddy",
|
|
||||||
dependencies = {
|
|
||||||
"SmiteshP/nvim-navic",
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
},
|
|
||||||
opts = { lsp = { auto_attach = true } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"easymotion/vim-easymotion",
|
"easymotion/vim-easymotion",
|
||||||
|
|
||||||
-- Markdown
|
-- Markdown
|
||||||
{
|
-- {
|
||||||
"iamcco/markdown-preview.nvim",
|
-- "iamcco/markdown-preview.nvim",
|
||||||
ft = "markdown",
|
-- cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||||
build = function()
|
-- build = "cd app && yarn install",
|
||||||
vim.fn["mkdp#util#install"]()
|
-- init = function()
|
||||||
end,
|
-- vim.g.mkdp_filetypes = { "markdown" }
|
||||||
},
|
-- end,
|
||||||
|
-- ft = { "markdown" },
|
||||||
|
-- },
|
||||||
|
|
||||||
{
|
{
|
||||||
'akinsho/bufferline.nvim',
|
'akinsho/bufferline.nvim',
|
||||||
@@ -101,8 +98,6 @@ return {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'echasnovski/mini.icons', version = false },
|
|
||||||
|
|
||||||
{
|
{
|
||||||
-- HTTP REST-Client Interface
|
-- HTTP REST-Client Interface
|
||||||
'mistweaverco/kulala.nvim',
|
'mistweaverco/kulala.nvim',
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
-- import comment plugin safely
|
|
||||||
local setup, startup = pcall(require, "startup")
|
|
||||||
if not setup then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- enable startup
|
|
||||||
startup.setup({
|
|
||||||
theme = "dashboard"
|
|
||||||
})
|
|
||||||
@@ -19,8 +19,13 @@ telescope.setup({
|
|||||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||||
["<C-j>"] = actions.move_selection_next, -- move to next 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
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist
|
||||||
|
['<C-u>'] = false,
|
||||||
|
['<C-d>'] = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
preview = {
|
||||||
|
treesitter = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -43,3 +48,18 @@ vim.api.nvim_set_keymap(
|
|||||||
":lua require'telescope'.extensions.project.project{}<CR>",
|
":lua require'telescope'.extensions.project.project{}<CR>",
|
||||||
{ noremap = true, silent = true }
|
{ noremap = true, silent = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
|
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
|
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
})
|
||||||
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
|
||||||
|
|||||||
@@ -43,21 +43,3 @@ end
|
|||||||
|
|
||||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||||
local Terminal = require("toggleterm.terminal").Terminal
|
|
||||||
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
|
|
||||||
|
|
||||||
function _LAZYGIT_TOGGLE()
|
|
||||||
lazygit:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
local node = Terminal:new({ cmd = "node", hidden = true })
|
|
||||||
|
|
||||||
function _NODE_TOGGLE()
|
|
||||||
node:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
local python = Terminal:new({ cmd = "python3", hidden = true })
|
|
||||||
|
|
||||||
function _PYTHON_TOGGLE()
|
|
||||||
python:toggle()
|
|
||||||
end
|
|
||||||
|
|||||||
+1
-27
@@ -1,26 +1,6 @@
|
|||||||
set number
|
|
||||||
set hlsearch
|
|
||||||
set incsearch
|
|
||||||
set smartcase
|
|
||||||
set ignorecase
|
|
||||||
set wrap
|
|
||||||
set linebreak
|
|
||||||
set smartindent
|
|
||||||
set tabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set expandtab
|
|
||||||
set splitright splitbelow
|
|
||||||
set timeoutlen=1000
|
|
||||||
set number
|
|
||||||
set relativenumber
|
|
||||||
set scrolloff=10
|
|
||||||
|
|
||||||
syntax on
|
syntax on
|
||||||
filetype indent on
|
filetype indent on
|
||||||
set smartindent
|
|
||||||
|
|
||||||
let mapleader = " "
|
|
||||||
imap jj <Esc>
|
|
||||||
imap <C-l> <Del>
|
imap <C-l> <Del>
|
||||||
nnoremap <Leader>ü "+p
|
nnoremap <Leader>ü "+p
|
||||||
|
|
||||||
@@ -41,21 +21,15 @@ nnoremap <leader>a ggVG
|
|||||||
nnoremap ,b :buffers<CR>
|
nnoremap ,b :buffers<CR>
|
||||||
" nnoremap <leader>t :Explorer<CR>
|
" nnoremap <leader>t :Explorer<CR>
|
||||||
" use leader e instead
|
" use leader e instead
|
||||||
nnoremap <leader>y "+yy
|
|
||||||
vnoremap <leader>y "+y
|
vnoremap <leader>y "+y
|
||||||
|
|
||||||
:nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
|
":nnoremap <Leader>s :%s/\<<C-r><C-w>\>/
|
||||||
" xnoremap ("<leader>p", "\"_dP")
|
" xnoremap ("<leader>p", "\"_dP")
|
||||||
" autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
" autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
|
|
||||||
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
|
vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
|
||||||
let g:python3_host_prog="/usr/bin/python3"
|
let g:python3_host_prog="/usr/bin/python3"
|
||||||
|
|
||||||
nnoremap <C-J> <C-W><C-J>
|
|
||||||
nnoremap <C-K> <C-W><C-K>
|
|
||||||
nnoremap <C-L> <C-W><C-L>
|
|
||||||
nnoremap <C-H> <C-W><C-H>
|
|
||||||
|
|
||||||
" nnoremap <C-d> <C-d>zz
|
" nnoremap <C-d> <C-d>zz
|
||||||
" nnoremap <C-u> <C-u>zz
|
" nnoremap <C-u> <C-u>zz
|
||||||
|
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
-- autoformat.lua
|
|
||||||
--
|
|
||||||
-- Use your language server to automatically format your code on save.
|
|
||||||
-- Adds additional commands as well to manage the behavior
|
|
||||||
|
|
||||||
return {
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
config = function()
|
|
||||||
-- Switch for controlling whether you want autoformatting.
|
|
||||||
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
|
||||||
local format_is_enabled = true
|
|
||||||
vim.api.nvim_create_user_command('KickstartFormatToggle', function()
|
|
||||||
format_is_enabled = not format_is_enabled
|
|
||||||
print('Setting autoformatting to: ' .. tostring(format_is_enabled))
|
|
||||||
end, {})
|
|
||||||
|
|
||||||
-- Create an augroup that is used for managing our formatting autocmds.
|
|
||||||
-- We need one augroup per client to make sure that multiple clients
|
|
||||||
-- can attach to the same buffer without interfering with each other.
|
|
||||||
local _augroups = {}
|
|
||||||
local get_augroup = function(client)
|
|
||||||
if not _augroups[client.id] then
|
|
||||||
local group_name = 'kickstart-lsp-format-' .. client.name
|
|
||||||
local id = vim.api.nvim_create_augroup(group_name, { clear = true })
|
|
||||||
_augroups[client.id] = id
|
|
||||||
end
|
|
||||||
|
|
||||||
return _augroups[client.id]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Whenever an LSP attaches to a buffer, we will run this function.
|
|
||||||
--
|
|
||||||
-- See `:help LspAttach` for more information about this autocmd event.
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
|
||||||
-- This is where we attach the autoformatting for reasonable clients
|
|
||||||
callback = function(args)
|
|
||||||
local client_id = args.data.client_id
|
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
|
||||||
local bufnr = args.buf
|
|
||||||
|
|
||||||
-- Only attach to clients that support document formatting
|
|
||||||
if not client.server_capabilities.documentFormattingProvider then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Tsserver usually works poorly. Sorry you work with bad languages
|
|
||||||
-- You can remove this line if you know what you're doing :)
|
|
||||||
if client.name == 'tsserver' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create an autocmd that will run *before* we save the buffer.
|
|
||||||
-- Run the formatting command for the LSP that has just attached.
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = get_augroup(client),
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
if not format_is_enabled then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.buf.format {
|
|
||||||
async = false,
|
|
||||||
filter = function(c)
|
|
||||||
return c.id == client.id
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user