Squashed commit of the following:
commit eb451fe1a7324b35621921cd232480d0fbbec34b Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 15:40:15 2023 +0300 nvim bash commit fe31d8e972e5729715f2f9a70e8226f35759dc9a Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 15:35:16 2023 +0300 nvim nix commit af96dff98e80c54eabff9d219119950993878e27 Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 15:25:03 2023 +0300 some js cleanup commit ffee7d74c9c7c06f879afa8542c4f55492566bb7 Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 15:20:41 2023 +0300 nvim lua commit 9607813c11893b96070cb056d03eda6b821f9282 Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 15:11:20 2023 +0300 server capabilities check for doc highlight commit d889f14fb93c35f4d5a4d9e9430a5770d080ef96 Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 14:29:47 2023 +0300 adding servers commit e91f8f81b6c2ccc35926cac13e71da1a8997b98a Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 13:42:26 2023 +0300 lists commit 9239ed57fe73dcde7c11547d211ebec1e8d3078f Author: Ivan Dimitrov <ivan@idimitrov.dev> Date: Thu Oct 5 13:39:10 2023 +0300 neovim split
This commit is contained in:
parent
84937681db
commit
f5e1e3cb5b
22
home/laptop/programs/neovim/bash.nix
Normal file
22
home/laptop/programs/neovim/bash.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [
|
||||
bash
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
extraPackages = with pkgs; [
|
||||
nodePackages_latest.bash-language-server
|
||||
shfmt
|
||||
shellcheck
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; grammars ++ [
|
||||
];
|
||||
extraLuaConfig = ''
|
||||
addServers({
|
||||
bashls = {}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,65 +1,48 @@
|
||||
{ pkgs, lib, ... }: {
|
||||
{ pkgs, lib, ... }:
|
||||
let grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [
|
||||
diff
|
||||
regex
|
||||
vimdoc
|
||||
comment
|
||||
markdown
|
||||
ungrammar
|
||||
gitignore
|
||||
gitcommit
|
||||
git_rebase
|
||||
git_config
|
||||
gitattributes
|
||||
dockerfile
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [ ./bash.nix ./nix.nix ./lua.nix ./js.nix ./util.nix ];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
extraPackages = with pkgs; [
|
||||
# nix
|
||||
rnix-lsp
|
||||
alejandra
|
||||
# go
|
||||
go
|
||||
gopls
|
||||
# c/c++
|
||||
libclang
|
||||
# lua
|
||||
lua
|
||||
lua-language-server
|
||||
stylua
|
||||
# js/ts
|
||||
nodePackages_latest.prettier
|
||||
nodePackages_latest.typescript
|
||||
nodePackages_latest.typescript-language-server
|
||||
nodePackages_latest."@tailwindcss/language-server"
|
||||
nodePackages_latest."@prisma/language-server"
|
||||
# bash
|
||||
nodePackages_latest.bash-language-server
|
||||
shfmt
|
||||
shellcheck
|
||||
# python
|
||||
python311Packages.python-lsp-black
|
||||
python311Packages.python-lsp-server
|
||||
black
|
||||
# haskell
|
||||
ghc
|
||||
haskell-language-server
|
||||
# neovim
|
||||
ripgrep
|
||||
# html
|
||||
nodePackages_latest.vscode-html-languageserver-bin
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
plugins = with pkgs.vimPlugins; grammars ++ [
|
||||
nvim-treesitter
|
||||
nvim-surround
|
||||
nvim-ts-autotag
|
||||
vim-prisma
|
||||
autoclose-nvim
|
||||
barbar-nvim
|
||||
cmp-nvim-lsp
|
||||
comment-nvim
|
||||
gitsigns-nvim
|
||||
luasnip
|
||||
#nightfox-nvim
|
||||
catppuccin-nvim
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-web-devicons
|
||||
plenary-nvim
|
||||
telescope-nvim
|
||||
telescope-nvim
|
||||
toggleterm-nvim
|
||||
vim-vinegar
|
||||
lualine-nvim
|
||||
];
|
||||
extraLuaConfig = lib.fileContents ./nvim/init.lua;
|
||||
extraLuaConfig = lib.fileContents ./nvim/default.lua;
|
||||
};
|
||||
}
|
||||
|
43
home/laptop/programs/neovim/js.nix
Normal file
43
home/laptop/programs/neovim/js.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [
|
||||
tsx
|
||||
jsdoc
|
||||
json
|
||||
json5
|
||||
jsonnet
|
||||
http
|
||||
html
|
||||
astro
|
||||
svelte
|
||||
prisma
|
||||
graphql
|
||||
typescript
|
||||
javascript
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
extraPackages = with pkgs; [
|
||||
nodePackages_latest.prettier
|
||||
nodePackages_latest.typescript
|
||||
nodePackages_latest.typescript-language-server
|
||||
nodePackages_latest."@tailwindcss/language-server"
|
||||
nodePackages_latest."@prisma/language-server"
|
||||
nodePackages_latest.vscode-html-languageserver-bin
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; grammars ++ [
|
||||
vim-prisma
|
||||
];
|
||||
extraLuaConfig = ''
|
||||
addServers({
|
||||
tsserver = {},
|
||||
tailwindcss = {},
|
||||
prismals = {},
|
||||
html = {
|
||||
cmd = { "html-languageserver", "--stdio" }
|
||||
},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
25
home/laptop/programs/neovim/lua.nix
Normal file
25
home/laptop/programs/neovim/lua.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [
|
||||
lua
|
||||
luadoc
|
||||
luau
|
||||
luap
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
extraPackages = with pkgs; [
|
||||
lua
|
||||
lua-language-server
|
||||
stylua
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; grammars ++ [
|
||||
];
|
||||
extraLuaConfig = ''
|
||||
addServers({
|
||||
lua_ls = {}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
21
home/laptop/programs/neovim/nix.nix
Normal file
21
home/laptop/programs/neovim/nix.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [
|
||||
nix
|
||||
];
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
extraPackages = with pkgs; [
|
||||
rnix-lsp
|
||||
alejandra
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; grammars ++ [
|
||||
];
|
||||
extraLuaConfig = ''
|
||||
addServers({
|
||||
rnix = {}
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
-- START GLOBAL CONFIG
|
||||
vim.wo.number = true -- show numbers
|
||||
vim.o.scrolloff = 15 -- scrll if n lines left
|
||||
vim.o.hlsearch = false -- highlight search
|
||||
vim.wo.number = true
|
||||
vim.o.scrolloff = 15
|
||||
vim.o.hlsearch = false
|
||||
vim.o.updatetime = 20
|
||||
vim.o.autoread = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = true
|
||||
|
||||
vim.g.mapleader = " " -- leader space
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true }) -- nop leader
|
||||
|
||||
@ -36,36 +35,10 @@ nmap("<leader>r", "<cmd>!%:p<cr>")
|
||||
|
||||
nmap("<leader>ff", require("telescope.builtin").find_files)
|
||||
nmap("<leader>fw", require("telescope.builtin").live_grep)
|
||||
|
||||
nmap("<leader>e", vim.diagnostic.open_float)
|
||||
|
||||
-- END GLOBAL CONFIG
|
||||
|
||||
-- START LSP
|
||||
|
||||
local highlight_filetypes = { "*.ts", "*.tsx", "*.js", "*.jsx", "*.html", "*.lua", "*.hs" }
|
||||
local cmp = require("cmp")
|
||||
local lspconfig = require("lspconfig")
|
||||
local servers = {
|
||||
tsserver = {
|
||||
settings = {
|
||||
completions = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
pylsp = {},
|
||||
lua_ls = {},
|
||||
rnix = {},
|
||||
gopls = {},
|
||||
tailwindcss = {},
|
||||
prismals = {},
|
||||
hls = {},
|
||||
bashls = {},
|
||||
html = {
|
||||
cmd = { "html-languageserver", "--stdio" }
|
||||
},
|
||||
}
|
||||
local cmp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local on_attach = function(client, bufnr)
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action)
|
||||
@ -76,18 +49,18 @@ local on_attach = function(client, bufnr)
|
||||
end)
|
||||
nmap("K", vim.lsp.buf.hover)
|
||||
nmap("gr", require("telescope.builtin").lsp_references)
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
callback = function()
|
||||
vim.lsp.buf.document_highlight()
|
||||
end,
|
||||
pattern = highlight_filetypes
|
||||
})
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
callback = function()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
pattern = highlight_filetypes
|
||||
})
|
||||
end
|
||||
end
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
@ -111,7 +84,6 @@ for server, cfg in pairs(servers) do
|
||||
})
|
||||
end
|
||||
|
||||
-- END LSP
|
||||
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
autotag = {
|
27
home/laptop/programs/neovim/nvim/util.lua
Normal file
27
home/laptop/programs/neovim/nvim/util.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local servers = {}
|
||||
|
||||
local addServers = function(srv)
|
||||
servers = vim.tbl_deep_extend("force", servers, srv)
|
||||
end
|
||||
|
||||
local function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k, v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"' .. k .. '"' end
|
||||
s = s .. '[' .. k .. '] = ' .. dump(v) .. ','
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
local function log(o)
|
||||
local file = io.open("./.nvim.log", "a+")
|
||||
if file then
|
||||
file:write(os.date("%Y/%m/%d %H:%M:%S") .. " || " .. dump(o) .. "\n")
|
||||
file:write("---\n")
|
||||
file:close()
|
||||
end
|
||||
end
|
6
home/laptop/programs/neovim/util.nix
Normal file
6
home/laptop/programs/neovim/util.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.neovim = {
|
||||
extraLuaConfig = lib.fileContents ./nvim/util.lua;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user