add zen plugin, remap cleanup/combination, add more languages to treesitter
This commit is contained in:
parent
10f457c40f
commit
cbd4c176ef
8 changed files with 218 additions and 188 deletions
|
|
@ -157,5 +157,5 @@ This is how it looks like:
|
||||||
|
|
||||||
- ollama integration <https://github.com/nomnivore/ollama.nvim>
|
- ollama integration <https://github.com/nomnivore/ollama.nvim>
|
||||||
- Solution to run file_browser when doing a vertical/horizontal split?
|
- Solution to run file_browser when doing a vertical/horizontal split?
|
||||||
- https://github.com/folke/trouble.nvim
|
- <https://github.com/folke/trouble.nvim>
|
||||||
- Implement linting, see <https://www.josean.com/posts/neovim-linting-and-formatting>
|
- Implement linting, see <https://www.josean.com/posts/neovim-linting-and-formatting>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
||||||
|
"twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
|
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
||||||
|
"zen-mode.nvim": { "branch": "main", "commit": "50e2e2a36cc97847d9ab3b1a3555ba2ef6839b50" }
|
||||||
}
|
}
|
||||||
|
|
@ -1,93 +1,98 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
branch = 'v3.x',
|
branch = "v3.x",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
config = false,
|
config = false,
|
||||||
init = function()
|
init = function()
|
||||||
-- Disable automatic setup, we are doing it manually
|
-- Disable automatic setup, we are doing it manually
|
||||||
vim.g.lsp_zero_extend_cmp = 0
|
vim.g.lsp_zero_extend_cmp = 0
|
||||||
vim.g.lsp_zero_extend_lspconfig = 0
|
vim.g.lsp_zero_extend_lspconfig = 0
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'williamboman/mason.nvim',
|
"williamboman/mason.nvim",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = true,
|
config = true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'hrsh7th/nvim-cmp',
|
"hrsh7th/nvim-cmp",
|
||||||
event = 'InsertEnter',
|
event = "InsertEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{'L3MON4D3/LuaSnip'},
|
{ "L3MON4D3/LuaSnip" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Here is where you configure the autocompletion settings.
|
-- Here is where you configure the autocompletion settings.
|
||||||
local lsp_zero = require('lsp-zero')
|
local lsp_zero = require("lsp-zero")
|
||||||
lsp_zero.extend_cmp()
|
lsp_zero.extend_cmp()
|
||||||
|
|
||||||
local cmp = require('cmp')
|
local cmp = require("cmp")
|
||||||
local cmp_action = lsp_zero.cmp_action()
|
local cmp_action = lsp_zero.cmp_action()
|
||||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
formatting = lsp_zero.cmp_format(),
|
formatting = lsp_zero.cmp_format(),
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-l>'] = cmp.mapping.confirm({select = true}), -- accept LSP autocompletion
|
["<C-l>"] = cmp.mapping.confirm({ select = true }), -- accept LSP autocompletion
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
||||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
"neovim/nvim-lspconfig",
|
||||||
cmd = {'LspInfo', 'LspInstall', 'LspStart'},
|
cmd = { "LspInfo", "LspInstall", "LspStart" },
|
||||||
event = {'BufReadPre', 'BufNewFile'},
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{'hrsh7th/cmp-nvim-lsp'},
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
{'williamboman/mason-lspconfig.nvim'},
|
{ "williamboman/mason-lspconfig.nvim" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- This is where all the LSP shenanigans will live
|
-- This is where all the LSP shenanigans will live
|
||||||
local lsp_zero = require('lsp-zero')
|
local lsp_zero = require("lsp-zero")
|
||||||
lsp_zero.extend_lspconfig()
|
lsp_zero.extend_lspconfig()
|
||||||
|
|
||||||
-- Keybindings only active when a LS is active for the curr. file
|
-- Keybindings only active when a LS is active for the curr. file
|
||||||
lsp_zero.on_attach(function(client, bufnr)
|
lsp_zero.on_attach(function(client, bufnr)
|
||||||
-- see :help lsp-zero-keybindings
|
-- see :help lsp-zero-keybindings
|
||||||
-- to learn the available actions
|
-- to learn the available actions
|
||||||
lsp_zero.default_keymaps({buffer = bufnr})
|
lsp_zero.default_keymaps({ buffer = bufnr })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
require('mason').setup({
|
require("mason").setup({
|
||||||
ui = {
|
ui = {
|
||||||
icons = {
|
icons = {
|
||||||
package_installed = "✓",
|
package_installed = "✓",
|
||||||
package_pending = "➜",
|
package_pending = "➜",
|
||||||
package_uninstalled = "✗",
|
package_uninstalled = "✗",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require('mason-lspconfig').setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = {},
|
ensure_installed = {},
|
||||||
handlers = {
|
handlers = {
|
||||||
lsp_zero.default_setup,
|
-- names must align with Mason names
|
||||||
lua_ls = function()
|
lsp_zero.default_setup,
|
||||||
-- (Optional) Configure lua language server for neovim
|
lua_ls = function()
|
||||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
local lua_opts = lsp_zero.nvim_lua_ls()
|
||||||
require('lspconfig').lua_ls.setup(lua_opts)
|
require("lspconfig").lua_ls.setup(lua_opts)
|
||||||
end,
|
end,
|
||||||
}
|
--ansiblels = function()
|
||||||
})
|
-- require("lspconfig").ansiblels.setup({
|
||||||
end
|
-- filetypes = "yaml",
|
||||||
}
|
-- })
|
||||||
|
--end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,49 @@
|
||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
tag = "0.1.4",
|
tag = "0.1.4",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
--config = function(lazy, opts)
|
--config = function(lazy, opts)
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require('telescope')
|
local telescope = require("telescope")
|
||||||
telescope.load_extension('fzf')
|
telescope.load_extension("fzf")
|
||||||
telescope.load_extension('file_browser')
|
telescope.load_extension("file_browser")
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
sorting_strategy = "ascending",
|
sorting_strategy = "ascending",
|
||||||
wrap_result = true,
|
wrap_result = true,
|
||||||
layout_strategy = "horizontal",
|
layout_strategy = "horizontal",
|
||||||
layout_config = {
|
layout_config = {
|
||||||
horizontal = {
|
horizontal = {
|
||||||
prompt_position = "top",
|
prompt_position = "top",
|
||||||
preview_width = 0.4,
|
preview_width = 0.4,
|
||||||
width = 0.75,
|
width = 0.75,
|
||||||
height = 0.75,
|
height = 0.75,
|
||||||
preview_cutoff = 90,
|
preview_cutoff = 90,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
pickers = {
|
pickers = {
|
||||||
find_files = {
|
find_files = {
|
||||||
hidden = true
|
hidden = true,
|
||||||
},
|
wrap_results = false, -- this is not about the preview
|
||||||
live_grep = {
|
},
|
||||||
additional_args = function()
|
live_grep = {
|
||||||
return { '--hidden', '--glob', '!**/.git/*' }
|
additional_args = function()
|
||||||
end
|
return { "--hidden", "--glob", "!**/.git/*" }
|
||||||
},
|
end,
|
||||||
grep_string = {
|
},
|
||||||
additional_args = function()
|
grep_string = {
|
||||||
return { '--hidden', '--glob', '!**/.git/*' }
|
additional_args = function()
|
||||||
end
|
return { "--hidden", "--glob", "!**/.git/*" }
|
||||||
},
|
end,
|
||||||
-- note: remove the 'builtin.' prefix.
|
},
|
||||||
["lsp_references"] = { wrap_results = true, },
|
["lsp_references"] = { wrap_results = true },
|
||||||
["lsp_definitions"] = { wrap_results = true, },
|
["lsp_definitions"] = { wrap_results = true },
|
||||||
["diagnostics"] = { wrap_results = true, },
|
["diagnostics"] = { wrap_results = true },
|
||||||
["find_files"] = { wrap_results = true, },
|
["buffers"] = { sort_mru = true, ignore_current_buffer = false },
|
||||||
["buffers"] = { sort_mru = true, ignore_current_buffer = true },
|
},
|
||||||
}
|
})
|
||||||
})
|
end,
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,56 @@
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local treesitter = require("nvim-treesitter.configs")
|
local treesitter = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
treesitter.setup({
|
treesitter.setup({
|
||||||
highlight = { enable = true, },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
-- language list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
|
-- language list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua",
|
"lua",
|
||||||
"comment",
|
"comment", -- used for TODO/FIXME/NOTE etc
|
||||||
"vim",
|
"vim",
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
"bash",
|
"bash",
|
||||||
"diff",
|
"diff",
|
||||||
"gitignore",
|
"gitignore",
|
||||||
"markdown",
|
"markdown",
|
||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
"elixir",
|
"elixir",
|
||||||
"eex",
|
"eex",
|
||||||
"heex",
|
"heex",
|
||||||
"yaml",
|
"yaml",
|
||||||
"html",
|
"html",
|
||||||
"css",
|
"javascript",
|
||||||
"dockerfile",
|
"css",
|
||||||
"query",
|
"dockerfile",
|
||||||
"hcl",
|
"query",
|
||||||
},
|
"hcl",
|
||||||
incremental_selection = {
|
"bicep",
|
||||||
enable = true,
|
"csv",
|
||||||
keymaps = {
|
"properties",
|
||||||
init_selection = "<C-space>",
|
"ini",
|
||||||
node_incremental = "<C-space>",
|
"python",
|
||||||
scope_incremental = false,
|
"regex",
|
||||||
node_decremental = "<bs>",
|
"json",
|
||||||
},
|
},
|
||||||
},
|
incremental_selection = {
|
||||||
})
|
enable = true,
|
||||||
end
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
lua/weeheavy/plugins/zenmode.lua
Normal file
13
lua/weeheavy/plugins/zenmode.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Distraction-free coding when you need it
|
||||||
|
-- https://github.com/folke/zen-mode.nvim
|
||||||
|
return {
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"folke/twilight.nvim",
|
||||||
|
opts = {
|
||||||
|
context = 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
opts = {},
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,7 @@ vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
-- Separate sign colum (extra column for Git/LSP)
|
-- Separate sign colum (extra column for Git/LSP)
|
||||||
vim.wo.signcolumn = 'yes'
|
vim.wo.signcolumn = "yes"
|
||||||
|
|
||||||
vim.opt.tabstop = 4
|
vim.opt.tabstop = 4
|
||||||
vim.opt.softtabstop = 4
|
vim.opt.softtabstop = 4
|
||||||
|
|
@ -17,7 +17,7 @@ vim.opt.shiftwidth = 4
|
||||||
vim.opt.expandtab = true -- indent using spaces instead of <Tab>
|
vim.opt.expandtab = true -- indent using spaces instead of <Tab>
|
||||||
|
|
||||||
-- highlight columns
|
-- highlight columns
|
||||||
vim.opt.colorcolumn = '80,120'
|
vim.opt.colorcolumn = "80,120"
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
|
@ -40,13 +40,13 @@ vim.opt.scrolloff = 5
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.background = 'dark' -- light, dark
|
vim.opt.background = "dark" -- light, dark
|
||||||
-- Themes: duskfox, tokyonight-night, tokyonight-storm, tokyonight-day, tokyonight-moon
|
-- Themes: duskfox, tokyonight-night, tokyonight-storm, tokyonight-day, tokyonight-moon
|
||||||
vim.cmd.colorscheme 'tokyonight-storm'
|
vim.cmd.colorscheme("tokyonight-storm")
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.opt.updatetime = 250
|
vim.opt.updatetime = 250
|
||||||
vim.opt.timeoutlen = 300
|
vim.opt.timeoutlen = 300
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.opt.completeopt = 'menuone,noselect'
|
vim.opt.completeopt = "menuone,noselect"
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,14 @@ vim.keymap.set(
|
||||||
":Telescope find_files hidden=true no_ignore=false <CR>",
|
":Telescope find_files hidden=true no_ignore=false <CR>",
|
||||||
{ noremap = true, desc = "File search" }
|
{ noremap = true, desc = "File search" }
|
||||||
)
|
)
|
||||||
vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<CR>", { noremap = true, desc = "Live grep through all files" })
|
--vim.keymap.set("n", "<leader>fg", ":Telescope live_grep<CR>", { noremap = true, desc = "Live grep through all files" })
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader><leader>",
|
"<leader>fg",
|
||||||
":Telescope buffers preview=false<CR>",
|
":Telescope grep_string<CR>",
|
||||||
{ noremap = true, desc = "Show open buffers" }
|
{ noremap = true, desc = "Search text under cursor in cwd/grep search string" }
|
||||||
)
|
)
|
||||||
|
vim.keymap.set("n", "<leader><leader>", ":Telescope buffers<CR>", { noremap = true, desc = "Show open buffers" })
|
||||||
vim.keymap.set("n", "<leader>gst", ":Telescope git_status<CR>", { noremap = true, desc = "Git status" })
|
vim.keymap.set("n", "<leader>gst", ":Telescope git_status<CR>", { noremap = true, desc = "Git status" })
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
|
|
@ -68,3 +69,5 @@ vim.keymap.set({ "n", "v" }, "<leader>o", function()
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
})
|
})
|
||||||
end, { desc = "Format file or range (in visual mode)" })
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>z", ":ZenMode<CR>") -- toggle zen-mode.nvim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue