diff options
| author | coast <coasteen@proton.me> | 2026-10-15 04:35:38 +0330 |
|---|---|---|
| committer | coast <coasteen@proton.me> | 2026-10-15 04:35:38 +0330 |
| commit | 57331238c20775916068580aff7d46968c45d575 (patch) | |
| tree | 7450c990e796de8402f648a6cf1f3423e0469fca /nvim | |
| parent | 8c5c2d270fd0f3bbc276e3b1cc28fc1dfae3fa59 (diff) | |
| download | coast-newdot-master.tar.gz coast-newdot-master.tar.bz2 coast-newdot-master.tar.xz coast-newdot-master.tar.zst | |
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/after/plugin/netrw_tree_fix.lua | 58 | ||||
| -rwxr-xr-x | nvim/init.lua | 6 | ||||
| -rwxr-xr-x | nvim/lazy-lock.json | 38 | ||||
| -rwxr-xr-x | nvim/lua/config.lua | 26 | ||||
| -rwxr-xr-x | nvim/lua/plugins/catppuccin/init.lua | 21 | ||||
| -rwxr-xr-x | nvim/lua/plugins/lazy/plugins.lua | 38 | ||||
| -rwxr-xr-x | nvim/lua/plugins/lsp/init.lua | 82 |
7 files changed, 185 insertions, 84 deletions
diff --git a/nvim/after/plugin/netrw_tree_fix.lua b/nvim/after/plugin/netrw_tree_fix.lua new file mode 100644 index 0000000..af2030e --- /dev/null +++ b/nvim/after/plugin/netrw_tree_fix.lua @@ -0,0 +1,58 @@ +local orig = {} + +local function parse(line) + local prefix, name = line:match('^([| ]*)(.-)%s*$') + local _, depth = prefix:gsub('|', '') + return depth, name +end + +local function open_entry() + local buf = vim.api.nvim_get_current_buf() + local lnum = vim.fn.line('.') + local depth, name = parse(vim.fn.getline(lnum)) + + local function fallback() + local rhs = orig[buf] and orig[buf].rhs + if rhs and rhs ~= '' then + vim.api.nvim_feedkeys(vim.keycode(rhs), 'n', false) + end + end + + if name == '' or name:sub(-1) == '/' or depth == 0 then + return fallback() + end + + local parts, cur, top = {}, depth, nil + for l = lnum - 1, 1, -1 do + local d, n = parse(vim.fn.getline(l)) + if n ~= '' and d < cur and n:sub(-1) == '/' then + if d == 0 then + top = n + break + end + table.insert(parts, 1, n) + cur = d + end + end + + if not top or not top:match('^%a+://') then + return fallback() + end + + vim.cmd('edit ' .. vim.fn.fnameescape(top .. table.concat(parts) .. name)) +end + +local function install(buf) + local m = vim.fn.maparg('<CR>', 'n', false, true) + if m.callback then return end + orig[buf] = m + vim.keymap.set('n', '<CR>', open_entry, { buffer = buf, silent = true }) +end + +vim.api.nvim_create_autocmd({ 'BufEnter', 'CursorMoved' }, { + callback = function(a) + if vim.bo[a.buf].filetype == 'netrw' and vim.g.netrw_liststyle == 3 then + install(a.buf) + end + end, +}) diff --git a/nvim/init.lua b/nvim/init.lua index 55d1321..144a842 100755 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -9,9 +9,3 @@ require("plugins/render-markdown") require("plugins/lualine") require("plugins/catppuccin") require("plugins/conform") - -vim.filetype.add({ - filename = { - ["cgitrc"] = "dosini", - }, -}) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 9f4531f..4b9f19f 100755 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -9,33 +9,33 @@ "comfy-line-numbers.nvim": { "branch": "main", "commit": "9adedbaf1f410cdaacf4fb2ca8eb44f3d5f6d010" }, "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, "fterm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, - "gentoo-syntax": { "branch": "master", "commit": "1b3a81ec62e5c843245dc431be0fe072add7eca8" }, + "gentoo-syntax": { "branch": "master", "commit": "218a89826bf6cd09e95360ff9c621fbbe61552b8" }, "haskell-vim": { "branch": "master", "commit": "f35d02204b4813d1dbe8b0e98cc39701a4b8e15e" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "lsp_signature.nvim": { "branch": "master", "commit": "b7ace9ddb1640ce266012a45a672dfdaedfa5ec6" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lsp_signature.nvim": { "branch": "master", "commit": "1997451c4c9956a1380d8bea4b0e33ebdf07976e" }, "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, - "mason.nvim": { "branch": "main", "commit": "16ba83bfc8a25f52bb545134f5bee082b195c460" }, - "mini.nvim": { "branch": "main", "commit": "d5e6f5b843f1d813d9c4bfb242b751dc5ab6f8ae" }, - "moonfly": { "branch": "master", "commit": "261664f92ed51cf0c077555b2d4b2530307eac17" }, - "none-ls-extras.nvim": { "branch": "main", "commit": "27681d797a26f1b4d6119296df42f5204c88a2dc" }, - "none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" }, - "nvim": { "branch": "main", "commit": "0303a7208dba448c459767486a38a6ec05c4216b" }, - "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, - "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, - "nvim-lspconfig": { "branch": "master", "commit": "229b79051b380377664edc4cbd534930154921a1" }, - "nvim-numbertoggle": { "branch": "main", "commit": "c5c0d305aee8532b5515914a08396b9154394c55" }, + "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, + "mini.nvim": { "branch": "main", "commit": "8831fa150fa26492cfe135801fa498132f1491d2" }, + "moonfly": { "branch": "master", "commit": "2c883835f5b7b380a0a9e80695c420f7efebdfe4" }, + "netrw-icons.nvim": { "branch": "main", "commit": "3b2b1c006e962269c4c2d8c5f741053f86763eb9" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "9a8b8a9aeb43382e5aaf49b00b7cfb5d42d32118" }, + "none-ls.nvim": { "branch": "main", "commit": "c4b82bb63b13856ba4d6b971b7aad3bb38fc6fe2" }, + "nvim": { "branch": "main", "commit": "edefef779ab08ce1a4a404713e3012b0d202bd35" }, + "nvim-autopairs": { "branch": "master", "commit": "3172f40c16563db871a58f20d205c710ad782311" }, + "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac062d0d01c019c0dbdb798968f3e5d8b35c3853" }, + "nvim-numbertoggle": { "branch": "main", "commit": "704e098c7f056f0dae9407d8651edd3d183f3fff" }, "nvim-toggler": { "branch": "main", "commit": "467808600882fd6c9e33b9dbc4889b1b80cfd917" }, - "nvim-tree.lua": { "branch": "master", "commit": "07f541fcaa4a5ae019598240362449ab7e9812b3" }, - "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, - "nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" }, + "nvim-treesitter": { "branch": "main", "commit": "ca581c3436fc2b236847f5b739ebc263739e5ca6" }, + "nvim-web-devicons": { "branch": "master", "commit": "ec309a0eaff6ea967e58c275996155ab5c16938d" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, - "render-markdown.nvim": { "branch": "main", "commit": "5adf0895310c1904e5abfaad40a2baad7fe44a07" }, + "render-markdown.nvim": { "branch": "main", "commit": "8e8795368391036643b622875a6da6a51bcd33f4" }, "telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" }, - "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "telescope.nvim": { "branch": "master", "commit": "40aedd8a68c78a656a10a8d62d80c54af59420fb" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "twilight.nvim": { "branch": "main", "commit": "664e752f4a219801265cc3fc18782b457b58c1e1" }, - "typst-preview.nvim": { "branch": "master", "commit": "325036ee145ca51d9efb145c09ac16bce3bc8b7d" }, + "typst-preview.nvim": { "branch": "master", "commit": "1c2e19486397be1c580b560fc50ee36abe329c46" }, "vim-closetag": { "branch": "master", "commit": "d0a562f8bdb107a50595aefe53b1a690460c3822" }, "vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } diff --git a/nvim/lua/config.lua b/nvim/lua/config.lua index 3fbccbd..2100a6c 100755 --- a/nvim/lua/config.lua +++ b/nvim/lua/config.lua @@ -4,6 +4,11 @@ local g = vim.g --filetypes vim.cmd("autocmd BufRead,BufNewFile *.m set filetype=objc") +vim.filetype.add({ + filename = { + ["cgitrc"] = "dosini", + }, +}) g.mapleader = " " @@ -23,6 +28,9 @@ opt.fillchars = "eob: " --g.loaded_netrw = 1 --g.loaded_netrwPlugin = 1 +vim.g.netrw_liststyle = 3 + +vim.cmd("let g:netrw_banner = 0") opt.termguicolors = true @@ -33,9 +41,9 @@ opt.shell = "/usr/bin/zsh" vim.lsp.handlers["textDocument/hover"] = function(err, result, ctx, config) - config = config or {} - config.border = "single" - return vim.lsp.handlers.hover(err, result, ctx, config) + config = config or {} + config.border = "single" + return vim.lsp.handlers.hover(err, result, ctx, config) end vim.diagnostic.config({ float = { border = "single" } }) @@ -82,8 +90,16 @@ map("n", "<leader>ff", builtin.find_files, {}) map("n", "<leader>fg", builtin.live_grep, {}) map("n", "<leader>fb", builtin.buffers, {}) map("n", "<leader>fh", builtin.help_tags, {}) -local treeapi = require("nvim-tree.api") -map("n", "<leader>e", treeapi.tree.toggle, {}) +--local treeapi = require("nvim-tree.api") +--map("n", "<leader>e", treeapi.tree.toggle, {}) map("n", "<A-i>", '<CMD>lua require("FTerm").toggle()<CR>') map("t", "<A-i>", '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>') + +map("n", "n", "nzzzv") +map("n", "n", "Nzzzv") +map("n", "<", "<gv", opts) +map("n", ">", ">gv", opts) +map("i", "<C-c>", "<ESC>") +map("n", "<C-c>", ":nohl<CR>", { desc = "Clear search hl", silent = true }) +map("n", "x", "_x", opts) diff --git a/nvim/lua/plugins/catppuccin/init.lua b/nvim/lua/plugins/catppuccin/init.lua index c497b4d..2137248 100755 --- a/nvim/lua/plugins/catppuccin/init.lua +++ b/nvim/lua/plugins/catppuccin/init.lua @@ -67,24 +67,3 @@ require("lualine").setup({ }, }, }) - -require("nvim-tree").setup({ - view = { - width = 30, - side = "left", - }, - renderer = { - highlight_git = true, - root_folder_modifier = ":~", - icons = { - show = { - file = true, - folder = true, - git = true, - }, - }, - }, - filters = { - dotfiles = false, - }, -}) diff --git a/nvim/lua/plugins/lazy/plugins.lua b/nvim/lua/plugins/lazy/plugins.lua index f668d40..4afee21 100755 --- a/nvim/lua/plugins/lazy/plugins.lua +++ b/nvim/lua/plugins/lazy/plugins.lua @@ -6,28 +6,25 @@ return { "williamboman/mason.nvim", "stevearc/conform.nvim", { - "neovimhaskell/haskell-vim", - ft = "haskell", - init = function() - vim.g.haskell_indent_disable = 0 - vim.g.haskell_indent_let = 2 - vim.g.haskell_indent_in = 1 - vim.g.haskell_indent_where = 2 - vim.g.haskell_indent_do = 2 - vim.g.haskell_indent_case = 2 - vim.g.haskell_indent_if = 2 - end, + "neovimhaskell/haskell-vim", + ft = "haskell", + init = function() + vim.g.haskell_indent_disable = 0 + vim.g.haskell_indent_let = 2 + vim.g.haskell_indent_in = 1 + vim.g.haskell_indent_where = 2 + vim.g.haskell_indent_do = 2 + vim.g.haskell_indent_case = 2 + vim.g.haskell_indent_if = 2 + end, }, { "nvim-telescope/telescope.nvim", - tag = "0.1.5", + --tag = "0.1.5", + branch = "master", dependencies = { "nvim-lua/plenary.nvim" }, }, { - "nvim-tree/nvim-tree.lua", - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = {}, @@ -141,4 +138,13 @@ return { lazy = false, priority = 1000, }, + { + "Fasamii/netrw-icons.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", -- or "echasnovski/mini.icons" + }, + config = function() + require("netrw-icons").setup() + end, + }, } diff --git a/nvim/lua/plugins/lsp/init.lua b/nvim/lua/plugins/lsp/init.lua index 3745198..e21fba2 100755 --- a/nvim/lua/plugins/lsp/init.lua +++ b/nvim/lua/plugins/lsp/init.lua @@ -151,6 +151,21 @@ vim.lsp.config['luals'] = { }, } +vim.lsp.config['html'] = { + cmd = { 'vscode-html-language-server', '--stdio' }, + filetypes = { 'html' }, + root_markers = { 'package.json', '.git' }, + capabilities = caps, + init_options = { + provideFormatter = true, + }, + settings = { + html = { + validate = { scripts = true, styles = true }, + }, + }, +} + vim.lsp.config['cssls'] = { cmd = { 'vscode-css-language-server', '--stdio' }, filetypes = { 'css', 'scss', 'less' }, @@ -163,6 +178,46 @@ vim.lsp.config['cssls'] = { }, } +vim.lsp.config['eslint'] = { + cmd = { 'vscode-eslint-language-server', '--stdio' }, + filetypes = { + 'javascript', 'javascriptreact', 'javascript.jsx', + 'typescript', 'typescriptreact', 'typescript.tsx', + 'vue', 'svelte', 'astro', 'html', + }, + root_markers = { + 'eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs', + '.eslintrc.js', '.eslintrc.json', '.eslintrc', + 'package.json', '.git', + }, + capabilities = caps, + settings = { + validate = 'on', + packageManager = 'npm', + workingDirectory = { mode = 'auto' }, + }, +} + +vim.lsp.config['jsonls'] = { + cmd = { 'vscode-json-language-server', '--stdio' }, + filetypes = { 'json', 'jsonc' }, + root_markers = { 'package.json', '.git', 'config.jsonc' }, + capabilities = caps, + settings = { + json = { + validate = { enable = true }, + format = { enable = true }, + }, + }, +} + +vim.lsp.config['markdown'] = { + cmd = { 'vscode-markdown-language-server', '--stdio' }, + filetypes = { 'markdown' }, + root_markers = { '.git' }, + capabilities = caps, +} + vim.lsp.config['phpls'] = { cmd = { 'intelephense', '--stdio' }, filetypes = { 'php' }, @@ -248,24 +303,17 @@ vim.lsp.config['serve_d'] = { capabilities = caps, } -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', 'hie.yaml', '.git' }, - capabilities = caps, - settings = { - haskell = { - formattingProvider = 'ormolu', - plugin = { semanticTokens = { globalOn = false } }, - }, - }, + cmd = { 'haskell-language-server-wrapper', '--lsp' }, + filetypes = { 'haskell', 'lhaskell' }, + root_markers = { 'stack.yaml', 'cabal.project', 'package.yaml', 'hie.yaml', '.git' }, + capabilities = caps, + settings = { + haskell = { + formattingProvider = 'ormolu', + plugin = { semanticTokens = { globalOn = false } }, + }, + }, } vim.lsp.config['gopls'] = { |
