diff options
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/after/ftplugin/c.lua | 3 | ||||
| -rw-r--r-- | nvim/after/ftplugin/css.lua | 3 | ||||
| -rw-r--r-- | nvim/after/ftplugin/html.lua | 3 | ||||
| -rw-r--r-- | nvim/after/ftplugin/typescript.lua | 3 | ||||
| -rw-r--r-- | nvim/after/ftplugin/typescriptreact.lua | 3 | ||||
| -rw-r--r-- | nvim/init.lua | 147 | ||||
| -rw-r--r-- | nvim/lazy-lock.json | 32 | ||||
| -rw-r--r-- | nvim/lua/kkard2/init.lua | 4 | ||||
| -rw-r--r-- | nvim/lua/kkard2/lazy.lua | 100 | ||||
| -rw-r--r-- | nvim/lua/kkard2/lazy/catppuccin.lua | 21 | ||||
| -rw-r--r-- | nvim/lua/kkard2/lazy/lsp.lua | 72 | ||||
| -rw-r--r-- | nvim/lua/kkard2/lazy/treesitter.lua | 9 | ||||
| -rw-r--r-- | nvim/lua/kkard2/netrw.lua | 4 | ||||
| -rw-r--r-- | nvim/lua/kkard2/remap.lua | 34 | ||||
| -rw-r--r-- | nvim/lua/kkard2/set.lua | 29 |
15 files changed, 158 insertions, 309 deletions
diff --git a/nvim/after/ftplugin/c.lua b/nvim/after/ftplugin/c.lua deleted file mode 100644 index 5ea81f6..0000000 --- a/nvim/after/ftplugin/c.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt.softtabstop = 0 -vim.opt.expandtab = false -vim.opt.shiftwidth = 4 diff --git a/nvim/after/ftplugin/css.lua b/nvim/after/ftplugin/css.lua deleted file mode 100644 index ed7f6bb..0000000 --- a/nvim/after/ftplugin/css.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 diff --git a/nvim/after/ftplugin/html.lua b/nvim/after/ftplugin/html.lua deleted file mode 100644 index ed7f6bb..0000000 --- a/nvim/after/ftplugin/html.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 diff --git a/nvim/after/ftplugin/typescript.lua b/nvim/after/ftplugin/typescript.lua deleted file mode 100644 index ed7f6bb..0000000 --- a/nvim/after/ftplugin/typescript.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 diff --git a/nvim/after/ftplugin/typescriptreact.lua b/nvim/after/ftplugin/typescriptreact.lua deleted file mode 100644 index ed7f6bb..0000000 --- a/nvim/after/ftplugin/typescriptreact.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.opt.tabstop = 2 -vim.opt.softtabstop = 2 -vim.opt.shiftwidth = 2 diff --git a/nvim/init.lua b/nvim/init.lua index 1545e69..b0d571f 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1 +1,146 @@ -require('kkard2') +-- set +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true +vim.opt.wrap = true -- we'll see if i like it + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim./undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = true +vim.opt.incsearch = true + +vim.opt.scrolloff = 8 + +vim.opt.colorcolumn = "80,100,120" + +vim.g.netrw_bufsettings = "noma nomod nu nobl nowrap ro" +vim.g.netrw_banner = 0 + +vim.cmd("colorscheme evening") + +vim.opt.signcolumn = "yes" +vim.opt.list = true + + +-- remap +vim.g.mapleader = " " + +vim.keymap.set({ "n", "v" }, ";", ":") +vim.keymap.set({ "n", "v" }, ":", ";") + +vim.keymap.set("n", "<leader>ff", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") +vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") + +vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]]) +vim.keymap.set("n", "<leader>Y", [["+Y]]) + +vim.keymap.set({ "n", "v" }, "<leader>p", [["+p]]) +vim.keymap.set("n", "<leader>P", [["+P]]) + +vim.keymap.set({ "n", "v" }, "<leader>d", [["+d]]) +vim.keymap.set("n", "<leader>D", [["+D]]) + +vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") + +vim.keymap.set("i", "<NL>", "<Esc>o") +vim.keymap.set("n", "<NL>", "o<Esc>") + +vim.keymap.set("n", "<Esc>", function() + local win_number = vim.api.nvim_get_current_win() + if vim.api.nvim_win_get_config(win_number).relative ~= "" then + vim.cmd("q") + end +end) + +-- well i tried to not overwrite default register but it didn't work +vim.keymap.set("i", "<S-Tab>", "<Esc>0\"_d$?.<CR><cmd>noh<CR>0\"myw<C-o>0\"_d$\"mpa") +vim.keymap.set("n", "<C-j>", "\"_xi<CR><Esc>f ") + + +-- lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.uv.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + { + "nvim-treesitter/nvim-treesitter", + config = function() + require("nvim-treesitter.configs").setup({ + auto_install = true, + highlight = { + enable = true, + }, + }) + vim.cmd("TSUpdate") + end + }, + { + "mbbill/undotree", + keys = { + { "<leader>ut", "<cmd>UndotreeToggle<CR>" } + }, + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.4", + dependencies = { "nvim-lua/plenary.nvim" }, + keys = { + { "<leader><leader>", "<cmd>Telescope find_files<CR>" }, + { "<leader>fg", "<cmd>Telescope live_grep<CR>" }, + { "<leader>fh", "<cmd>Telescope help_tags<CR>" }, + }, + }, + + "tpope/vim-repeat", + "tpope/vim-surround", + "tpope/vim-commentary", + + { 'VonHeikemen/lsp-zero.nvim', branch = 'v3.x', config = function() + local lsp = require("lsp-zero").preset({}) + local lspconfig = require("lspconfig") + lspconfig.rust_analyzer.setup({}) + lspconfig.zls.setup({}) + lspconfig.lua_ls.setup(lsp.nvim_lua_ls()) + lsp.setup() + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + local opts = { buffer = ev.buf } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "<leader><CR>", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format, opts) + end, + }) + end }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/nvim-cmp' }, + { 'L3MON4D3/LuaSnip' }, + { "neovim/nvim-lspconfig" }, +}) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0d95179..9d21793 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,23 +1,15 @@ { - "LuaSnip": { "branch": "master", "commit": "99a94cc35ec99bf06263d0346128e908a204575c" }, - "catppuccin": { "branch": "main", "commit": "057c34f849cf21059487d849e2f3b3efcd4ee0eb" }, + "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "copilot.vim": { "branch": "release", "commit": "4a361e8cf327590d51d214c5c01c6391727390d7" }, - "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, - "lsp-zero.nvim": { "branch": "v2.x", "commit": "73bc33fe9ad5a1d4501536fdd4755b3aa18c3392" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, - "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, - "mini.trailspace": { "branch": "main", "commit": "c41ab1035d184ff20c1aebd76639320c055afebe" }, - "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, - "nvim-lspconfig": { "branch": "master", "commit": "c0de180ddb3df36feef8ac3607670894d0e7497f" }, - "nvim-treesitter": { "branch": "master", "commit": "8d5e5dc40a4c480483690777cefb8cf67e710702" }, - "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, - "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, - "repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, - "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, - "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, - "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, - "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" } + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "98fe58a00c69f709b6b65e53aed56d86da92a4b7" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-lspconfig": { "branch": "master", "commit": "694aaec65733e2d54d393abf80e526f86726c988" }, + "nvim-treesitter": { "branch": "master", "commit": "80a16deb5146a3eb4648effccda1ab9f45e43e76" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, + "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, + "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } }
\ No newline at end of file diff --git a/nvim/lua/kkard2/init.lua b/nvim/lua/kkard2/init.lua deleted file mode 100644 index 72e3df9..0000000 --- a/nvim/lua/kkard2/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -require("kkard2.set") -require("kkard2.netrw") -require("kkard2.remap") -require("kkard2.lazy") diff --git a/nvim/lua/kkard2/lazy.lua b/nvim/lua/kkard2/lazy.lua deleted file mode 100644 index 13efaf0..0000000 --- a/nvim/lua/kkard2/lazy.lua +++ /dev/null @@ -1,100 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.uv.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - - - -require("lazy").setup({ - { - "catppuccin/nvim", - name = "catppuccin", - config = require("kkard2.lazy.catppuccin"), - }, - { - "nvim-treesitter/nvim-treesitter", - config = require("kkard2.lazy.treesitter"), - }, - { - "mbbill/undotree", - keys = { - { "<leader>ut", "<cmd>UndotreeToggle<CR><C-w>h" }, - } - }, - { - "nvim-lualine/lualine.nvim", - config = function() require("lualine").setup({ - options = { - component_separators = { left = " ", right = " " }, - section_separators = { left = " ", right = " " }, - }, - }) end, - }, - { - "nvim-telescope/telescope.nvim", - tag = "0.1.2", - dependencies = { "nvim-lua/plenary.nvim" }, - keys = { - { "<leader><leader>", "<cmd>Telescope find_files<CR>" }, - { "<leader>fg", "<cmd>Telescope live_grep<CR>" }, - { "<leader>fh", "<cmd>Telescope help_tags<CR>" }, - }, - }, - { - "VonHeikemen/lsp-zero.nvim", - branch = "v2.x", - dependencies = { - -- LSP Support - { "neovim/nvim-lspconfig" }, -- Required - { "williamboman/mason.nvim" }, -- Optional - { "williamboman/mason-lspconfig.nvim" }, -- Optional - - -- Autocompletion - { "hrsh7th/nvim-cmp" }, -- Required - { "hrsh7th/cmp-nvim-lsp" }, -- Required - { "L3MON4D3/LuaSnip" }, -- Required - }, - config = require("kkard2.lazy.lsp"), - }, - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - icons = false, - fold_open = "-", -- icon used for open folds - fold_closed = "+", -- icon used for closed folds - indent_lines = false, -- add an indent guide below the fold icons - signs = { - -- icons / text used for a diagnostic - error = "E", - warning = "W", - hint = "H", - information = "I" - }, - use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client - }, - keys = { - { "<leader>xx", function() require("trouble").open() end }, - { "<leader>xw", function() require("trouble").open("workspace_diagnostics") end }, - { "<leader>xd", function() require("trouble").open("document_diagnostics") end }, - }, - }, - { - "echasnovski/mini.trailspace", - config = function() require("mini.trailspace").setup() end, - }, - - { "github/copilot.vim" }, - { "https://tpope.io/vim/repeat.git" }, - { "https://tpope.io/vim/surround.git" }, - -- i also don't know why the above ones are like this - { "tpope/vim-commentary" }, -}) diff --git a/nvim/lua/kkard2/lazy/catppuccin.lua b/nvim/lua/kkard2/lazy/catppuccin.lua deleted file mode 100644 index d8aee9a..0000000 --- a/nvim/lua/kkard2/lazy/catppuccin.lua +++ /dev/null @@ -1,21 +0,0 @@ -return function() - require("catppuccin").setup({ - no_italic = true, - color_overrides = { - mocha = { - base = "#000000", - mantle = "#000000", - crust = "#000000", - }, - }, - highlight_overrides = { - mocha = function(c) - return { - MiniTrailspace = { bg = c.red }, - } - end, - }, - }) - - vim.cmd("colorscheme catppuccin-mocha") -end diff --git a/nvim/lua/kkard2/lazy/lsp.lua b/nvim/lua/kkard2/lazy/lsp.lua deleted file mode 100644 index a4d24ad..0000000 --- a/nvim/lua/kkard2/lazy/lsp.lua +++ /dev/null @@ -1,72 +0,0 @@ --- WARNING: BAD CODE AHEAD --- look at your own risk -local function rename_file() - local source_file, target_file - - vim.ui.input({ - prompt = "Source : ", - completion = "file", - default = vim.api.nvim_buf_get_name(0) - }, - function(input) - source_file = input - end - ) - vim.ui.input({ - prompt = "Target : ", - completion = "file", - default = source_file - }, - function(input) - target_file = input - end - ) - - local params = { - command = "_typescript.applyRenameFile", - arguments = { - { - sourceUri = source_file, - targetUri = target_file, - }, - }, - title = "" - } - - vim.lsp.util.rename(source_file, target_file) - vim.lsp.buf.execute_command(params) -end --- END OF WARNING - -return function() - local lsp = require("lsp-zero").preset({}) - - lsp.on_attach(function(_, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions - lsp.default_keymaps({ buffer = bufnr }) - end) - - -- (Optional) Configure lua language server for neovim - require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) - - lsp.setup() - - vim.keymap.set("n", "gh", vim.diagnostic.open_float) - vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename) - vim.keymap.set("n", "<leader><CR>", vim.lsp.buf.code_action) - vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format) - - - - -- temp - require("lspconfig").tsserver.setup({ - commands = { - RenameFile = { - rename_file, - description = "Rename File" - }, - } - }) - -- end temp -end diff --git a/nvim/lua/kkard2/lazy/treesitter.lua b/nvim/lua/kkard2/lazy/treesitter.lua deleted file mode 100644 index 5129ecd..0000000 --- a/nvim/lua/kkard2/lazy/treesitter.lua +++ /dev/null @@ -1,9 +0,0 @@ -return function() - require("nvim-treesitter.configs").setup({ - auto_install = true, - highlight = { - enable = true, - }, - }) - vim.cmd("TSUpdate") -end diff --git a/nvim/lua/kkard2/netrw.lua b/nvim/lua/kkard2/netrw.lua deleted file mode 100644 index 8549119..0000000 --- a/nvim/lua/kkard2/netrw.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.g.netrw_banner = 0 -vim.g.netrw_preview = 1 -vim.g.netrw_winsize = 30 -vim.g.netrw_fastbrowse = 0 diff --git a/nvim/lua/kkard2/remap.lua b/nvim/lua/kkard2/remap.lua deleted file mode 100644 index cd9aba2..0000000 --- a/nvim/lua/kkard2/remap.lua +++ /dev/null @@ -1,34 +0,0 @@ -vim.g.mapleader = " " - -vim.keymap.set({"n", "v"}, ";", ":") -vim.keymap.set({"n", "v"}, ":", ";") - -vim.keymap.set("n", "<leader>ff", vim.cmd.Ex) - -vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") - -vim.keymap.set({"n", "v"}, "<leader>y", [["+y]]) -vim.keymap.set("n", "<leader>Y", [["+Y]]) - -vim.keymap.set({"n", "v"}, "<leader>p", [["+p]]) -vim.keymap.set("n", "<leader>P", [["+P]]) - -vim.keymap.set({"n", "v"}, "<leader>d", [["+d]]) -vim.keymap.set("n", "<leader>D", [["+D]]) - -vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") - -vim.keymap.set("i", "<C-Enter>", "<Esc>o") - --- exit floating window when pressing <Esc> in normal mode -vim.keymap.set("n", "<Esc>", function() - local win_number = vim.api.nvim_get_current_win() - if vim.api.nvim_win_get_config(win_number).relative ~= "" then - vim.cmd(":q") - end -end) - --- lmao -vim.keymap.set("i", "<S-Tab>", "<Esc>0d$?.<CR><cmd>noh<CR>0yw<C-o>0\"_d$pa") -vim.keymap.set("n", "<C-j>", "xi<CR><Esc>f ") diff --git a/nvim/lua/kkard2/set.lua b/nvim/lua/kkard2/set.lua deleted file mode 100644 index ec92e5b..0000000 --- a/nvim/lua/kkard2/set.lua +++ /dev/null @@ -1,29 +0,0 @@ -vim.opt.nu = true -vim.opt.relativenumber = true - -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.expandtab = true - -vim.opt.smartindent = true - -vim.opt.wrap = false - -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -vim.opt.undofile = true - -vim.opt.hlsearch = true -vim.opt.incsearch = true - -vim.opt.scrolloff = 8 -vim.opt.signcolumn = "yes" -vim.opt.isfname:append("@-@") - -vim.opt.updatetime = 50 - -vim.opt.colorcolumn = "80" - -vim.g.netrw_bufsettings = "noma nomod nu nobl nowrap ro" |
