helm/home/profiles/nvim/default.nix

470 lines
14 KiB
Nix
Raw Normal View History

2022-09-18 15:13:50 -07:00
{ pkgs, ... }:
2024-08-24 03:51:29 -07:00
# let
# customPlugins = {
# vim-zettel = pkgs.vimUtils.buildVimPlugin {
# name = "vim-zettel";
# src = pkgs.fetchFromGitHub {
# owner = "michal-h21";
# repo = "vim-zettel";
# rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d";
# sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4=";
# };
# };
# };
# Thank god I don't use python anymore
# my-python-packages = python-packages: with python-packages; [
# # other python packages you want
# ];
# python-with-my-packages = pkgs.python3.withPackages my-python-packages;
# in
2022-09-18 15:13:50 -07:00
{
home.sessionVariables.EDITOR = "nvim";
home.shellAliases = {
k = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex; cd $OLDPWD";
2023-06-03 04:47:11 -07:00
# kitaab zettel
2022-09-18 15:13:50 -07:00
kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD";
2023-06-03 04:47:11 -07:00
# kitaab get by tagged
2024-03-15 23:25:49 -07:00
kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD";
2022-09-18 15:13:50 -07:00
};
2024-08-25 23:44:07 -07:00
home.file = {
# Add %update to the highlight clause for vimwiki files
# ".config/nvim/after/syntax/vimwiki.vim".text = ''
# " match with %update
# syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
# " match with %link
# syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
# '';
".config/nvim".source = ./config;
};
2022-09-18 15:13:50 -07:00
#environment.systemPackages = with customPlugins; [ tidal ];
programs.neovim = {
enable = true;
# extraConfig = ''
# filetype plugin on
# set shortmess+=c
# " always show signcolumns
# " Pasting
# :map <leader>sy :!xclip -i<CR><CR>
# :vmap <leader>sy "*y
# :map <leader>sp :r!xclip -o<CR>
# " lua config
# lua <<EOF
# local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
# function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
# opts = opts or {}
# opts.border = opts.border or 'rounded'
# return orig_util_open_floating_preview(contents, syntax, opts, ...)
# end
# -- autopairs
# require('nvim-autopairs').setup{}
# -- marks
# require('marks').setup{}
# -- Setup nvim-cmp.
# local luasnip = require("luasnip")
# local lspkind = require("lspkind")
# local t = function(str)
# return vim.api.nvim_replace_termcodes(str, true, true, true)
# end
# local check_back_space = function()
# local col = vim.fn.col(".") - 1
# return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil
# end
# -- null-ls
# -- being very janky
# local null_ls = require("null-ls")
# null_ls.setup({
# sources = {
# null_ls.builtins.diagnostics.shellcheck,
# null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }),
# null_ls.builtins.diagnostics.commitlint,
# null_ls.builtins.diagnostics.jsonlint,
# -- null_ls.builtins.code_actions.statix,
# -- null_ls.builtins.diagnostics.clj_kondo,
# -- null_ls.builtins.formatting.isort,
# -- null_ls.builtins.formatting.black,
# },
# })
# -- Setup lspconfig
# require("lsp-format").setup {}
# require("nvim-navic").setup {}
# local format = require("lsp-format")
# local navic = require("nvim-navic")
# -- lspsaga, code_action lightbulb is annoying
# local saga = require('lspsaga')
# saga.init_lsp_saga({
# border_style = "rounded",
# code_action_icon = "",
# code_action_num_shortcut = true,
# code_action_lightbulb = {
# enable = false,
# enable_in_insert = false,
# cache_code_action = true,
# sign = true,
# update_time = 150,
# sign_priority = 20,
# virtual_text = false,
# },
# code_action_keys = {
# quit = 'q',
# exec = '<CR>',
# },
# -- show outline
# show_outline = {
# win_position = 'right',
# --set special filetype win that outline window split.like NvimTree neotree
# -- defx, db_ui
# auto_enter = true,
# auto_preview = true,
# virt_text = '┃',
# jump_key = 'o',
# -- auto refresh when change buffer
# auto_refresh = true,
# },
# })
# -- fennel-ls is bleeding edge
# local lspconfig = require('lspconfig')
# require("lspconfig.configs")["fennel-ls"] = {
# default_config = {
# cmd = {"fennel-ls"},
# filetypes = {"fennel"},
# root_dir = function(dir) return lspconfig.util.find_git_ancestor(dir) end,
# settings = {}
# }
# }
# -- fennel-ls doesn't support gps
# lspconfig['fennel-ls'].setup {
# on_attach = function(client, bufnr)
# format.on_attach(client)
# end,
# capabilities = capabilities,
# }
# -- deprecated pylsp
# -- require('lspconfig').pylsp.setup {
# -- on_attach = function(client, bufnr)
# -- format.on_attach(client)
# -- navic.attach(client, bufnr)
# -- end,
# -- capabilities = capabilities,
# -- settings = {
# -- pylsp = {
# -- configurationSources = { "flake8", "mypy", "black" },
# -- plugins = {
# -- black = {enabled = true},
# -- jedi_signature_help = {enabled = true},
# -- jedi_completion = { include_params = true },
# -- pylsp_mypy={ enabled = true },
# -- pycodestyle={
# -- enabled=true,
# -- ignore={'E501', 'E231'},
# -- maxLineLength=120,
# -- },
# -- },
# -- },
# -- },
# -- }
# require('gitsigns').setup { sign_priority=80 }
# -- treesitter
# require('nvim-treesitter.configs').setup {
# -- parser_install_dir = "~/.local/share/nvim/site/parser/",
# -- ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css', 'regex', 'supercollider', 'beancount', 'janet'},
# highlight = { enabled = true, additional_vim_regex_highting = true, },
# textobjects = { enabled = true },
# }
# -- 'glsl' needs c++ compiler lol
# -- lualine
# local navic = require("nvim-navic")
# require('lualine').setup {
# options = { theme = 'ayu' },
# sections = {
# lualine_c = {
# 'filename', { navic.get_location, condition=navic.is_available },
# },
# lualine_y = {
# function()
# local msg = 'No Active Lsp'
# local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
# local clients = vim.lsp.get_active_clients()
# if next(clients) == nil then
# return msg
# end
# for _, client in ipairs(clients) do
# local filetypes = client.config.filetypes
# if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
# return client.name
# end
# end
# return msg
# end
# },
# lualine_x = {'filetype'}
# }
# }
# -- nvim-lint
# -- require('lint').linters_by_ft = {
# -- markdown = {'vale'},
# -- }
# -- Custom functions
# function update_date()
# local time = os.date("%Y-%m-%d %H:%M")
# local message = "%update " .. time
# local lines = vim.api.nvim_buf_get_lines(0, 0,4,false)
# for i=1,4,1 do
# if (lines[i]:len() == 0) then
# vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""})
# return
# end
# end
# if (lines[4]:len() ~= 0) then
# vim.api.nvim_buf_set_lines(0, 3, 4, false, {message})
# end
# return
# end
# vim.api.nvim_create_autocmd(
# "BufWritePre",
# { pattern = { "*.wiki" }, callback = update_date}
# )
# -- set spelling for text files
# vim.api.nvim_create_autocmd(
# { "BufRead", "BufNewFile" },
# { pattern = { "*.wiki", "*.txt", "*.md", "*.tex" },
# command = "setlocal spell" }
# )
# vim.api.nvim_create_autocmd(
# "FileType",
# { pattern = { "mail" },
# command = "setlocal spell" }
# )
# -- auto session
# require('auto-session').setup {
# log_level = 'info',
# auto_session_suppress_dirs = {'~/'}
# }
# vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal"
# require("which-key").setup{}
# require('leap').set_default_keymaps()
#
# -- supercollider
# local scnvim = require 'scnvim'
# local map = scnvim.map
# local map_expr = scnvim.map_expr
# scnvim.setup {
# keymaps = {
# ['<localleader>e'] = map('editor.send_line', {'i', 'n'}),
# ['<localleader>s'] = map_expr('CmdPeriod.run', {'i', 'n'}),
# ['<localleader>t'] = {
# map('editor.send_block', {'i', 'n'}),
# map('editor.send_selection', 'x'),
# },
# ['<CR>'] = map('postwin.toggle'),
# ['<M-CR>'] = map('postwin.toggle', 'i'),
# ['<M-L>'] = map('postwin.clear', {'n', 'i'}),
# ['<C-k>'] = map('signature.show', {'n', 'i'}),
# ['<F12>'] = map('sclang.hard_stop', {'n', 'x', 'i'}),
# ['<leader>st'] = map('sclang.start'),
# ['<leader>sk'] = map('sclang.recompile'),
# ['<F1>'] = map_expr('s.boot'),
# ['<F2>'] = map_expr('s.meter'),
# }
# }
# -- You gotta run :SCNvimGenerateAssets for this first
# -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets())
# -- zen mode
# require('zen-mode').setup{
# window = {
# backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
# -- height and width can be:
# -- * an absolute number of cells when > 1
# -- * a percentage of the width / height of the editor when <= 1
# -- * a function that returns the width or the height
# width = 120, -- width of the Zen window
# height = 1, -- height of the Zen window
# -- by default, no options are changed for the Zen window
# -- uncomment any of the options below, or add other vim.wo options you want to apply
# options = {
# signcolumn = "no", -- disable signcolumn
# number = false, -- disable number column
# relativenumber = false, -- disable relative numbers
# cursorline = false, -- disable cursorline
# cursorcolumn = false, -- disable cursor column
# foldcolumn = "0", -- disable fold column
# list = false, -- disable whitespace characters
# },
# },
# plugins = {
# -- disable some global vim options (vim.o...)
# -- comment the lines to not apply the options
# options = {
# enabled = true,
# ruler = false, -- disables the ruler text in the cmd line area
# showcmd = false, -- disables the command in the last line of the screen
# },
# twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
# gitsigns = { enabled = false }, -- disables git signs
# tmux = { enabled = false }, -- disables the tmux statusline
# -- this will change the font size on kitty when in zen mode
# -- to make this work, you need to set the following kitty options:
# -- - allow_remote_control socket-only
# -- - listen_on unix:/tmp/kitty
# kitty = {
# enabled = true,
# font = "+2", -- font size increment
# },
# },
# }
# require('twilight').setup{}
# -- hologram
# require('hologram').setup{
# auto_display = false -- WIP automatic markdown image display, may be prone to breaking
# }
# EOF
# '';
2024-08-24 03:51:29 -07:00
extraPackages = with pkgs; [
2022-09-18 15:13:50 -07:00
# used to compile tree-sitter grammar
2024-08-24 03:51:29 -07:00
# python-with-my-packages
2022-09-18 15:13:50 -07:00
nodejs
clojure-lsp
2022-12-19 21:50:16 -08:00
clojure
2022-09-18 15:13:50 -07:00
clj-kondo
2024-08-24 03:51:29 -07:00
terraform-lsp
2024-07-14 20:21:20 -07:00
gopls
2022-09-18 15:13:50 -07:00
gcc
shellcheck
proselint
statix
nodePackages.typescript
nodePackages.typescript-language-server
2023-08-16 23:36:51 -07:00
luajitPackages.lua-lsp
2022-12-30 04:36:20 -08:00
fennel-ls
# starpls-bin # TODO find this!!
2022-09-18 15:13:50 -07:00
];
2024-08-24 03:51:29 -07:00
plugins = with pkgs.vimPlugins; [
#hotpot
hotpot-nvim
2022-09-18 15:13:50 -07:00
# ui
2022-12-06 20:38:29 -08:00
lualine-nvim
neo-tree-nvim
2022-09-18 15:13:50 -07:00
fzf-vim
vim-devicons
nvim-web-devicons
telescope-nvim
plenary-nvim
2022-12-19 21:50:16 -08:00
nvim-navic
FTerm-nvim
2022-09-18 15:13:50 -07:00
barbar-nvim
2024-08-24 03:51:29 -07:00
# TODO
# neotree
neovim-ayu
rainbow_parentheses-vim
vim-surround
undotree
(nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown p.glsl p.yaml p.toml p.dockerfile p.json ]))
nvim-treesitter-context
2022-09-18 15:13:50 -07:00
auto-session
2022-12-06 20:38:29 -08:00
which-key-nvim
2022-12-15 02:29:42 -08:00
zen-mode-nvim
twilight-nvim
2024-08-24 03:51:29 -07:00
# TODO remove?
2022-12-21 03:43:00 -08:00
vim-dasht
2022-09-18 15:13:50 -07:00
# language
vim-nix
emmet-vim
csv-vim
direnv-vim
2022-12-06 20:38:29 -08:00
conjure
2022-09-18 15:13:50 -07:00
# kitaab stuff
vimwiki
vim-zettel
2022-12-21 03:43:00 -08:00
hologram-nvim
2022-09-18 15:13:50 -07:00
# lsp stuff
# nvim-lint
null-ls-nvim
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
cmp-treesitter
nvim-lsp-ts-utils
lspsaga-nvim
2022-09-18 15:13:50 -07:00
cmp-conjure
cmp-buffer
cmp-path
cmp-spell
nvim-autopairs
cmp_luasnip
luasnip
lsp-format-nvim
2022-09-18 15:13:50 -07:00
friendly-snippets
lspkind-nvim
# git stuff
vim-fugitive
2022-12-15 02:29:42 -08:00
gitsigns-nvim
2022-09-18 15:13:50 -07:00
fzf-checkout-vim
# Clojure stuff
# conjure
vim-sexp
vim-sexp-mappings-for-regular-people
fennel-vim
vim-tidal
# experimental
nvim-luapad
scnvim
leap-nvim
vim-beancount
# vimtex
2022-12-06 20:38:29 -08:00
# custom
# nvim-parinfer
2022-09-18 15:13:50 -07:00
# vim-processing
];
2024-08-24 03:51:29 -07:00
# withPython3 = true;
# extraPython3Packages = pkgs: with pkgs; [ tasklib six ];
# vimAlias = true;
2022-09-18 15:13:50 -07:00
};
}