got a bunch of shit fixed

This commit is contained in:
Anish Lakhwara
2025-09-12 00:29:37 -07:00
parent 4049df5724
commit 01c65f54af
21 changed files with 383 additions and 201 deletions
+179 -83
View File
@@ -10,15 +10,7 @@ let
sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4=";
};
};
lsp-format = pkgs.vimUtils.buildVimPlugin {
name = "lsp-format";
src = pkgs.fetchFromGitHub {
owner = "lukas-reineke";
repo = "lsp-format.nvim";
rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff";
sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4=";
};
};
my-lspsaga = pkgs.vimUtils.buildVimPlugin {
name = "lspsaga.nvim";
src = pkgs.fetchFromGitHub {
@@ -66,16 +58,6 @@ let
};
meta.homepage = "https://github.com/folke/which-key.nvim/";
};
scnvim = pkgs.vimUtils.buildVimPlugin {
pname = "scnvim";
version = "2022-06-04";
src = pkgs.fetchFromGitHub {
owner = "davidgranstrom";
repo = "scnvim";
rev = "746cc0db820d02a9c36b8f9ba2eac9725fa73107";
sha256 = "kvSwS6FNUY2Ue84NhWLLcm0ldLMSp4WqQ7s6TUoX6Cc=";
};
};
yuck-vim = pkgs.vimUtils.buildVimPlugin {
pname = "yuck.vim";
version = "2021-08-09";
@@ -132,11 +114,6 @@ let
tasklib
pynvim
six
pylsp-mypy
#pyls-isort
#pyls-black
black
isort
# other python packages you want
];
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
@@ -205,7 +182,7 @@ in
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
set cmdheight=0
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
@@ -214,6 +191,7 @@ in
set signcolumn=yes
" highlight row
set cursorline
set autoread
let mapleader = "\<Space>"
let maplocalleader = ","
@@ -228,19 +206,7 @@ in
nmap <leader>rt :retab!<CR>
vmap <leader>rt :retab!<CR>
" moving splits with vim movements.
:tnoremap <A-h> <C-\><C-N><C-w>h
:tnoremap <A-j> <C-\><C-N><C-w>j
:tnoremap <A-k> <C-\><C-N><C-w>k
:tnoremap <A-l> <C-\><C-N><C-w>l
:inoremap <A-h> <C-\><C-N><C-w>h
:inoremap <A-j> <C-\><C-N><C-w>j
:inoremap <A-k> <C-\><C-N><C-w>k
:inoremap <A-l> <C-\><C-N><C-w>l
:nnoremap <A-h> <leader>h
:nnoremap <A-j> <leader>j
:nnoremap <A-k> <leader>k
:nnoremap <A-l> <leader>l
" Alt+hjkl navigation now handled by Navigator.nvim plugin
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M")<CR>
:inoremap <F4> <C-R>=strftime("%H:%M")<CR>
@@ -278,11 +244,11 @@ in
autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll
" general commands
map <leader>t :NERDTreeToggle<CR>
map <leader>e :Neotree toggle<CR>
map <leader>s :w<CR>
map <leader>q :q<CR>
map <leader>r :RainbowParenthesesToggleAll<CR>
nnoremap <BS> :noh<CR>
nnoremap <Esc> :noh<CR>
map Q <Nop>
nnoremap Y y$
nnoremap <leader>n :vnew<CR>
@@ -313,11 +279,11 @@ in
:vmap <leader>sy "*y
:map <leader>sp :r!xclip -o<CR>
" barbar
nnoremap <silent> gT :BufferPrevious<CR>
nnoremap <silent> gt :BufferNext<CR>
nnoremap <silent> gj :BufferPick<CR>
nnoremap <silent> gq :BufferClose<CR>
" buffer navigation (using built-in commands)
nnoremap <silent> gT :bprevious<CR>
nnoremap <silent> gt :bnext<CR>
nnoremap <silent> gj :buffers<CR>
nnoremap <silent> gq :bdelete<CR>
" git
nnoremap <leader>ga :G fetch --all
@@ -332,7 +298,7 @@ in
" kitaab
"map <leader>cz :VimwikiIndex<CR>:ZettelNew
"map <leader>zs :ZettelSearch<CR>
"map <leader>zn :ZettelNew<CR>
map <leader>zn :ZettelNew<CR>
"map <leader>zo :ZettelOpen<CR>
"map <leader>zf :Telescope oldfiles only_cwd=true<CR>
"map <leader>wt :VimwikiMakeTomorrowDiaryNote
@@ -368,7 +334,22 @@ in
nnoremap <leader>vsd :Lspsaga show_line_diagnostics<CR>
nnoremap <leader>vs :Dasht<Space>
nnoremap <leader>vn :Lspsaga diagnostic_jump_prev<CR>
nnoremap <leader>vo :LSoutlineToggle<CR>
nnoremap <leader>co :Outline<CR>
" Trouble keybindings
nnoremap <leader>xx :Trouble diagnostics<CR>
nnoremap <leader>xw :Trouble workspace_diagnostics<CR>
nnoremap <leader>xd :Trouble document_diagnostics<CR>
nnoremap <leader>xl :Trouble loclist<CR>
nnoremap <leader>xq :Trouble quickfix<CR>
nnoremap <leader>xr :Trouble lsp_references<CR>
" Yank to system clipboard (y operations only, not d)
nnoremap y "+y
vnoremap y "+y
nnoremap Y "+Y
" Note-taking keybindings
nnoremap <leader>zz :ZkNew { title = vim.fn.input('Title: ') }<CR>
" dashboard
let g:dashboard_custom_header = [
@@ -427,7 +408,7 @@ in
" lua config
lua <<EOF
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
local signs = { Error = " ", Warn = " ", Hint = "💡", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
@@ -487,7 +468,7 @@ in
vim.api.nvim_set_keymap('n', '<leader>vt', ':call v:lua.toggle_diagnostics()<CR>', {noremap = true, silent = true})
-- autopairs
require('nvim-autopairs').setup{}
@@ -567,27 +548,109 @@ in
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } }))
require("luasnip.loaders.from_vscode").lazy_load()
-- 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,
-- lsp-format removed, using conform.nvim instead
require("nvim-navic").setup {
icons = {
Constant = "π ",
Function = "ƒ "
}
}
-- Setup neo-tree
require("neo-tree").setup {}
-- Setup outline
require("outline").setup {}
-- Setup trouble
require("trouble").setup {}
-- Setup noice for floating command palette and notifications
require("noice").setup({
cmdline = {
enabled = true,
view = "cmdline_popup",
},
messages = {
enabled = true,
},
popupmenu = {
enabled = true,
},
notify = {
enabled = true,
view = "notify",
},
lsp = {
progress = {
enabled = true,
format = "lsp_progress",
format_done = "lsp_progress_done",
throttle = 1000 / 30, -- frequency to update lsp progress message
view = "mini",
},
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
presets = {
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = false,
},
views = {
cmdline_popup = {
border = {
style = "rounded",
padding = { 0, 1 },
},
filter_options = {},
win_options = {
winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder",
},
},
},
})
-- Setup lspconfig
require("lsp-format").setup {}
require("nvim-navic").setup {}
local format = require("lsp-format")
-- Setup barbar (tabline with icons)
require'barbar'.setup {
icons = {
filetype = {
enabled = true,
},
},
}
local navic = require("nvim-navic")
-- Setup conform.nvim for formatting
require("conform").setup({
formatters_by_ft = {
javascript = { "prettier", "lsp" },
typescript = { "prettier", "lsp" },
javascriptreact = { "prettier", "lsp" },
typescriptreact = { "prettier", "lsp" },
json = { "prettier", "lsp" },
html = { "prettier", "lsp" },
css = { "prettier", "lsp" },
yaml = { "prettier", "lsp" },
rust = { "lsp" },
go = { "lsp" },
lua = { "lsp" },
nix = { "nixfmt-rfc-style" },
clojure = { "lsp" },
fennel = { "lsp" },
terraform = { "lsp" },
bash = { "shfmt" },
sh = { "shfmt" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
-- lspsaga, code_action lightbulb is annoying
local saga = require('lspsaga')
@@ -635,21 +698,20 @@ in
}
}
local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'}
local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'ts_ls', 'lua_ls', 'nil_ls', 'gopls', 'bashls'}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = function(client, bufnr)
format.on_attach(client)
navic.attach(client, bufnr)
end,
capabilities = capabilities,
}
end
-- fennel-ls doesn't support gps
-- fennel-ls doesn't support navic
lspconfig['fennel-ls'].setup {
on_attach = function(client, bufnr)
format.on_attach(client)
-- fennel-ls setup without navic
end,
capabilities = capabilities,
}
@@ -702,7 +764,7 @@ in
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
local clients = vim.lsp.get_clients()
if next(clients) == nil then
return msg
end
@@ -728,7 +790,7 @@ in
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
map('n', '<TAB>', '<CMD>lua require("FTerm").toggle()<CR>', opts)
map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
map('t', '<TAB>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
-- Custom functions
function update_date()
@@ -765,11 +827,17 @@ in
)
-- auto session
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
require('auto-session').setup {
log_level = 'info',
auto_session_suppress_dirs = {'~/'}
log_level = 'error',
auto_session_suppress_dirs = {'~/', '/tmp', '/'},
auto_session_enable_last_session = false,
auto_session_root_dir = vim.fn.stdpath('data').."/sessions/",
auto_session_enabled = true,
auto_save_enabled = nil,
auto_restore_enabled = nil,
auto_session_create_enabled = nil,
}
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal"
require("which-key").setup{}
require('leap').set_default_keymaps()
@@ -802,7 +870,7 @@ in
-- zk
require("zk").setup()
vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
-- vim.api.nvim_set_keymap("n", "<leader>zn", "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>", opts)
-- Open notes.
vim.api.nvim_set_keymap("n", "<leader>zo", "<Cmd>ZkNotes { sort = { 'modified' } }<CR>", opts)
@@ -818,9 +886,9 @@ in
-- Create a new note after asking for its title.
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for title.
map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
-- map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
map("v", "<leader>znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
@@ -886,6 +954,27 @@ in
auto_display = false -- WIP automatic markdown image display, may be prone to breaking
}
-- Setup Navigator.nvim
require('Navigator').setup {
disable_on_zoom = true,
mux = 'auto', -- auto-detect tmux
}
-- Set up Navigator.nvim keybindings
vim.keymap.set({'n', 't'}, '<M-h>', '<CMD>NavigatorLeft<CR>')
vim.keymap.set({'n', 't'}, '<M-j>', '<CMD>NavigatorDown<CR>')
vim.keymap.set({'n', 't'}, '<M-k>', '<CMD>NavigatorUp<CR>')
vim.keymap.set({'n', 't'}, '<M-l>', '<CMD>NavigatorRight<CR>')
-- Disable Ctrl+V in nvim so Kitty can handle paste
vim.keymap.set({'n', 'v', 'i'}, '<C-v>', '<Nop>', {noremap = true, silent = true})
-- Pane resizing with Alt+Shift+hjkl (to match tmux)
vim.keymap.set('n', '<M-S-h>', '<Cmd>vertical resize -2<CR>', {silent = true})
vim.keymap.set('n', '<M-S-j>', '<Cmd>resize -2<CR>', {silent = true})
vim.keymap.set('n', '<M-S-k>', '<Cmd>resize +2<CR>', {silent = true})
vim.keymap.set('n', '<M-S-l>', '<Cmd>vertical resize +2<CR>', {silent = true})
EOF
'';
@@ -908,8 +997,11 @@ in
statix
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.bash-language-server
luajitPackages.lua-lsp
fennel-ls
nixfmt-rfc-style
shfmt
zk
];
@@ -917,7 +1009,11 @@ in
# ui
lualine-nvim
fzf-vim
nerdtree
neo-tree-nvim
outline-nvim
noice-nvim
nui-nvim
trouble-nvim
neovim-ayu
rainbow_parentheses-vim
vim-surround
@@ -958,7 +1054,6 @@ in
# lsp stuff
# nvim-lint
null-ls-nvim
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
@@ -971,7 +1066,7 @@ in
nvim-autopairs
cmp_luasnip
luasnip
lsp-format
conform-nvim
friendly-snippets
lspkind-nvim
@@ -991,6 +1086,7 @@ in
nvim-luapad
scnvim
leap
Navigator-nvim
vim-beancount
# vimtex
# custom
@@ -999,7 +1095,7 @@ in
# vim-processing
];
withPython3 = true;
extraPython3Packages = pkgs: with pkgs; [ tasklib six ];
extraPython3Packages = pkgs: with pkgs; [ tasklib six packaging ];
vimAlias = true;
};
}