From 387e08c52d9752bc839c71119f140ba8435c3d70 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 18 Aug 2023 23:42:39 +0300 Subject: nvim: switch to lazy.nvim revert this as whole, if you miss the good old days --- .config/nvim/lua/plugins/barbar.lua | 77 ++++++++ .config/nvim/lua/plugins/cmp.lua | 114 +++++++++++ .config/nvim/lua/plugins/colorscheme.lua | 45 +++++ .config/nvim/lua/plugins/cutlass.lua | 51 +++++ .config/nvim/lua/plugins/dashboard.lua | 36 ++++ .config/nvim/lua/plugins/devicons.lua | 25 +++ .config/nvim/lua/plugins/git.lua | 95 +++++++++ .config/nvim/lua/plugins/indent-blankline.lua | 14 ++ .config/nvim/lua/plugins/latex.lua | 16 ++ .config/nvim/lua/plugins/lsp.lua | 236 +++++++++++++++++++++++ .config/nvim/lua/plugins/lualine.lua | 84 ++++++++ .config/nvim/lua/plugins/misc.lua | 83 ++++++++ .config/nvim/lua/plugins/nvim-tree.lua | 40 ++++ .config/nvim/lua/plugins/telescope.lua | 45 +++++ .config/nvim/lua/plugins/tpope.lua | 11 ++ .config/nvim/lua/plugins/treesitter.lua | 73 +++++++ .config/nvim/lua/plugins/trouble.lua | 14 ++ .config/nvim/lua/plugins/turkish-deasciifier.lua | 24 +++ .config/nvim/lua/plugins/vimwiki.lua | 28 +++ .config/nvim/lua/plugins/which-key.lua | 14 ++ 20 files changed, 1125 insertions(+) create mode 100644 .config/nvim/lua/plugins/barbar.lua create mode 100644 .config/nvim/lua/plugins/cmp.lua create mode 100644 .config/nvim/lua/plugins/colorscheme.lua create mode 100644 .config/nvim/lua/plugins/cutlass.lua create mode 100644 .config/nvim/lua/plugins/dashboard.lua create mode 100644 .config/nvim/lua/plugins/devicons.lua create mode 100644 .config/nvim/lua/plugins/git.lua create mode 100644 .config/nvim/lua/plugins/indent-blankline.lua create mode 100644 .config/nvim/lua/plugins/latex.lua create mode 100644 .config/nvim/lua/plugins/lsp.lua create mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/misc.lua create mode 100644 .config/nvim/lua/plugins/nvim-tree.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/tpope.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua create mode 100644 .config/nvim/lua/plugins/trouble.lua create mode 100644 .config/nvim/lua/plugins/turkish-deasciifier.lua create mode 100644 .config/nvim/lua/plugins/vimwiki.lua create mode 100644 .config/nvim/lua/plugins/which-key.lua (limited to '.config/nvim/lua/plugins') diff --git a/.config/nvim/lua/plugins/barbar.lua b/.config/nvim/lua/plugins/barbar.lua new file mode 100644 index 0000000..7b6c69d --- /dev/null +++ b/.config/nvim/lua/plugins/barbar.lua @@ -0,0 +1,77 @@ +return { + { + "romgrk/barbar.nvim", + dependencies = { + 'lewis6991/gitsigns.nvim', + "nvim-tree/nvim-web-devicons" + }, + init = function() + vim.g.barbar_auto_setup = false -- disable auto-setup + local map = require("helpers.keys").map + + -- move to previous/next + map('n', '', 'BufferPrevious', "switch to previous buffer") + map('n', '', 'BufferNext', "switch to next buffer") + + -- re-order to previous/next + map('n', '', 'BufferMovePrevious', "move buffer back") + map('n', '', 'BufferMoveNext', "move buffer forward") + + -- goto buffer in position... + map('n', '', 'BufferGoto 1') + map('n', '', 'BufferGoto 2') + map('n', '', 'BufferGoto 3') + map('n', '', 'BufferGoto 4') + map('n', '', 'BufferGoto 5') + map('n', '', 'BufferGoto 6') + map('n', '', 'BufferGoto 7') + map('n', '', 'BufferGoto 8') + map('n', '', 'BufferGoto 9') + map('n', '', 'BufferLast') + + -- pin/unpin buffer + map('n', '', 'BufferPin', "pin buffer") + -- close buffer + map('n', '', 'BufferClose', "close buffer") + -- magic buffer-picking mode + map('n', 'dg', 'BufferPick', "buffer picking mode") + -- sort automatically by... + map('n', 'db', 'BufferOrderByBufferNumber', "sort buffers by number") + map('n', 'dd', 'BufferOrderByDirectory', "sort buffers by directory") + map('n', 'dl', 'BufferOrderByLanguage', "sort buffers by language") + map('n', 'dw', 'BufferOrderByWindowNumber', "sort buffers by window number") + end, + opts = { + animation = false, + auto_hide = true, + tabpages = true, + closable = true, + clickable = false, + icons = { + diagnostics = { + [vim.diagnostic.severity.ERROR] = {enabled = true, icon = '❌'}, + [vim.diagnostic.severity.WARN] = {enabled = false}, + [vim.diagnostic.severity.INFO] = {enabled = false}, + [vim.diagnostic.severity.HINT] = {enabled = true}, + }, + filetype = { + custom_colors = false, + enabled = true, + }, + separator = { left = '▎', right = ''}, + modified = { button = ''}, + pinned = { button = '', filename = true, separator = { right = ''}}, + }, + + insert_at_end = false, + insert_at_start = false, + + maximum_padding = 1, + minimum_padding = 1, + maximum_length = 30, + semantic_letters = true, + letters = 'arstneoidhqwfpluy;zxcvkmARSTNEOIDHQWFPLUYZXCVKM', + no_name_title = nil, + }, + }, +} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..78ff9a9 --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,114 @@ +-- autocompletion +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + require("luasnip/loaders/from_vscode").lazy_load() + + local kind_icons = { + Text = "󰊄", + Method = "m", + Function = "󰊕", + Constructor = "", + Field = "󰽏", + Variable = "󰫧", + Class = "󰌗", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "󰎠", + Enum = "", + Keyword = "", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰇽", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = "", + } + + cmp.setup({ + enabled = true, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[lsp]", + luasnip = "[snippet]", + buffer = "[buffer]", + path = "[path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + }) + + -- If you want insert `(` after select function or method item + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() + ) + end, + }, +} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..969d304 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,45 @@ +return { + { + "catppuccin/nvim", + name = "catppuccin", + lazy = false, + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", -- latte, frappe, macchiato, mocha + background = { + light = "latte", + dark = "mocha", + }, + transparent_background = false, + term_colors = false, + no_italic = true, -- force no italic + no_bold = false, -- force no bold + integrations = { + barbar = true, + cmp = true, + fidget = true, + gitsigns = true, + leap = true, + nvimtree = true, + telescope = true, + treesitter = true, + vimwiki = true, + }, + native_lsp = { + enabled = true, + underlines = { + errors = { "underline" }, + hints = { "underline" }, + warnings = { "underline" }, + information = { "underline" }, + }, + }, + indent_blankline = { + enabled = true, + }, + }) + vim.cmd("colorscheme catppuccin") + end, + }, +} diff --git a/.config/nvim/lua/plugins/cutlass.lua b/.config/nvim/lua/plugins/cutlass.lua new file mode 100644 index 0000000..0b8ef52 --- /dev/null +++ b/.config/nvim/lua/plugins/cutlass.lua @@ -0,0 +1,51 @@ +return { + { + 'svermeulen/vim-cutlass', + }, + { + 'svermeulen/vim-subversive', + config = function() + local map = require("helpers.keys").map + + -- substitute from yank + map('n', 'ys', '(SubversiveSubstitute)', "substitute from yank") + map('n', 'yss', '(SubversiveSubstituteLine)', "substitute from yank, line") + map('n', 'yS', '(SubversiveSubstituteToEndOfLine)', "substitute from yank, eol") + + -- substitute over range + map( { 'n', 'x' }, 's', '(SubversiveSubstituteRange)', "start substitude over range") + map('n', 'ss', '(SubversiveSubstituteWordRange)', "start substitude over range") + end + }, + { + 'svermeulen/vim-yoink', + config = function() + vim.g.yoinkIncludeDeleteOperations = 1 + + -- fix the Target STRING not available + vim.g.clipboard = { + name = 'xsel_override', + copy = { + ['+'] = 'xsel --input --clipboard', + ['*'] = 'xsel --input --primary', + }, + paste = { + ['+'] = 'xsel --output --clipboard', + ['*'] = 'xsel --output --primary', + }, + cache_enabled = 1, + } + + local map = require("helpers.keys").map + + -- yoink paste + map('n', 'p', '(YoinkPaste_p)') + map('n', 'P', '(YoinkPaste_P)') + + -- iterate over yank list + map('n', '', '(YoinkPostPasteSwapBack)') + map('n', '', '(YoinkPostPasteSwapForward)') + + end, + } +} diff --git a/.config/nvim/lua/plugins/dashboard.lua b/.config/nvim/lua/plugins/dashboard.lua new file mode 100644 index 0000000..074d3f5 --- /dev/null +++ b/.config/nvim/lua/plugins/dashboard.lua @@ -0,0 +1,36 @@ +return { + { + 'glepnir/dashboard-nvim', + event = 'VimEnter', + config = function() + require('dashboard').setup { + theme = 'hyper', + change_to_vcs_root = true, + config = { + week_header = { + enable = true, + }, + shortcut = { + { + desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u', + }, + { + icon = ' ', + icon_hl = '@variable', + desc = 'Files', + group = 'Label', + action = 'Telescope find_files', + key = 'f', + }, + }, + }, + + } + end, + dependencies = { + { + 'nvim-tree/nvim-web-devicons' + } + } + } +} diff --git a/.config/nvim/lua/plugins/devicons.lua b/.config/nvim/lua/plugins/devicons.lua new file mode 100644 index 0000000..712ecc6 --- /dev/null +++ b/.config/nvim/lua/plugins/devicons.lua @@ -0,0 +1,25 @@ +return { + { + "nvim-tree/nvim-web-devicons", + opts = { + override = { + wiki = { + icon = "󰂺", + color = "#D7827E", + name = "vimwiki" + }, + rem = { + icon = " ", + color = "#B4637A", + name = "remind" + }, + mail = { + icon = "󰇰 ", + color = "#907AA9", + name = "mail" + }, + }, + default = true + }, + }, +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..0e4d7f5 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,95 @@ +return { + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = '│' }, + change = { text = '│' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = ', - ', + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = true + }, + + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc, opts) + opts = opts or {} + opts.buffer = bufnr + opts.desc = desc + vim.keymap.set(mode, l, r, opts) + end + + -- navigation + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, "jump to next hunk", { expr = true }) + + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, "jump to previous hunk", { expr = true }) + + -- Actions + map('n', 'hs', gs.stage_hunk, "stage hunk") + map('n', 'hr', gs.reset_hunk, "reset hunk") + map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, + "stage selection") + map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, + "reset selection") + map('n', 'hS', gs.stage_buffer, "stage buffer") + map('n', 'hu', gs.undo_stage_hunk, "undo stage hunk") + map('n', 'hR', gs.reset_buffer, "undo reset buffer") + map('n', 'hp', gs.preview_hunk, "preview hunk") + map('n', 'hb', function() gs.blame_line { full = true } end, "blame line") + map('n', 'tb', gs.toggle_current_line_blame, "toggle current line blame") + map('n', 'hd', gs.diffthis, "diff this") + map('n', 'hD', function() gs.diffthis('~') end, "diff whole buffer") + map('n', 'td', gs.toggle_deleted, "toggle deleted") + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', "select hunk") + end + + }, + }, + { + "tpope/vim-fugitive", + cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' }, + }, +} diff --git a/.config/nvim/lua/plugins/indent-blankline.lua b/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..42e5c62 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,14 @@ +return { + { + "lukas-reineke/indent-blankline.nvim", + init = function() + vim.opt.list = true + end, + config = { + show_current_context = true, + char = "┊", + buftype_exclude = {"terminal"}, + filetype_exclude = {"dashboard", "help", "man"} + }, + }, +} diff --git a/.config/nvim/lua/plugins/latex.lua b/.config/nvim/lua/plugins/latex.lua new file mode 100644 index 0000000..8582c6f --- /dev/null +++ b/.config/nvim/lua/plugins/latex.lua @@ -0,0 +1,16 @@ +return { + { + "lervag/vimtex", + ft = { 'tex', 'latex', 'plaintext' }, + init = function() + vim.g.vimtex_view_method = 'zathura' + vim.g.vimtex_quickfix_mode = 0 + vim.g.vimtex_quickfix_ignore_filters = {"Underfull", "Overfull"} + vim.g.vimtex_compiler_latexmk = { + options = { + "-pdf", '-shell-escape', '-verbose', '-file-line-error', '-synctex=1', '-interaction=nonstopmode' + } + } + end, + }, +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..d03d9af --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,236 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "j-hui/fidget.nvim", + "folke/neodev.nvim", + "RRethy/vim-illuminate", + "hrsh7th/cmp-nvim-lsp", + }, + config = function() + local map = require("helpers.keys").map + + map('n', 'e', vim.diagnostic.open_float, "lsp: open diagnostics float") + map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") + map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") + + -- set up mason before anything else + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "pylsp", + }, + automatic_installation = true, + }) + + -- quick access via keymap + require("helpers.keys").map("n", "M", "Mason", "show mason") + + -- neodev setup before lsp config + require("neodev").setup() + + -- set up cool signs for diagnostics + 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 = "" }) + end + + -- Diagnostic config + local config = { + virtual_text = false, + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + vim.diagnostic.config(config) + + -- this function gets run when an lsp connects to a particular buffer. + local on_attach = function(client, bufnr) + map = require("helpers.keys").lsp_map + + map("lr", vim.lsp.buf.rename, bufnr, "lsp: rename symbol") + map("la", vim.lsp.buf.code_action, bufnr, "lsp: code action") + map("ld", vim.lsp.buf.type_definition, bufnr, "lsp: type definition") + map("ls", require("telescope.builtin").lsp_document_symbols, bufnr, "lsp: document symbols") + + map("gd", vim.lsp.buf.definition, bufnr, "lsp: goto definition") + map("gD", vim.lsp.buf.declaration, bufnr, "lsp: goto declaration") + map("gr", require("telescope.builtin").lsp_references, bufnr, "lsp: goto references") + map("gI", vim.lsp.buf.implementation, bufnr, "lsp: goto implementation") + map("K", vim.lsp.buf.hover, bufnr, "lsp: hover documentation") + map("", vim.lsp.buf.signature_help, bufnr, "lsp: signature help") + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "lsp: format current buffer" }) + + map("fm", "Format", bufnr, "lsp: format current buffer") + + -- Attach and configure vim-illuminate + -- apparently this is deprecated + -- https://github.com/RRethy/vim-illuminate/issues/111 + require("illuminate").on_attach(client) + end + + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + + -- lua + require("lspconfig")["lua_ls"].setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + + -- python + require("lspconfig")["pylsp"].setup({ + on_attach = on_attach, + capabilities = capabilities, + settings = { + pylsp = { + plugins = { + flake8 = { + enabled = true, + maxLineLength = 88, -- black's line length + }, + -- disable plugins overlapping with flake8 + pycodestyle = { + enabled = false, + }, + mccabe = { + enabled = false, + }, + pyflakes = { + enabled = false, + }, + -- use black as the formatter + autopep8 = { + enabled = false, + }, + }, + }, + }, + }) + + -- efm + require("lspconfig")["efm"].setup({ + on_attach = on_attach, + filetypes = { 'sh' }, + capabilities = capabilities + }) + + -- ltex + require("lspconfig")["ltex"].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + require("ltex_extra").setup { + load_langs = { "en-GB" }, + init_check = true, + log_level = "none", + } + end, + settings = { + ltex = { + -- my settings here + } + } + }) + + -- rust-tools + local rust_opts = { + tools = { + runnables = { + use_telescope = true, + }, + inlay_hints = { + auto = true, + show_parameter_hints = true, + parameter_hints_prefix = "↸ ", + other_hints_prefix = "❱ ", + }, + }, + + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer + server = { + on_attach = on_attach, + settings = { + -- to enable rust-analyzer settings visit: + -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc + ["rust-analyzer"] = { + -- enable clippy on save + checkOnSave = { + command = "clippy", + }, + }, + }, + }, + } + + require('rust-tools').setup(rust_opts) + end, + }, + { + "barreiroleo/ltex-extra.nvim", + event = "LspAttach", + }, + { + "j-hui/fidget.nvim", + tag = "legacy", + event = "LspAttach", + opts = { + text = { + spinner = "triangle", + commenced = "started", -- message shown when task starts + completed = "done", -- message shown when task completes + }, + }, + }, + { + "simrat39/rust-tools.nvim", + event = "LspAttach", + }, + -- { + -- "RRethy/vim-illuminate", + -- opts = { + -- filetypes_denylist = { + -- 'NvimTree', + -- 'fugitive', + -- }, + -- }, + -- }, +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..c528b69 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,84 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons" + }, + config = function() + local function lualine_spell() + if vim.wo.spell then + return "spell" + else + return + end + end + + local conditions = { + spell_on = function () + return vim.wo.spell + end, + filetype_is_tex = function() + return vim.bo.filetype == "tex" + end + } + + -- https://www.reddit.com/r/neovim/comments/u2uc4p/your_lualine_custom_features/i4muvp6/ + -- override 'encoding': don't display if encoding is utf-8. + local encoding = function() + local ret, _ = vim.bo.fenc:gsub("^utf%-8$", "") + return ret + end + + -- fileformat: don't display if &ff is unix. + local fileformat = function() + local ret, _ = vim.bo.fileformat:gsub("^unix$", "") + return ret + end + + require("lualine").setup({ + options = { + icons_enabled = true, + theme = "catppuccin", + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + }, + sections = { + lualine_a = {{'mode', fmt = string.lower}}, + lualine_b = {'branch', + { + 'diff', + diff_color= { + added = { fg = 'LightGreen' }, + modified = { fg = 'LightBlue' }, + removed = { fg = 'LightRed' }, + } + }, + { + lualine_spell, + cond = conditions.spell_on, + }}, + lualine_c = {'filename'}, + lualine_x = {encoding, fileformat, 'filetype'}, + lualine_y = {'progress'}, + lualine_z = { + 'location', { + 'diagnostics', + sources = {'nvim_diagnostic'}, + sections = {'error', 'warn', 'info', 'hint'}, + symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} + } + } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + extensions = {} + + }) + end, +} diff --git a/.config/nvim/lua/plugins/misc.lua b/.config/nvim/lua/plugins/misc.lua new file mode 100644 index 0000000..f99051e --- /dev/null +++ b/.config/nvim/lua/plugins/misc.lua @@ -0,0 +1,83 @@ +return { + { + "numToStr/Comment.nvim", + lazy = false, + opts = {}, + }, + { + "godlygeek/tabular", + lazy = false, + }, + { + "matze/vim-move" + }, + { + "ggandor/leap.nvim", + lazy = false, + init = function() + local map = require("helpers.keys").map + + map({ "n", "v" }, '`', '(leap-forward)', "leap forward") + map({ "n", "v" }, '`', '(leap-backward)', "leap backward") + end, + opts = { + case_insensitive = true, + substitute_chars = { ['\r'] = '¬' } + } + }, + { + "wellle/targets.vim" + }, + { + "monaqa/dial.nvim", + init = function() + local augend = require("dial.augend") + require("dial.config").augends:register_group { + -- default augends used when no group name is specified + default = { + augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) + augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) + augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) + augend.date.alias["%Y-%m-%d"], + augend.semver.alias.semver, + augend.constant.new { + elements = { "and", "or" }, + word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. + cyclic = true, -- "or" is incremented into "and". + }, + augend.constant.new { + elements = { "&&", "||" }, + word = false, + cyclic = true, + }, + }, + } + local map = require("helpers.keys").map + map("n", "", require("dial.map").inc_normal(), "dial: increment") + map("n", "", require("dial.map").dec_normal(), "dial: decrement") + map("v", "", require("dial.map").inc_visual(), "dial: visual increment") + map("v", "", require("dial.map").dec_visual(), "dial: visual decrement") + end, + }, + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({}) + end + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = { + disable_filetype = { "TelescopePrompt" }, + }, + init = function() + local Rule = require('nvim-autopairs.rule') + local npairs = require('nvim-autopairs') + + npairs.add_rule(Rule('%"', '%"', "remind")) + end + }, +} diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..a2d4532 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,40 @@ +return { + { + "nvim-tree/nvim-tree.lua", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + opts = { + sort_by = "case_sensitive", + diagnostics = { + enable = false, + icons = { + hint = "❔", + info = "❕", + warning = "❗", + error = "❌", + } + }, + view = { + adaptive_size = true, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + }, + init = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + local map = require("helpers.keys").map + + map("n", "vt", "NvimTreeToggle") + map("n", "vr", "NvimTreeRefresh") + map("n", "vs", "NvimTreeFindFile") + end, + }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..ecea32b --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,45 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + cond = vim.fn.executable("make") == 1 + }, + }, + config = function() + require('telescope').setup({ + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", + } + } + }) + -- Enable telescope fzf native, if installed + pcall(require("telescope").load_extension, "fzf") + + local map = require("helpers.keys").map + + map("n", "fr", require("telescope.builtin").oldfiles, "recently opened") + map("n", "", require("telescope.builtin").buffers, "open buffers") + map("n", "/", function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + })) + end, "search in current buffer") + + map("n", "sf", require("telescope.builtin").find_files, "files") + map("n", "sh", require("telescope.builtin").help_tags, "help") + map("n", "sw", require("telescope.builtin").grep_string, "current word") + map("n", "sg", require("telescope.builtin").live_grep, "grep") + map("n", "sd", require("telescope.builtin").diagnostics, "diagnostics") + end, + }, +} diff --git a/.config/nvim/lua/plugins/tpope.lua b/.config/nvim/lua/plugins/tpope.lua new file mode 100644 index 0000000..5396303 --- /dev/null +++ b/.config/nvim/lua/plugins/tpope.lua @@ -0,0 +1,11 @@ +return { + { + "tpope/vim-repeat" + }, + { + "tpope/vim-unimpaired" + }, + { + "tpope/vim-characterize" + }, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..c454b48 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,73 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = function() + pcall(require("nvim-treesitter.install").update({ with_sync = true })) + end, + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "bash", "bibtex", "c", "cpp", "css", "fish", "http", "latex", "lua", "python", "rust", "vim" }, + ignore_install = { }, + auto_install = true, + sync_install = false, + highlight = { + enable = true, + disable = { "latex" }, + additional_vim_regex_highlighting = false, + }, + indent = { + enable = true, + disable = { "python" } + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- you can use the capture groups defined in textobjects.scm + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, + modules = { }, + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..6d72bd9 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,14 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + config = function() + local map = require("helpers.keys").map + map("n", "xx", function() require("trouble").open() end, "trouble: open") + map("n", "xw", function() require("trouble").open("workspace_diagnostics") end, "trouble: open workspace diagnostics") + map("n", "xd", function() require("trouble").open("document_diagnostics") end, "trouble: open document diagnostics") + map("n", "xq", function() require("trouble").open("quickfix") end, "trouble: open quickfix") + map("n", "xl", function() require("trouble").open("loclist") end, "trouble: open loclist") + map("n", "gR", function() require("trouble").open("lsp_references") end, "trouble: open lsp references") + end, +} diff --git a/.config/nvim/lua/plugins/turkish-deasciifier.lua b/.config/nvim/lua/plugins/turkish-deasciifier.lua new file mode 100644 index 0000000..c39a35d --- /dev/null +++ b/.config/nvim/lua/plugins/turkish-deasciifier.lua @@ -0,0 +1,24 @@ +return { + { + "yigitsever/turkish-deasciifier.vim", + init = function() + local map = require("helpers.keys").map + + -- brute force deasciify everything + map({ "n", "x" }, "tc", "TurkishDeasciifyForce()", "force turkish characters", + { expr = true }) + map("n", "tctc", "TurkishDeasciifyForce() .. '_'", "force turkish characters eol", + { expr = true }) + + -- use turkish-mode to selectively deasciify + map({ "n", "x" }, "tr", "TurkishDeasciify()", "infer turkish characters", { expr = true }) + map("n", "trtr", "TurkishDeasciify() .. '_'", "infer turkish characters eol", + { expr = true }) + + -- ascii everything + map({ "n", "x" }, "rt", "TurkishAsciify()", "remove turkish characters", { expr = true }) + map("n", "rtrt", "TurkishAsciify() .. '_'", "remove turkish characters eol", + { expr = true }) + end, + } +} diff --git a/.config/nvim/lua/plugins/vimwiki.lua b/.config/nvim/lua/plugins/vimwiki.lua new file mode 100644 index 0000000..11d4c2b --- /dev/null +++ b/.config/nvim/lua/plugins/vimwiki.lua @@ -0,0 +1,28 @@ +return { + { + "vimwiki/vimwiki", + init = function () + vim.g.vimwiki_list = { + { + path = '/home/yigit/nextcloud/personal_wiki/text', + path_html = '/home/yigit/nextcloud/personal_wiki/html', + auto_generate_tags = 1, + automatic_nested_syntaxes = 1, + template_path = '/home/yigit/nextcloud/personal_wiki/templates', + template_default = 'default_template', + template_ext = '.html', + auto_export = 1, + auto_tags = 1 + } + } + vim.g.vimwiki_hl_headers = 1 + + local map = require("helpers.keys").map + + --toggle checkmarks + map('n', 'v', 'VimwikiToggleListItem', "vimwiki: toggle checkmark") + -- add/increase header level + map('n', 'a', 'VimwikiAddHeaderLevel', "vimwiki: add header level") + end, + }, +} diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..21048b9 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,14 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + config = function() + local wk = require("which-key") + wk.setup() + end, + } +} -- cgit v1.2.3-70-g09d2