Advertisement
Guest User

init.lua

a guest
Sep 2nd, 2023
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.29 KB | Source Code | 0 0
  1. local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
  2. if not vim.loop.fs_stat(lazypath) then
  3.     vim.fn.system({
  4.         "git",
  5.         "clone",
  6.         "--filter=blob:none",
  7.         "https://github.com/folke/lazy.nvim.git",
  8.         "--branch=stable", -- latest stable release
  9.         lazypath,
  10.     })
  11. end
  12. vim.opt.rtp:prepend(lazypath)
  13.  
  14. -- option
  15. vim.opt.background = dark
  16. vim.opt.number = true
  17. vim.opt.shell = "fish"
  18. vim.opt.wrap = false
  19. vim.opt.title = true
  20. vim.opt.termguicolors = true
  21. vim.opt.list = true
  22. vim.opt.listchars:append("space:⋅")
  23. vim.opt.listchars:append("eol:↴")
  24. vim.opt.clipboard = "unnamedplus"
  25. vim.g.mapleader = " "
  26. vim.g.loaded_netrw = 1
  27. vim.g.loaded_netrwPlugin = 1
  28. vim.g.markdown_fenced_languages = {
  29.     "ts=typescript",
  30. }
  31.  
  32. vim.wo.number = true
  33.  
  34. -- keymap
  35. local keymap = vim.keymap
  36. -- increase/decrease
  37. keymap.set("n", "<C-+>", "<C-a>")
  38. keymap.set("n", "<C-->", "<C-x>")
  39.  
  40. --select all
  41. keymap.set("n", "<C-a>", "gg<S-v>G")
  42.  
  43. -- new tab
  44. keymap.set("n", "<C-n>", ":tabedit")
  45.  
  46. --move window
  47. keymap.set("n", "<space>ww", "<C-w>w")
  48.  
  49. keymap.set("n", "<Tab>", "<Cmd>BufferLineCycleNext<CR>", {})
  50. keymap.set("n", "<S-Tab>", "<Cmd>BufferLineCyclePrev<CR>", {})
  51. keymap.set("n", "<leader>c", "<cmd>e .config/nvim/init.lua<CR>", {})
  52. --plugin
  53. require("lazy").setup({
  54.     {
  55.         "nvim-neorg/neorg", --taking note
  56.         build = ":Neorg sync-parsers",
  57.         dependencies = { "nvim-lua/plenary.nvim" },
  58.         config = function()
  59.             require("neorg").setup({
  60.                 load = {
  61.                     ["core.defaults"] = {}, -- Loads default behaviour
  62.                     ["core.concealer"] = {}, -- Adds pretty icons to your documents
  63.                     ["core.dirman"] = { -- Manages Neorg workspaces
  64.                         config = {
  65.                             workspaces = {
  66.                                 notes = "~/notes",
  67.                             },
  68.                         },
  69.                     },
  70.                 },
  71.             })
  72.         end,
  73.     },
  74.     {
  75.         "VonHeikemen/lsp-zero.nvim",
  76.         branch = "v1.x",
  77.         dependencies = {
  78.             -- LSP Support
  79.             { "neovim/nvim-lspconfig" },
  80.             { "williamboman/mason.nvim" },
  81.             { "williamboman/mason-lspconfig.nvim" },
  82.  
  83.             -- Autocompletion
  84.             { "hrsh7th/nvim-cmp" },
  85.             { "hrsh7th/cmp-buffer" },
  86.             { "hrsh7th/cmp-path" },
  87.             { "saadparwaiz1/cmp_luasnip" },
  88.             { "hrsh7th/cmp-nvim-lsp" },
  89.             { "hrsh7th/cmp-nvim-lua" },
  90.  
  91.             -- Snippets
  92.             { "L3MON4D3/LuaSnip" },
  93.             { "rafamadriz/friendly-snippets" },
  94.         },
  95.     },
  96.     { "nvimdev/guard.nvim", lazy = false },
  97.  
  98.     {
  99.         "williamboman/mason.nvim",
  100.         lazy = false,
  101.         config = function()
  102.             require("mason").setup()
  103.         end,
  104.     },
  105.  
  106.     {
  107.         "williamboman/mason-lspconfig.nvim",
  108.         lazy = false,
  109.         config = function()
  110.             require("mason-lspconfig")
  111.         end,
  112.     },
  113.     {
  114.         "nvim-treesitter/nvim-treesitter",
  115.         build = ":TSUpdate",
  116.         config = function()
  117.             local configs = require("nvim-treesitter.configs")
  118.             configs.setup({
  119.                 ensure_installed = { "lua", "javascript", "java", "html", "python" },
  120.                 sync_install = false,
  121.                 highlight = { enable = true },
  122.                 indent = { enable = true },
  123.             })
  124.         end,
  125.     },
  126.     {
  127.         "folke/noice.nvim", -- noice
  128.         event = "VeryLazy",
  129.         config = function()
  130.             require("noice").setup({
  131.                 lsp = {
  132.                     -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
  133.                     override = {
  134.                         ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
  135.                         ["vim.lsp.util.stylize_markdown"] = true,
  136.                         ["cmp.entry.get_documentation"] = true,
  137.                     },
  138.                 },
  139.                 -- you can enable a preset for easier configuration
  140.                 presets = {
  141.                     bottom_search = true, -- use a classic bottom cmdline for search
  142.                     command_palette = true, -- position the cmdline and popupmenu together
  143.                     long_message_to_split = true, -- long messages will be sent to a split
  144.                     inc_rename = false, -- enables an input dialog for inc-rename.nvim
  145.                     lsp_doc_border = false, -- add a border to hover docs and signature help
  146.                 },
  147.             })
  148.         end,
  149.         dependencies = {
  150.             "MunifTanjim/nui.nvim",
  151.             -- OPTIONAL:
  152.             --   `nvim-notify` is only needed, if you want to use the notification view.
  153.             --   If not available, we use `mini` as the fallback
  154.             "rcarriga/nvim-notify",
  155.         },
  156.     },
  157.     {
  158.         "akinsho/bufferline.nvim",
  159.         version = "*",
  160.         config = function()
  161.             require("bufferline").setup({
  162.                 options = {
  163.                     mode = "tabs",
  164.                     separator_style = "slant",
  165.                     always_show_bufferline = false,
  166.                     show_buffer_close_icons = false,
  167.                     show_close_icon = false,
  168.                     color_icons = true,
  169.                 },
  170.                 highlights = {
  171.                     separator = {
  172.                         fg = "#073642",
  173.                         bg = "#002b36",
  174.                     },
  175.                     separator_selected = {
  176.                         fg = "#073642",
  177.                     },
  178.                     background = {
  179.                         fg = "#657b83",
  180.                         bg = "#002b36",
  181.                     },
  182.                     buffer_selected = {
  183.                         fg = "#fdf6e3",
  184.                         bold = true,
  185.                     },
  186.                     fill = {
  187.                         bg = "#073642",
  188.                     },
  189.                 },
  190.             })
  191.         end,
  192.         dependencies = "nvim-tree/nvim-web-devicons",
  193.     }, --bufferline
  194.     {
  195.         "echasnovski/mini.indentscope",
  196.         lazy = false,
  197.         version = "*", -- wait till new 0.7.0 release to put it back on semver
  198.         event = { "BufReadPre", "BufNewFile" },
  199.         opts = {
  200.             symbol = "│",
  201.             options = { try_as_border = true },
  202.         },
  203.         init = function()
  204.             vim.api.nvim_create_autocmd("FileType", {
  205.                 pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
  206.                 callback = function()
  207.                     vim.b.miniindentscope_disable = true
  208.                 end,
  209.             })
  210.         end,
  211.     },
  212.     {
  213.         "rcarriga/nvim-notify",
  214.         config = function()
  215.             require("notify").setup({
  216.                 background_color = "#000000",
  217.             })
  218.         end,
  219.     },
  220.     {
  221.         "pwntester/nautilus.nvim",
  222.         lazy = false,
  223.         config = function()
  224.             vim.cmd([[colorscheme nautilus]])
  225.         end,
  226.     },
  227.     {
  228.         "goolord/alpha-nvim",
  229.         config = function()
  230.             require("alpha").setup(require("alpha.themes.dashboard").config)
  231.         end,
  232.     },
  233.     {
  234.         "nvim-tree/nvim-tree.lua",
  235.         keys = {
  236.             { "<space>e", "<cmd>NvimTreeFocus<cr>", desc = "focus nvim-tree" },
  237.             { "<C-n>", "<cmd>NvimTreeToggle<cr>", desc = "toggle nvim-tree" },
  238.         },
  239.         config = function()
  240.             require("nvim-tree").setup({
  241.                 filters = {
  242.                     dotfiles = false,
  243.                     exclude = { vim.fn.stdpath("config") .. "/lua/custom" },
  244.                 },
  245.                 disable_netrw = true,
  246.                 hijack_netrw = true,
  247.                 hijack_cursor = true,
  248.                 hijack_unnamed_buffer_when_opening = false,
  249.                 sync_root_with_cwd = true,
  250.                 update_focused_file = {
  251.                     enable = true,
  252.                     update_root = false,
  253.                 },
  254.                 view = {
  255.                     adaptive_size = false,
  256.                     side = "left",
  257.                     width = 30,
  258.                     preserve_window_proportions = true,
  259.                 },
  260.                 git = {
  261.                     enable = false,
  262.                     ignore = true,
  263.                 },
  264.                 filesystem_watchers = {
  265.                     enable = true,
  266.                 },
  267.                 actions = {
  268.                     open_file = {
  269.                         resize_window = true,
  270.                     },
  271.                 },
  272.                 renderer = {
  273.                     root_folder_label = false,
  274.                     highlight_git = false,
  275.                     highlight_opened_files = "none",
  276.  
  277.                     indent_markers = {
  278.                         enable = false,
  279.                     },
  280.  
  281.                     icons = {
  282.                         show = {
  283.                             file = true,
  284.                             folder = true,
  285.                             folder_arrow = true,
  286.                             git = false,
  287.                         },
  288.  
  289.                         glyphs = {
  290.                             default = "󰈚",
  291.                             symlink = "",
  292.                             folder = {
  293.                                 default = "",
  294.                                 empty = "",
  295.                                 empty_open = "",
  296.                                 open = "",
  297.                                 symlink = "",
  298.                                 symlink_open = "",
  299.                                 arrow_open = "",
  300.                                 arrow_closed = "",
  301.                             },
  302.                             git = {
  303.                                 unstaged = "✗",
  304.                                 staged = "✓",
  305.                                 unmerged = "",
  306.                                 renamed = "➜",
  307.                                 untracked = "★",
  308.                                 deleted = "",
  309.                                 ignored = "◌",
  310.                             },
  311.                         },
  312.                     },
  313.                 },
  314.             })
  315.         end,
  316.     },
  317.     {
  318.         "windwp/nvim-autopairs",
  319.         event = "InsertEnter",
  320.         opts = {},
  321.     },
  322.     {
  323.         "sudormrfbin/cheatsheet.nvim",
  324.  
  325.         dependencies = {
  326.             "nvim-telescope/telescope.nvim",
  327.             "nvim-lua/popup.nvim",
  328.             "nvim-lua/plenary.nvim",
  329.         },
  330.         keys = { "<C-e>", "<cmd>Cheatsheet<cr>", desc = "toggle cheatsheet" },
  331.     },
  332.     {
  333.         "MaximilianLloyd/ascii.nvim",
  334.         dependencies = { "MunifTanjim/nui.nvim" },
  335.     },
  336.     {
  337.         "nvim-telescope/telescope.nvim",
  338.         lazy = false,
  339.         tag = "0.1.2",
  340.         dependencies = { "nvim-lua/plenary.nvim" },
  341.     },
  342.     {
  343.         "folke/which-key.nvim",
  344.         event = "VeryLazy",
  345.         keys = { "<leader>", "<cmd>WhickKey<cr>", desc = "toggle whichkey" },
  346.         init = function()
  347.             vim.o.timeout = true
  348.             vim.o.timeoutlen = 300
  349.         end,
  350.         opts = {
  351.             -- your configuration comes here
  352.             -- or leave it empty to use the default settings
  353.             -- refer to the configuration section below
  354.         },
  355.     },
  356. })
  357.  
Tags: nvim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement