mirror of
https://github.com/BalrajSinghGidda/nixos-dotfiles.git
synced 2026-04-07 09:27:23 +00:00
Testing NVF Configs
This commit is contained in:
@@ -4,7 +4,6 @@ This directory contains dotfiles for various applications, managed by Home Manag
|
||||
|
||||
## Applications
|
||||
|
||||
- **nvim/** - Neovim configuration
|
||||
- **qtile/** - Qtile window manager configuration
|
||||
- **rofi/** - Rofi launcher theme
|
||||
- **picom/** - Picom compositor settings
|
||||
@@ -17,7 +16,6 @@ These configurations are symlinked to `~/.config/` by Home Manager.
|
||||
The linking is configured in `hosts/nixos-btw/home.nix`:
|
||||
|
||||
```nix
|
||||
xdg.configFile."nvim".source = ../../config/nvim;
|
||||
xdg.configFile."qtile".source = ../../config/qtile;
|
||||
# etc...
|
||||
```
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
# Neovim Keybinds Documentation
|
||||
|
||||
This document provides a simple and organized overview of all the custom keybinds defined in my Neovim configuration.
|
||||
|
||||
## General Keybinds
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `<leader>cd` | Open Ex mode (`:Ex`) |
|
||||
| `n` | `J` | Join lines while keeping the cursor in place |
|
||||
| `n` | `<C-d>` | Scroll half-page down and keep the cursor centered |
|
||||
| `n` | `<C-u>` | Scroll half-page up and keep the cursor centered |
|
||||
| `n` | `n` | Move to next search result and keep it centered |
|
||||
| `n` | `N` | Move to previous search result and keep it centered |
|
||||
| `n` | `Q` | Disable Ex mode |
|
||||
| `n` | `<C-k>` | Jump to next quickfix entry and keep it centered |
|
||||
| `n` | `<C-j>` | Jump to previous quickfix entry and keep it centered |
|
||||
| `n` | `<leader>k` | Jump to next location entry and keep it centered |
|
||||
| `n` | `<leader>j` | Jump to previous location entry and keep it centered |
|
||||
| `i` | `<C-c>` | Exit insert mode (acts like `Esc`) |
|
||||
| `n` | `<leader>x` | Make current file executable (`chmod +x`) |
|
||||
| `n` | `<leader>u` | Toggle Undotree |
|
||||
| `n` | `<leader>rl` | Reload the Neovim config (`~/.config/nvim/init.lua`) |
|
||||
| `n` | `<leader><leader>` | Source the current file (`:so`) |
|
||||
|
||||
---
|
||||
|
||||
## Visual Mode Keybinds
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `v` | `J` | Move selected block down |
|
||||
| `v` | `K` | Move selected block up |
|
||||
| `x` | `<leader>p` | Paste without overwriting clipboard |
|
||||
| `v` | `<leader>y` | Yank into system clipboard (even on SSH) |
|
||||
|
||||
---
|
||||
|
||||
## Linting and Formatting
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `<leader>cc` | Run `php-cs-fixer` to lint and format PHP files |
|
||||
| `n` | `<F3>` | Format code (`LSP`) |
|
||||
|
||||
---
|
||||
|
||||
## Telescope Keybinds
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `<leader>ff` | Find files |
|
||||
| `n` | `<leader>fg` | Find git-tracked files |
|
||||
| `n` | `<leader>fo` | Open recent files |
|
||||
| `n` | `<leader>fq` | Open quickfix list |
|
||||
| `n` | `<leader>fh` | Open help tags |
|
||||
| `n` | `<leader>fb` | Open buffer list |
|
||||
| `n` | `<leader>fs` | Grep current string |
|
||||
| `n` | `<leader>fc` | Grep instances of the current file name without the extension |
|
||||
| `n` | `<leader>fi` | Find files in Neovim configuration directory (`~/.config/nvim/`) |
|
||||
|
||||
---
|
||||
|
||||
## Harpoon Integration
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `<leader>a` | Add current file to Harpoon list |
|
||||
| `n` | `<C-e>` | Toggle Harpoon quick menu |
|
||||
| `n` | `<leader>fl` | Open Harpoon window with Telescope |
|
||||
| `n` | `<C-p>` | Go to previous Harpoon mark |
|
||||
| `n` | `<C-n>` | Go to next Harpoon mark |
|
||||
|
||||
---
|
||||
|
||||
## LSP Keybinds
|
||||
|
||||
| Mode | Key | Action |
|
||||
|-----------|------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `K` | Show hover information |
|
||||
| `n` | `gd` | Go to definition |
|
||||
| `n` | `gD` | Go to declaration |
|
||||
| `n` | `gi` | Go to implementation |
|
||||
| `n` | `go` | Go to type definition |
|
||||
| `n` | `gr` | Show references |
|
||||
| `n` | `gs` | Show signature help |
|
||||
| `n` | `gl` | Show diagnostics in a floating window |
|
||||
| `n` | `<F2>` | Rename symbol |
|
||||
| `n`, `x` | `<F3>` | Format code asynchronously |
|
||||
| `n` | `<F4>` | Show code actions |
|
||||
|
||||
---
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
| Mode | Key | Action |
|
||||
|------|-----------------|---------------------------------------------------------------------------------------------|
|
||||
| `n` | `<leader>dg` | Run `DogeGenerate` (comment documentation generation) |
|
||||
| `n` | `<leader>s` | Replace all instances of the word under the cursor on the current line |
|
||||
|
||||
---
|
||||
|
||||
# LSP servers:
|
||||
|
||||
I am migrating my lsp config to /lua/plugins/lsp.lua because nvim v0.11 allows a very minimal debloated way to setup language server protocols.
|
||||
|
||||
Below is a running list of what and how to install the lsp's that are going to be configured in this build. I will avoid mason for now because I think its better to have full control over your system, and not outsource it to mason. Just uncommonet `return {` in /plugins/lsp.lua from the original lspconfig if you want to go that route.
|
||||
|
||||
1. { lua-language-server }
|
||||
- refer to distro ( pacman -Ss lua-language-server )
|
||||
2. { css-language-server --studio, html-language-server }
|
||||
- npm install -g vscode-langservers-extracted
|
||||
3. { intelephense }
|
||||
- npm install -g intelephense
|
||||
4. { typescript-language-server }
|
||||
- npm install -g typescript-language-server typescript
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
local set = vim.opt_local
|
||||
|
||||
set.shiftwidth = 2
|
||||
set.tabstop = 2
|
||||
set.softtabstop = 2
|
||||
set.expandtab = true
|
||||
|
||||
set.number = true
|
||||
set.relativenumber = true
|
||||
@@ -1,8 +0,0 @@
|
||||
local set = vim.opt_local
|
||||
set.number = true
|
||||
set.relativenumber = true
|
||||
set.number = true
|
||||
set.relativenumber = false
|
||||
set.wrap = true
|
||||
set.linebreak = true
|
||||
set.conceallevel = 0
|
||||
@@ -1,11 +0,0 @@
|
||||
-- ~/.config/nvim/after/ftplugin/nix.lua
|
||||
local set = vim.opt_local
|
||||
|
||||
set.shiftwidth = 2
|
||||
set.tabstop = 2
|
||||
set.softtabstop = 2
|
||||
set.expandtab = true
|
||||
|
||||
-- extras you want for Nix buffers
|
||||
set.number = true
|
||||
set.relativenumber = true
|
||||
@@ -1,3 +0,0 @@
|
||||
require('config.options')
|
||||
require('config.keybinds')
|
||||
require('config.lazy')
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"better-indent-support-for-php-with-html": { "branch": "master", "commit": "e907f07b53dd6d6b7b2f6956cd18202ef3f26c24" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
|
||||
"nvim-highlight-colors": { "branch": "main", "commit": "e0c4a58ec8c3ca7c92d3ee4eb3bc1dd0f7be317e" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "b033ab331ca0bccbd93c3c2b4f886fdfc09abec0" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" },
|
||||
"orgmode": { "branch": "master", "commit": "3629625199b9a45bdb41fa734bc2c6ef86d251bd" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"undotree": { "branch": "master", "commit": "178d19e00a643f825ea11d581b1684745d0c4eda" },
|
||||
"vim-doge": { "branch": "master", "commit": "03a84072ef21b205237c77986c78914395d646c3" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"vim-oscyank": { "branch": "main", "commit": "d67d76b2f19b868b70a1cf33a779d71dc092cb30" }
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
-- KEYBINDS
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>cd", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- Alt Up/Down in vscode
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z") -- Remap joining lines
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz") -- Keep cursor in place while moving up/down page
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv") -- center screen when looping search results
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- paste and don't replace clipboard over deleted text
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
|
||||
|
||||
-- sometimes in insert mode, control-c doesn't exactly work like escape
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
-- add binds for Control J/K to scroll thru quickfix list
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
|
||||
|
||||
-- What the heck is Ex mode?
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
-- getting Alex off my back :)
|
||||
vim.keymap.set("n", "<leader>dg", "<cmd>DogeGenerate<cr>")
|
||||
|
||||
-- lint / format php files for LC
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>!php-cs-fixer fix % --using-cache=no<cr>")
|
||||
|
||||
-- Replace all instances of whatever is under cursor (on line)
|
||||
vim.keymap.set("n", "<leader>s", [[:s/\<<C-r><C-w>\>//gI<Left><Left><Left>]])
|
||||
|
||||
-- make file executable
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
|
||||
-- yank into clipboard even if on ssh
|
||||
vim.keymap.set('n', '<leader>y', '<Plug>OSCYankOperator')
|
||||
vim.keymap.set('v', '<leader>y', '<Plug>OSCYankVisual')
|
||||
|
||||
-- reload without exiting vim
|
||||
vim.keymap.set("n", "<leader>rl", "<cmd>source ~/.config/nvim/init.lua<cr>")
|
||||
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
|
||||
-- Quickfix list stuff
|
||||
vim.keymap.set("n", "<leader>cl", ":cclose<CR>", { silent = true })
|
||||
vim.keymap.set("n", "<leader>co", ":copen<CR>", { silent = true })
|
||||
vim.keymap.set("n", "<leader>cn", ":cnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>cp", ":cprev<CR>zz")
|
||||
vim.keymap.set("n", "<leader>li", ":checkhealth vim.lsp<CR>", { desc = "LSP Info" })
|
||||
|
||||
-- run make in current working directory
|
||||
vim.keymap.set("n", "<leader>mm", "<cmd>make<CR>")
|
||||
|
||||
-- source file
|
||||
vim.keymap.set("n", "<leader><leader>", function()
|
||||
vim.cmd("so")
|
||||
end)
|
||||
@@ -1,21 +0,0 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = "plugins",
|
||||
change_detection = { notify = false },
|
||||
})
|
||||
@@ -1,56 +0,0 @@
|
||||
-- OPTIONS
|
||||
local set = vim.opt
|
||||
|
||||
--line nums
|
||||
set.relativenumber = true
|
||||
set.number = true
|
||||
|
||||
|
||||
-- indentation and tabs
|
||||
set.tabstop = 4
|
||||
set.shiftwidth = 4
|
||||
set.autoindent = true
|
||||
set.expandtab = true
|
||||
|
||||
-- search settings
|
||||
set.ignorecase = true
|
||||
set.smartcase = true
|
||||
|
||||
-- appearance
|
||||
set.termguicolors = true
|
||||
set.background = "dark"
|
||||
set.signcolumn = "yes"
|
||||
|
||||
-- cursor line
|
||||
set.cursorline = true
|
||||
|
||||
-- 80th column
|
||||
set.colorcolumn = "80"
|
||||
|
||||
-- clipboard
|
||||
set.clipboard:append("unnamedplus")
|
||||
|
||||
-- backspace
|
||||
set.backspace = "indent,eol,start"
|
||||
|
||||
-- split windows
|
||||
set.splitbelow = true
|
||||
set.splitright = true
|
||||
|
||||
-- dw/diw/ciw works on full-word
|
||||
set.iskeyword:append("-")
|
||||
|
||||
-- keep cursor at least 8 rows from top/bot
|
||||
set.scrolloff = 8
|
||||
|
||||
-- undo dir settings
|
||||
set.swapfile = false
|
||||
set.backup = false
|
||||
set.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
set.undofile = true
|
||||
|
||||
-- incremental search
|
||||
set.incsearch = true
|
||||
|
||||
-- faster cursor hold
|
||||
set.updatetime = 50
|
||||
@@ -1 +0,0 @@
|
||||
return {}
|
||||
@@ -1,27 +0,0 @@
|
||||
local function enable_transparency()
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "LineNr", { bg = "none" })
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
config = function()
|
||||
vim.cmd.colorscheme "tokyonight"
|
||||
vim.cmd('hi Directory guibg=NONE')
|
||||
vim.cmd('hi SignColumn guibg=NONE')
|
||||
enable_transparency()
|
||||
end
|
||||
},
|
||||
-- {
|
||||
-- "Mofiqul/vscode.nvim",
|
||||
-- name = 'vscode',
|
||||
-- config = function()
|
||||
-- vim.cmd.colorscheme "vscode"
|
||||
-- vim.cmd('hi Directory guibg=NONE')
|
||||
-- vim.cmd('hi SignColumn guibg=NONE')
|
||||
-- enable_transparency()
|
||||
-- end
|
||||
-- }
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-buffer",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.Item, -- <— preselect first item
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
window = { documentation = cmp.config.window.bordered() },
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- manual trigger if you want it
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then cmp.select_next_item() else fallback() end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then cmp.select_prev_item() end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
local conf = require('telescope.config').values
|
||||
local themes = require('telescope.themes')
|
||||
|
||||
-- helper function to use telescope on harpoon list.
|
||||
-- change get_ivy to other themes if wanted
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
local opts = themes.get_ivy({
|
||||
promt_title = "Working List"
|
||||
})
|
||||
|
||||
require("telescope.pickers").new(opts, {
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
}):find()
|
||||
end
|
||||
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require('harpoon')
|
||||
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
vim.keymap.set("n", "<leader>fl", function() toggle_telescope(harpoon:list()) end,
|
||||
{ desc = "Open harpoon window" })
|
||||
vim.keymap.set("n", "<C-p>", function() harpoon:list():prev() end)
|
||||
vim.keymap.set("n", "<C-n>", function() harpoon:list():next() end)
|
||||
end
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
return {
|
||||
-- {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- name = "plenary"
|
||||
-- },
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
return {}
|
||||
-- return {
|
||||
-- 'neovim/nvim-lspconfig',
|
||||
-- dependencies = {
|
||||
-- 'williamboman/mason.nvim',
|
||||
-- 'williamboman/mason-lspconfig.nvim',
|
||||
-- -- Autocompletion
|
||||
-- 'hrsh7th/nvim-cmp',
|
||||
-- 'hrsh7th/cmp-buffer',
|
||||
-- 'hrsh7th/cmp-path',
|
||||
-- 'saadparwaiz1/cmp_luasnip',
|
||||
-- 'hrsh7th/cmp-nvim-lsp',
|
||||
-- 'hrsh7th/cmp-nvim-lua',
|
||||
-- -- Snippets
|
||||
-- 'L3MON4D3/LuaSnip',
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- },
|
||||
-- config = function()
|
||||
-- local autoformat_filetypes = {
|
||||
-- "lua",
|
||||
-- }
|
||||
-- -- Create a keymap for vim.lsp.buf.implementation
|
||||
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||
-- callback = function(args)
|
||||
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- if not client then return end
|
||||
-- if vim.tbl_contains(autoformat_filetypes, vim.bo.filetype) then
|
||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- buffer = args.buf,
|
||||
-- callback = function()
|
||||
-- vim.lsp.buf.format({
|
||||
-- formatting_options = { tabSize = 4, insertSpaces = true },
|
||||
-- bufnr = args.buf,
|
||||
-- id = client.id
|
||||
-- })
|
||||
-- end
|
||||
-- })
|
||||
-- end
|
||||
-- end
|
||||
-- })
|
||||
--
|
||||
-- -- Add borders to floating windows
|
||||
-- vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
-- vim.lsp.handlers.hover,
|
||||
-- { border = 'rounded' }
|
||||
-- )
|
||||
-- vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||
-- vim.lsp.handlers.signature_help,
|
||||
-- { border = 'rounded' }
|
||||
-- )
|
||||
--
|
||||
-- -- Configure error/warnings interface
|
||||
-- vim.diagnostic.config({
|
||||
-- virtual_text = true,
|
||||
-- severity_sort = true,
|
||||
-- float = {
|
||||
-- style = 'minimal',
|
||||
-- border = 'rounded',
|
||||
-- header = '',
|
||||
-- prefix = '',
|
||||
-- },
|
||||
-- signs = {
|
||||
-- text = {
|
||||
-- [vim.diagnostic.severity.ERROR] = '✘',
|
||||
-- [vim.diagnostic.severity.WARN] = '▲',
|
||||
-- [vim.diagnostic.severity.HINT] = '⚑',
|
||||
-- [vim.diagnostic.severity.INFO] = '»',
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- local lspconfig_defaults = require('lspconfig').util.default_config
|
||||
-- lspconfig_defaults.capabilities = vim.tbl_deep_extend(
|
||||
-- 'force',
|
||||
-- lspconfig_defaults.capabilities,
|
||||
-- require('cmp_nvim_lsp').default_capabilities()
|
||||
-- )
|
||||
--
|
||||
-- -- This is where you enable features that only work
|
||||
-- -- if there is a language server active in the file
|
||||
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||
-- callback = function(event)
|
||||
-- local opts = { buffer = event.buf }
|
||||
--
|
||||
-- vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||||
-- vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>', opts)
|
||||
-- vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||
-- vim.keymap.set({ 'n', 'x' }, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||||
-- vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- require('mason').setup({})
|
||||
-- require('mason-lspconfig').setup({
|
||||
-- ensure_installed = {
|
||||
-- "lua_ls",
|
||||
-- "intelephense",
|
||||
-- "ts_ls",
|
||||
-- "eslint",
|
||||
-- "pyright",
|
||||
-- },
|
||||
-- handlers = {
|
||||
-- function(server_name)
|
||||
-- if server_name == "luals" then return end -- avoid starting with {}
|
||||
-- require('lspconfig')[server_name].setup({})
|
||||
-- end,
|
||||
--
|
||||
-- lua_ls = function()
|
||||
-- require('lspconfig').luals.setup({
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
-- runtime = {
|
||||
-- version = 'LuaJIT',
|
||||
-- },
|
||||
-- diagnostics = {
|
||||
-- globals = { 'vim' },
|
||||
-- },
|
||||
-- workspace = {
|
||||
-- library = { vim.env.VIMRUNTIME },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- local cmp = require('cmp')
|
||||
--
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
--
|
||||
-- vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
--
|
||||
-- cmp.setup({
|
||||
-- preselect = 'item',
|
||||
-- completion = {
|
||||
-- completeopt = 'menu,menuone,noinsert'
|
||||
-- },
|
||||
-- window = {
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
-- sources = {
|
||||
-- { name = 'path' },
|
||||
-- { name = 'nvim_lsp' },
|
||||
-- { name = 'buffer', keyword_length = 3 },
|
||||
-- { name = 'luasnip', keyword_length = 2 },
|
||||
-- },
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require('luasnip').lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
-- formatting = {
|
||||
-- fields = { 'abbr', 'menu', 'kind' },
|
||||
-- format = function(entry, item)
|
||||
-- local n = entry.source.name
|
||||
-- if n == 'nvim_lsp' then
|
||||
-- item.menu = '[LSP]'
|
||||
-- else
|
||||
-- item.menu = string.format('[%s]', n)
|
||||
-- end
|
||||
-- return item
|
||||
-- end,
|
||||
-- },
|
||||
-- mapping = cmp.mapping.preset.insert({
|
||||
-- -- confirm completion item
|
||||
-- ['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
--
|
||||
-- -- scroll documentation window
|
||||
-- ['<C-f>'] = cmp.mapping.scroll_docs(5),
|
||||
-- ['<C-u>'] = cmp.mapping.scroll_docs(-5),
|
||||
--
|
||||
-- -- toggle completion menu
|
||||
-- ['<C-e>'] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.abort()
|
||||
-- else
|
||||
-- cmp.complete()
|
||||
-- end
|
||||
-- end),
|
||||
--
|
||||
-- -- tab complete
|
||||
-- ['<Tab>'] = cmp.mapping(function(fallback)
|
||||
-- local col = vim.fn.col('.') - 1
|
||||
--
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item({ behavior = 'select' })
|
||||
-- elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||
-- fallback()
|
||||
-- else
|
||||
-- cmp.complete()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
--
|
||||
-- -- go to previous item
|
||||
-- ['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = 'select' }),
|
||||
--
|
||||
-- -- navigate to next snippet placeholder
|
||||
-- ['<C-d>'] = cmp.mapping(function(fallback)
|
||||
-- local luasnip = require('luasnip')
|
||||
--
|
||||
-- if luasnip.jumpable(1) then
|
||||
-- luasnip.jump(1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
--
|
||||
-- -- navigate to the previous snippet placeholder
|
||||
-- ['<C-b>'] = cmp.mapping(function(fallback)
|
||||
-- local luasnip = require('luasnip')
|
||||
--
|
||||
-- if luasnip.jumpable(-1) then
|
||||
-- luasnip.jump(-1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
-- }),
|
||||
-- })
|
||||
-- end
|
||||
-- }
|
||||
@@ -1,11 +0,0 @@
|
||||
return {
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
theme = 'tokyonight',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
return {
|
||||
{ -- This helps with php/html for indentation
|
||||
'captbaritone/better-indent-support-for-php-with-html',
|
||||
},
|
||||
{ -- This helps with ssh tunneling and copying to clipboard
|
||||
'ojroques/vim-oscyank',
|
||||
},
|
||||
{ -- This generates docblocks
|
||||
'kkoomen/vim-doge',
|
||||
build = ':call doge#install()'
|
||||
},
|
||||
{ -- Git plugin
|
||||
'tpope/vim-fugitive',
|
||||
},
|
||||
{ -- Show historical versions of the file locally
|
||||
'mbbill/undotree',
|
||||
},
|
||||
{ -- Show CSS Colors
|
||||
'brenoprata10/nvim-highlight-colors',
|
||||
config = function()
|
||||
require('nvim-highlight-colors').setup({})
|
||||
end
|
||||
},
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
return {
|
||||
'nvim-orgmode/orgmode',
|
||||
event = 'VeryLazy',
|
||||
ft = { 'org' },
|
||||
config = function()
|
||||
-- Setup orgmode
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = '~/orgfiles/**/*',
|
||||
org_default_notes_file = '~/orgfiles/refile.org',
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
config = function()
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup({
|
||||
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.smart_send_to_qflist + actions.open_qflist, -- send selected to quickfixlist
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, {})
|
||||
vim.keymap.set('n', '<leader>fq', builtin.quickfix, {})
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
|
||||
-- Rip grep + Fzf
|
||||
vim.keymap.set('n', '<leader>fg', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
|
||||
-- Find instance instance of current view being included
|
||||
vim.keymap.set('n', '<leader>fc', function()
|
||||
local filename_without_extension = vim.fn.expand('%:t:r')
|
||||
builtin.grep_string({ search = filename_without_extension })
|
||||
end, { desc = "Find current file: " })
|
||||
|
||||
-- Grep current string (for when gd doesn't work)
|
||||
vim.keymap.set('n', '<leader>fs', function()
|
||||
builtin.grep_string({})
|
||||
end, { desc = "Find current string: " })
|
||||
|
||||
-- find files in vim config
|
||||
vim.keymap.set('n', '<leader>fi', function()
|
||||
builtin.find_files({ cwd = "~/.config/nvim/" });
|
||||
end)
|
||||
end
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
configs.setup({
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- enable syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
-- enable indentation
|
||||
indent = { enable = true },
|
||||
-- enable autotagging (w/ nvim-ts-autotag plugin)
|
||||
autotag = { enable = true },
|
||||
-- ensure these language parsers are installed
|
||||
ensure_installed = {
|
||||
"json",
|
||||
"python",
|
||||
"ron",
|
||||
"javascript",
|
||||
"haskell",
|
||||
"query",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"rust",
|
||||
"zig",
|
||||
"php",
|
||||
"yaml",
|
||||
"html",
|
||||
"css",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"bash",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"c",
|
||||
"dockerfile",
|
||||
"gitignore",
|
||||
"astro",
|
||||
},
|
||||
-- auto install above language parsers
|
||||
auto_install = false,
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
-- Remap leaving 'terminal mode' to double tap esc
|
||||
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
|
||||
|
||||
local state = {
|
||||
floating = {
|
||||
buf = -1,
|
||||
win = -1,
|
||||
}
|
||||
}
|
||||
|
||||
local function open_floating_terminal(opts)
|
||||
opts = opts or {}
|
||||
local width = opts.width or math.floor(vim.o.columns * 0.8)
|
||||
local height = opts.height or math.floor(vim.o.lines * 0.8)
|
||||
|
||||
local row = math.floor((vim.o.lines - height) / 2)
|
||||
local col = math.floor((vim.o.columns - width) / 2)
|
||||
|
||||
local buf = nil
|
||||
if vim.api.nvim_buf_is_valid(opts.buf) then
|
||||
buf = opts.buf
|
||||
else
|
||||
buf = vim.api.nvim_create_buf(false, true)
|
||||
end
|
||||
if not buf then
|
||||
error("Failed to create buffer")
|
||||
end
|
||||
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = 'editor',
|
||||
width = width,
|
||||
height = height,
|
||||
row = row,
|
||||
col = col,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
})
|
||||
|
||||
return { buf = buf, win = win }
|
||||
end
|
||||
|
||||
local toggle_terminal = function()
|
||||
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||
state.floating = open_floating_terminal({ buf = state.floating.buf });
|
||||
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||
vim.cmd.terminal()
|
||||
vim.cmd("startinsert!")
|
||||
end
|
||||
else
|
||||
vim.api.nvim_win_hide(state.floating.win)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("Flterm", toggle_terminal, {})
|
||||
vim.api.nvim_set_keymap('n', '<leader>ft', [[:Flterm<CR>]], { noremap = true, silent = true })
|
||||
@@ -1,225 +0,0 @@
|
||||
vim.lsp.config('*', {
|
||||
root_markers = { '.git' },
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'if_many',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = '✘',
|
||||
[vim.diagnostic.severity.WARN] = '▲',
|
||||
[vim.diagnostic.severity.HINT] = '⚑',
|
||||
[vim.diagnostic.severity.INFO] = '»',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local orig = vim.lsp.util.open_floating_preview
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
opts = opts or {}
|
||||
opts.border = opts.border or 'rounded'
|
||||
opts.max_width = opts.max_width or 80
|
||||
opts.max_height = opts.max_height or 24
|
||||
opts.wrap = opts.wrap ~= false
|
||||
return orig(contents, syntax, opts, ...)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
local buf = args.buf
|
||||
local map = function(mode, lhs, rhs) vim.keymap.set(mode, lhs, rhs, { buffer = buf }) end
|
||||
|
||||
map('n', 'K', vim.lsp.buf.hover)
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
map('n', 'gD', vim.lsp.buf.declaration)
|
||||
map('n', 'gi', vim.lsp.buf.implementation)
|
||||
map('n', 'go', vim.lsp.buf.type_definition)
|
||||
map('n', 'gr', vim.lsp.buf.references)
|
||||
map('n', 'gs', vim.lsp.buf.signature_help)
|
||||
map('n', 'gl', vim.diagnostic.open_float)
|
||||
map('n', '<F2>', vim.lsp.buf.rename)
|
||||
map({ 'n', 'x' }, '<F3>', function() vim.lsp.buf.format({ async = true }) end)
|
||||
map('n', '<F4>', vim.lsp.buf.code_action)
|
||||
|
||||
local excluded_filetypes = { php = true, c = true, cpp = true }
|
||||
if not client:supports_method('textDocument/willSaveWaitUntil')
|
||||
and client:supports_method('textDocument/formatting')
|
||||
and not excluded_filetypes[vim.bo[buf].filetype]
|
||||
then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp.format', { clear = false }),
|
||||
buffer = buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities()
|
||||
vim.lsp.config['luals'] = {
|
||||
cmd = { 'lua-language-server' },
|
||||
filetypes = { 'lua' },
|
||||
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
diagnostics = { globals = { 'vim' } },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['cssls'] = {
|
||||
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
root_markers = { 'package.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
css = { validate = true },
|
||||
scss = { validate = true },
|
||||
less = { validate = true },
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['phpls'] = {
|
||||
cmd = { 'intelephense', '--stdio' },
|
||||
filetypes = { 'php' },
|
||||
root_markers = { 'composer.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
intelephense = {
|
||||
files = {
|
||||
maxSize = 5000000, -- default 5MB
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['ts_ls'] = {
|
||||
cmd = { 'typescript-language-server', '--stdio' },
|
||||
filetypes = {
|
||||
'javascript', 'javascriptreact', 'javascript.jsx',
|
||||
'typescript', 'typescriptreact', 'typescript.tsx',
|
||||
},
|
||||
root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
completions = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['zls'] = {
|
||||
cmd = { 'zls' },
|
||||
filetypes = { 'zig', 'zir' },
|
||||
root_markers = { 'zls.json', 'build.zig', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
zls = {
|
||||
enable_build_on_save = true,
|
||||
build_on_save_step = "install",
|
||||
warn_style = false,
|
||||
enable_snippets = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['nil_ls'] = {
|
||||
cmd = { 'nil' },
|
||||
filetypes = { 'nix' },
|
||||
root_markers = { 'flake.nix', 'default.nix', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['nil'] = {
|
||||
formatting = {
|
||||
command = { "alejandra" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['rust_analyzer'] = {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { 'Cargo.toml', 'rust-project.json', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = { allFeatures = true },
|
||||
formatting = {
|
||||
command = { "rustfmt" }
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- C / C++ via clangd
|
||||
vim.lsp.config['clangd'] = {
|
||||
cmd = {
|
||||
'clangd',
|
||||
'--background-index',
|
||||
'--clang-tidy',
|
||||
'--header-insertion=never',
|
||||
'--completion-style=detailed',
|
||||
'--query-driver=/nix/store/*-gcc-*/bin/gcc*,/nix/store/*-clang-*/bin/clang*,/run/current-system/sw/bin/cc*',
|
||||
},
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
|
||||
root_markers = { 'compile_commands.json', '.clangd', 'configure.ac', 'Makefile', '.git' },
|
||||
capabilities = caps,
|
||||
init_options = {
|
||||
fallbackFlags = { '-std=c23' }, -- Default to C23
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.config['jsonls'] = {
|
||||
cmd = { 'vscode-json-languageserver', '--stdio' },
|
||||
filetypes = { 'json', 'jsonc' },
|
||||
root_markers = { 'package.json', '.git', 'config.jsonc' },
|
||||
capabilities = caps,
|
||||
}
|
||||
|
||||
vim.lsp.config['hls'] = {
|
||||
cmd = { 'haskell-language-server-wrapper', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_markers = { 'stack.yaml', 'cabal.project', 'package.yaml', '*.cabal', 'hie.yaml', '.git' },
|
||||
capabilities = caps,
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = 'fourmolu',
|
||||
plugin = {
|
||||
semanticTokens = { globalOn = false }
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
h = 'c',
|
||||
},
|
||||
})
|
||||
|
||||
for name, _ in pairs(vim.lsp.config) do
|
||||
if name ~= '*' then -- Skip the wildcard config
|
||||
vim.lsp.enable(name)
|
||||
end
|
||||
end
|
||||
@@ -1,40 +0,0 @@
|
||||
local function reformat_parenthesized_content()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local row = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local line = vim.api.nvim_buf_get_lines(bufnr, row - 1, row, false)[1]
|
||||
|
||||
local inside = line:match("%((.-)%)")
|
||||
if not inside then
|
||||
vim.notify(
|
||||
"No content found inside parentheses",
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
local prefix = line:match("^(.-)%(") or ""
|
||||
local suffix = line:match("%)(.*)$") or ""
|
||||
|
||||
local parts = vim.split(inside, ",%s*")
|
||||
if #parts == 0 then
|
||||
vim.notify("No comma-separated content found", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local new_lines = {}
|
||||
table.insert(new_lines, prefix .. "(")
|
||||
for i, part in ipairs(parts) do
|
||||
if i < #parts then
|
||||
table.insert(new_lines, " " .. part .. ",")
|
||||
else
|
||||
table.insert(new_lines, " " .. part)
|
||||
end
|
||||
end
|
||||
table.insert(new_lines, " )" .. suffix)
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, row - 1, row, false, new_lines)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>qq", function()
|
||||
reformat_parenthesized_content()
|
||||
end)
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
# Manage application dotfiles using XDG Base Directory specification
|
||||
# These files are copied to the Nix store and symlinked to ~/.config/
|
||||
xdg.configFile."nvim".source = ../../config/nvim;
|
||||
xdg.configFile."qtile".source = ../../config/qtile;
|
||||
xdg.configFile."rofi".source = ../../config/rofi;
|
||||
xdg.configFile."picom".source = ../../config/picom;
|
||||
|
||||
@@ -5,5 +5,7 @@
|
||||
home.packages = with pkgs; [
|
||||
# Package management
|
||||
flatpak # Universal package manager
|
||||
pcmanfm
|
||||
google-chrome
|
||||
];
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
programs.bash.completion.enable = true;
|
||||
programs.bash.blesh.enable = true; # Bash Line Editor SHell
|
||||
|
||||
# Firefox browser
|
||||
programs.firefox.enable = true;
|
||||
|
||||
# Enable nix-ld for running unpatched binaries
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
@@ -42,11 +39,11 @@
|
||||
openssl
|
||||
|
||||
# X11 and graphics
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
xorg.libXi
|
||||
libX11
|
||||
libxext
|
||||
libXrender
|
||||
libXtst
|
||||
libXi
|
||||
libglvnd
|
||||
mesa
|
||||
|
||||
|
||||
@@ -1,14 +1,29 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
settings = {
|
||||
vim.viAlias = true;
|
||||
vim.vimAlias = false;
|
||||
vim.lsp = {
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
};
|
||||
settings = {
|
||||
vim = {
|
||||
viAlias = true;
|
||||
vimAlias = false;
|
||||
theme = {
|
||||
enable = true;
|
||||
name = "gruvbox";
|
||||
style = "dark";
|
||||
};
|
||||
languages = {
|
||||
nix.enable = true;
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
};
|
||||
statusline.lualine = {
|
||||
enable = true;
|
||||
};
|
||||
telescope.enable = true;
|
||||
autocomplete.nvim-cmp.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user