aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2023-08-22 19:43:07 +0100
committerJustine Smithies <justine@smithies.me.uk>2023-08-22 19:43:07 +0100
commit86c0c3694c93025dfec23f27266905c12f446a4e (patch)
tree32ee6e5cc84b6e2962a998d788554cb984fb7a8e /.config/nvim
parent3058d6df77817de298a207d36b8b0871893c417a (diff)
Initial commit
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua4
-rw-r--r--.config/nvim/lua/base.lua73
-rw-r--r--.config/nvim/lua/mapping.lua23
-rw-r--r--.config/nvim/lua/plugins.lua129
-rw-r--r--.config/nvim/lua/pluginsconfig/Comment.lua1
-rw-r--r--.config/nvim/lua/pluginsconfig/alpha.lua126
-rw-r--r--.config/nvim/lua/pluginsconfig/colorizer.lua12
-rw-r--r--.config/nvim/lua/pluginsconfig/gruvbox.lua21
-rw-r--r--.config/nvim/lua/pluginsconfig/indent-blankline.lua6
-rw-r--r--.config/nvim/lua/pluginsconfig/init.lua22
-rw-r--r--.config/nvim/lua/pluginsconfig/lsp_lines.lua6
-rw-r--r--.config/nvim/lua/pluginsconfig/lualine.lua53
-rw-r--r--.config/nvim/lua/pluginsconfig/mason-lspconfig.lua1
-rw-r--r--.config/nvim/lua/pluginsconfig/mason.lua2
-rw-r--r--.config/nvim/lua/pluginsconfig/nvim-cmp.lua87
-rw-r--r--.config/nvim/lua/pluginsconfig/nvim-lspconfig.lua10
-rw-r--r--.config/nvim/lua/pluginsconfig/nvim-tree.lua10
-rw-r--r--.config/nvim/lua/pluginsconfig/telescope.lua68
-rw-r--r--.config/nvim/lua/pluginsconfig/treesitter.lua18
-rw-r--r--.config/nvim/lua/pluginsconfig/undotree.lua23
20 files changed, 695 insertions, 0 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..20dd1dd
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,4 @@
+require "base"
+require "plugins"
+require "mapping"
+require "pluginsconfig"
diff --git a/.config/nvim/lua/base.lua b/.config/nvim/lua/base.lua
new file mode 100644
index 0000000..9cb6f23
--- /dev/null
+++ b/.config/nvim/lua/base.lua
@@ -0,0 +1,73 @@
+vim.opt.encoding = "utf-8" -- Set encoding to utf-8
+vim.opt.number = true -- Shownumber = true -- Show line numbers on the sidebar
+vim.opt.clipboard = "unnamedplus" -- Copy paste between vim and everything else
+vim.opt.hlsearch = true --Highlight search results
+vim.opt.incsearch = true -- Incremental search
+vim.opt.ignorecase = true -- Search ignoring case
+vim.opt.smartcase = true -- Do not ignore case if the search pattern has uppercase
+vim.opt.splitbelow = true -- Split below current window
+vim.opt.splitright = true -- Split window to the right
+vim.opt.cursorline = true -- Highlight the active cursor line
+
+-- Set the undo directory
+local prefix = vim.env.XDG_CONFIG_HOME or vim.fn.expand("~/.config")
+vim.opt.undodir = { prefix .. "/nvim/undodir//"}
+vim.opt.undofile = true
+
+vim.opt.termguicolors = true -- Enable 24-bit colors on terminal
+vim.opt.wildmenu = true -- Enable wildmenu
+vim.opt.wildmode = 'longest,list,full'
+vim.opt.syntax = "ON" -- Allow syntax highlighting
+vim.opt.completeopt = { "menuone", "noinsert" }
+
+
+local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
+
+-- Remove end of buffer ~ on buffer enter
+autocmd('BufEnter', {
+ pattern = '*',
+ command = "let &fcs='eob: '"
+})
+
+-- Turn off line numbers on entering terminal
+autocmd('TermOpen', {
+ pattern = '*',
+ command = 'setlocal nonumber norelativenumber'
+})
+
+-- Insert mode on entering terminal
+autocmd('TermOpen', {
+ pattern = '*',
+ command = 'startinsert'
+})
+
+-- Close terminal buffer on process exit
+autocmd('BufLeave', {
+ pattern = 'term://*',
+ command = 'stopinsert'
+})
+
+-- Close terminal buffer on process exit
+autocmd('TermClose', {
+ pattern = 'term://*',
+ command = 'call nvim_input("<CR>")'
+})
+
+-- Open Alpha if last buffer is closed ( Uses Bdelete and Bwipeout )
+vim.api.nvim_create_augroup("alpha_on_empty", { clear = true })
+vim.api.nvim_create_autocmd("User", {
+ pattern = "BDeletePost*",
+ group = "alpha_on_empty",
+ callback = function(event)
+ local fallback_name = vim.api.nvim_buf_get_name(event.buf)
+ local fallback_ft = vim.api.nvim_buf_get_option(event.buf, "filetype")
+ local fallback_on_empty = fallback_name == "" and fallback_ft == ""
+
+ if fallback_on_empty then
+ vim.cmd("NvimTreeClose")
+ vim.cmd("TagbarClose")
+ vim.cmd("Alpha")
+ vim.cmd(event.buf .. "bwipeout")
+ end
+ end,
+})
diff --git a/.config/nvim/lua/mapping.lua b/.config/nvim/lua/mapping.lua
new file mode 100644
index 0000000..d454eec
--- /dev/null
+++ b/.config/nvim/lua/mapping.lua
@@ -0,0 +1,23 @@
+function map(mode, lhs, rhs, opts)
+ local options = { noremap = true }
+ if opts then
+ options = vim.tbl_extend("force", options, opts)
+ end
+ vim.api.nvim_set_keymap(mode, lhs, rhs, options)
+end
+
+-- Toggle line numbers
+map("n", "<F4>", "<cmd>:set number!<cr>", { silent = true })
+-- Toggle IndentBlankline
+map("n", "<F5>", "<cmd>:IndentBlanklineToggle<cr>", { silent = true })
+-- Toggle Undotree
+map("n", "<F6>", "<cmd>:lua require('undotree').toggle()<cr>", { silent = true })
+-- Toggle Nvim Tree
+map("n", "<F7>", "<cmd>NvimTreeToggle<cr> <cmd>NvimTreeRefresh<cr>", { silent = true })
+-- Toggle Tagbar
+map("n", "<F8>", "<cmd>:TagbarToggle<cr>", { silent = true })
+-- Toggle Tagbar
+map("n", "<F8>", "<cmd>:TagbarToggle<cr>", { silent = true })
+-- Toggle lsp_lines
+vim.keymap.set("", "<F12>", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" })
+
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
new file mode 100644
index 0000000..218afa6
--- /dev/null
+++ b/.config/nvim/lua/plugins.lua
@@ -0,0 +1,129 @@
+local fn = vim.fn
+local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
+if fn.empty(fn.glob(install_path)) > 0 then
+ packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
+ vim.cmd [[packadd packer.nvim]]
+end
+
+return require('packer').startup({function(use)
+ -- Setup Packer
+ use {"wbthomason/packer.nvim"}
+
+ -- Nvim tree
+ use {
+ "kyazdani42/nvim-tree.lua",
+ requires = {
+ "kyazdani42/nvim-web-devicons",
+ },
+ }
+
+ -- LSP
+ use {
+ "williamboman/mason.nvim",
+ }
+
+ use {
+ "williamboman/mason-lspconfig.nvim",
+ }
+
+ use {
+ "neovim/nvim-lspconfig",
+ }
+
+ -- Gruvbox theme
+ use {
+ "ellisonleao/gruvbox.nvim",
+ }
+
+ -- Lualine
+ use {
+ 'nvim-lualine/lualine.nvim',
+ requires = { 'kyazdani42/nvim-web-devicons', opt = true },
+ }
+
+ -- Treesitter
+ use {
+ 'nvim-treesitter/nvim-treesitter',
+ run = function()
+ local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
+ ts_update()
+ end,
+ }
+ -- Colorizer
+ use {
+ 'norcalli/nvim-colorizer.lua',
+ }
+
+ -- Tag Viewer
+ use 'preservim/tagbar'
+
+ -- Alpha
+ use {
+ 'goolord/alpha-nvim',
+ requires = { 'BlakeJC94/alpha-nvim-fortune', opt = true },
+ }
+
+ -- Completion
+ use {
+ 'hrsh7th/nvim-cmp',
+ }
+
+ use 'hrsh7th/cmp-nvim-lsp'
+ use 'L3MON4D3/LuaSnip' -- Snippets plugin
+
+ -- cmp sources --
+ use "hrsh7th/cmp-nvim-lua"
+ use "hrsh7th/cmp-buffer"
+ use "hrsh7th/cmp-path"
+ use "hrsh7th/cmp-cmdline"
+
+ -- Telescope
+ use {
+ "nvim-telescope/telescope.nvim",
+ requires = {
+ "nvim-lua/plenary.nvim",
+ },
+ }
+
+ -- Indent-blankline
+ use {
+ "lukas-reineke/indent-blankline.nvim",
+ }
+
+ -- Undotree
+ use {
+ "jiaoshijie/undotree",
+ requires = {
+ "nvim-lua/plenary.nvim",
+ },
+ }
+
+ -- Comment
+ use {
+ 'numToStr/Comment.nvim',
+ }
+
+ -- lsp_lines
+ use {
+ "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
+ }
+
+ -- Comment
+ use {
+ 'famiu/bufdelete.nvim',
+ }
+
+ -- Automatically set up your configuration after cloning packer.nvim
+ -- Put this at the end after all plugins
+ if packer_bootstrap then
+ require('packer').sync()
+ end
+end,
+config = {
+ display = {
+ open_fn = function()
+ return require('packer.util').float({ border = 'single' })
+ end,
+ },
+}
+})
diff --git a/.config/nvim/lua/pluginsconfig/Comment.lua b/.config/nvim/lua/pluginsconfig/Comment.lua
new file mode 100644
index 0000000..a844323
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/Comment.lua
@@ -0,0 +1 @@
+require('Comment').setup()
diff --git a/.config/nvim/lua/pluginsconfig/alpha.lua b/.config/nvim/lua/pluginsconfig/alpha.lua
new file mode 100644
index 0000000..5adcc50
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/alpha.lua
@@ -0,0 +1,126 @@
+local present, alpha = pcall(require, 'alpha')
+
+if not present then
+ return
+end
+
+local dashboard = require('alpha.themes.dashboard')
+local fortune = require('alpha.fortune')
+
+local logo = {
+ type = 'text',
+ val = {
+ ' ',
+ ' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ',
+ ' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ',
+ ' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ',
+ ' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ',
+ ' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ',
+ ' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ',
+ },
+ opts = {
+ position = 'center',
+ hl = 'DevIconDart',
+ },
+}
+
+local function info_value()
+ local total_plugins = " Total plugins " .. vim.fn.len(vim.fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
+ local datetime = os.date(' %d-%m-%Y')
+ local version = vim.version()
+ local nvim_version_info = '  v' .. version.major .. '.' .. version.minor .. '.' .. version.patch
+
+ return datetime .. nvim_version_info .. ' ' .. total_plugins
+end
+
+local info = {
+ type = 'text',
+ val = info_value(),
+ opts = {
+ hl = 'DevIconVimrc',
+ position = 'center',
+ },
+}
+
+local message = {
+ type = 'text',
+ val = fortune({ max_width = 60 }),
+ opts = {
+ position = 'center',
+ hl = 'SpecialComment',
+ },
+}
+
+local header = {
+ type = 'group',
+ val = {
+ logo,
+ info,
+ },
+}
+
+local buttons = {
+ type = 'group',
+ val = {
+ {
+ type = 'text',
+ val = 'Actions',
+ opts = {
+ hl = 'String',
+ shrink_margin = false,
+ position = 'center',
+ },
+ },
+ { type = 'padding', val = 1 },
+ dashboard.button("f", " " .. " Find file", ":Telescope find_files hidden=true no_ignore=true <CR>"),
+ dashboard.button("e", " " .. " New file", ":ene <BAR> startinsert <CR>"),
+ dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles <CR>"),
+ dashboard.button("t", " " .. " Find text", "<cmd>lua require('telescope.builtin').live_grep({shorten_path=true})<CR>"),
+ dashboard.button(
+ 'd',
+ ' Dotfiles',
+ "<cmd>lua require('telescope.builtin').find_files({ search_dirs = { os.getenv('HOME') .. '/.config' } })<CR>"
+ ),
+ dashboard.button("u", " " .. " Update plugins", ":PackerSync<CR>"),
+ dashboard.button("q", " " .. " Quit", ":qa<CR>"),
+ },
+ opts = {
+ position = 'center',
+ },
+}
+
+local config = {
+ layout = {
+ { type = 'padding', val = 5 },
+ header,
+ { type = 'padding', val = 5 },
+ buttons,
+ { type = 'padding', val = 1 },
+ message,
+ },
+ opts = {
+ setup = function()
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'AlphaReady',
+ desc = 'disable status, tabline and cmdline for alpha',
+ callback = function()
+ vim.go.laststatus = 0
+ vim.opt.showtabline = 0
+ vim.opt.cmdheight = 0
+ end,
+ })
+ vim.api.nvim_create_autocmd('BufUnload', {
+ buffer = 0,
+ desc = 'enable status, tabline and cmdline after alpha',
+ callback = function()
+ vim.go.laststatus = 2
+ vim.opt.showtabline = 2
+ vim.opt.cmdheight = 1
+ end,
+ })
+ end,
+ margin = 5,
+ },
+}
+
+alpha.setup(config)
diff --git a/.config/nvim/lua/pluginsconfig/colorizer.lua b/.config/nvim/lua/pluginsconfig/colorizer.lua
new file mode 100644
index 0000000..2ad4f6e
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/colorizer.lua
@@ -0,0 +1,12 @@
+ require('colorizer').setup({ '*' }, {
+ RGB = true, -- #RGB hex codes
+ RRGGBB = true, -- #RRGGBB hex codes
+ names = true, -- "Name" codes like Blue
+ RRGGBBAA = true, -- #RRGGBBAA hex codes
+ rgb_fn = true, -- CSS rgb() and rgba() functions
+ hsl_fn = true, -- CSS hsl() and hsla() functions
+ css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+ css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
+ mode = 'background', -- Set the display mode. background / foreground
+ })
+
diff --git a/.config/nvim/lua/pluginsconfig/gruvbox.lua b/.config/nvim/lua/pluginsconfig/gruvbox.lua
new file mode 100644
index 0000000..08e42c7
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/gruvbox.lua
@@ -0,0 +1,21 @@
+require("gruvbox").setup({
+ undercurl = true,
+ underline = true,
+ bold = true,
+ italic = {
+ strings = true,
+ comments =true,
+ operators = false,
+ folds =true,
+ },
+ strikethrough = true,
+ invert_selection = false,
+ invert_signs = false,
+ invert_tabline = false,
+ invert_intend_guides = false,
+ inverse = true, -- invert background for search, diffs, statuslines and errors
+ contrast = "", -- can be "hard", "soft" or empty string
+ overrides = {},
+})
+vim.cmd("colorscheme gruvbox")
+vim.api.nvim_set_hl(0, "Normal", {guibg = NONE, ctermbg = NONE})
diff --git a/.config/nvim/lua/pluginsconfig/indent-blankline.lua b/.config/nvim/lua/pluginsconfig/indent-blankline.lua
new file mode 100644
index 0000000..d53bf41
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/indent-blankline.lua
@@ -0,0 +1,6 @@
+
+require("indent_blankline").setup {
+ enabled = false, -- Don't enable plugin at Nvim start
+ show_current_context = true,
+ show_current_context_start = false,
+}
diff --git a/.config/nvim/lua/pluginsconfig/init.lua b/.config/nvim/lua/pluginsconfig/init.lua
new file mode 100644
index 0000000..0d2edb7
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/init.lua
@@ -0,0 +1,22 @@
+local plugins = {
+ 'nvim-tree',
+ 'mason',
+ 'mason-lspconfig',
+ 'gruvbox',
+ 'lualine',
+ 'treesitter',
+ 'colorizer',
+ 'nvim-cmp',
+ 'telescope',
+ 'indent-blankline',
+ 'undotree',
+ 'Comment',
+ 'nvim-lspconfig',
+ 'lsp_lines',
+ 'alpha',
+}
+
+for _, plugin in ipairs(plugins) do
+ pcall(require, "pluginsconfig." .. plugin)
+end
+
diff --git a/.config/nvim/lua/pluginsconfig/lsp_lines.lua b/.config/nvim/lua/pluginsconfig/lsp_lines.lua
new file mode 100644
index 0000000..8a0b7ae
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/lsp_lines.lua
@@ -0,0 +1,6 @@
+require('lsp_lines').setup {}
+vim.diagnostic.config({
+ virtual_lines = false,
+ virtual_text = false,
+ underline = false,
+})
diff --git a/.config/nvim/lua/pluginsconfig/lualine.lua b/.config/nvim/lua/pluginsconfig/lualine.lua
new file mode 100644
index 0000000..a985762
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/lualine.lua
@@ -0,0 +1,53 @@
+require('lualine').setup {
+ options = {
+ icons_enabled = true,
+ theme = 'powerline',
+ component_separators = { left = '', right = ''},
+ section_separators = { left = '', right = ''},
+ disabled_filetypes = { 'packer', 'NvimTree',
+ statusline = {},
+ winbar = {},
+ },
+ ignore_focus = {},
+ always_divide_middle = true,
+ globalstatus = false,
+ refresh = {
+ statusline = 1000,
+ tabline = 1000,
+ winbar = 1000,
+ }
+ },
+ sections = {
+ lualine_a = {'mode'},
+ lualine_b = {'branch', 'diff', 'diagnostics'},
+ lualine_c = {'filename'},
+ lualine_x = {'encoding', 'fileformat', 'filetype'},
+ lualine_y = {'progress'},
+ lualine_z = {'location'}
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = {'filename'},
+ lualine_x = {'location'},
+ lualine_y = {},
+ lualine_z = {}
+ },
+ tabline = {
+ lualine_a = {
+ { 'buffers',
+ symbols = {
+ modified = ' ●', -- Text to show when the buffer is modified
+ alternate_file = '', -- Text to show to identify the alternate filename
+ directory = '', -- Text to show when the buffer is a directory
+ },
+ filetype_names = {
+ NvimTree = 'NvimTree',
+ }, -- Shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
+ },
+ },
+},
+ winbar = {},
+ inactive_winbar = {},
+ extensions = {},
+}
diff --git a/.config/nvim/lua/pluginsconfig/mason-lspconfig.lua b/.config/nvim/lua/pluginsconfig/mason-lspconfig.lua
new file mode 100644
index 0000000..979a3f1
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/mason-lspconfig.lua
@@ -0,0 +1 @@
+require("mason-lspconfig").setup()
diff --git a/.config/nvim/lua/pluginsconfig/mason.lua b/.config/nvim/lua/pluginsconfig/mason.lua
new file mode 100644
index 0000000..10e56e5
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/mason.lua
@@ -0,0 +1,2 @@
+require("mason").setup()
+
diff --git a/.config/nvim/lua/pluginsconfig/nvim-cmp.lua b/.config/nvim/lua/pluginsconfig/nvim-cmp.lua
new file mode 100644
index 0000000..34ec756
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/nvim-cmp.lua
@@ -0,0 +1,87 @@
+ -- Setup nvim-cmp.
+ local present, cmp = pcall(require, 'cmp')
+
+if not present then
+ return
+end
+
+ cmp.setup({
+ snippet = {
+ -- REQUIRED - you must specify a snippet engine
+ expand = function(args)
+ -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
+ require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
+ -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
+ -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
+ end,
+ },
+ window = {
+ -- completion = cmp.config.window.bordered(),
+ -- documentation = cmp.config.window.bordered(),
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ -- { name = 'vsnip' }, -- For vsnip users.
+ { name = 'luasnip' }, -- For luasnip users.
+ -- { name = 'ultisnips' }, -- For ultisnips users.
+ -- { name = 'snippy' }, -- For snippy users.
+ }, {
+ { name = 'buffer' },
+ { name = 'path' },
+ { name = 'cmdline' },
+ { name = 'nvim_lua' },
+ })
+ })
+
+ -- Set configuration for specific filetype.
+ cmp.setup.filetype('gitcommit', {
+ sources = cmp.config.sources({
+ { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
+ }, {
+ { name = 'buffer' },
+ })
+ })
+
+ -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
+ cmp.setup.cmdline('/', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = 'buffer' }
+ }
+ })
+
+ -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+ cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = 'path' }
+ }, {
+ { name = 'cmdline' }
+ })
+ })
+
+ -- Setup lspconfig.
+ local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
+ -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
+ --require('lspconfig')['pyright'].setup {
+ -- capabilities = capabilities
+ --}
+ --require('lspconfig')['bashls'].setup {
+ -- capabilities = capabilities
+ --}
+ local lspconfig = require "lspconfig"
+ local servers = { "pyright", "pylsp", "bashls", "lua_ls", "vimls"}
+
+ for _, lsp in ipairs(servers) do
+ lspconfig[lsp].setup {
+ on_attach = on_attach,
+ capabilities = capabilities,
+ }
+ end
diff --git a/.config/nvim/lua/pluginsconfig/nvim-lspconfig.lua b/.config/nvim/lua/pluginsconfig/nvim-lspconfig.lua
new file mode 100644
index 0000000..746ccf6
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/nvim-lspconfig.lua
@@ -0,0 +1,10 @@
+require'lspconfig'.lua_ls.setup {
+ settings = {
+ Lua = {
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {'vim'},
+ },
+ },
+ },
+}
diff --git a/.config/nvim/lua/pluginsconfig/nvim-tree.lua b/.config/nvim/lua/pluginsconfig/nvim-tree.lua
new file mode 100644
index 0000000..71ebbf2
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/nvim-tree.lua
@@ -0,0 +1,10 @@
+local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
+
+Close nvim-tree if last window remaining
+autocmd('BufEnter', {
+ pattern = '*',
+ command = 'if (winnr("$") ==1 && &filetype == "nvimtree") | q | endif'
+})
+
+require('nvim-tree').setup {
+}
diff --git a/.config/nvim/lua/pluginsconfig/telescope.lua b/.config/nvim/lua/pluginsconfig/telescope.lua
new file mode 100644
index 0000000..27bd252
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/telescope.lua
@@ -0,0 +1,68 @@
+local present, telescope = pcall(require, "telescope")
+
+if not present then
+ return
+end
+
+telescope.setup {
+ picker = {
+ hidden = false,
+ },
+ defaults = {
+ vimgrep_arguments = {
+ "rg",
+ "--color=never",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ "--no-ignore",
+ "--smart-case",
+ "--hidden",
+ },
+ prompt_prefix = "  ",
+ selection_caret = " ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "ascending",
+ layout_strategy = "horizontal",
+ layout_config = {
+ horizontal = {
+ prompt_position = "top",
+ preview_width = 0.55,
+ results_width = 0.8,
+ },
+ vertical = {
+ mirror = false,
+ },
+ width = 0.87,
+ height = 0.80,
+ preview_cutoff = 120,
+ },
+ file_sorter = require("telescope.sorters").get_fuzzy_file,
+ file_ignore_patterns = { "node_modules", ".git/", "dist/" },
+ generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
+ path_display = { "absolute" },
+ winblend = 0,
+ border = {},
+ borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
+ color_devicons = true,
+ use_less = true,
+ set_env = { ["COLORTERM"] = "truecolor" },
+ file_previewer = require("telescope.previewers").vim_buffer_cat.new,
+ grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
+ qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
+ buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
+ },
+ extensions = {
+ fzf = {
+ fuzzy = true,
+ override_generic_sorter = true,
+ override_file_sorter = true,
+ case_mode = "smart_case",
+ },
+ },
+}
+
+--telescope.load_extension "fzf"
diff --git a/.config/nvim/lua/pluginsconfig/treesitter.lua b/.config/nvim/lua/pluginsconfig/treesitter.lua
new file mode 100644
index 0000000..feb1f5c
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/treesitter.lua
@@ -0,0 +1,18 @@
+local present, treesitter = pcall(require, "nvim-treesitter.configs")
+
+if not present then
+ return
+end
+
+treesitter.setup {
+ autotag = {
+ enable = true,
+ },
+ ensure_installed = "lua",
+ highlight = {
+ enable = true,
+ },
+ enable = true,
+ extended_mode = true,
+ max_file_lines = nil,
+ }
diff --git a/.config/nvim/lua/pluginsconfig/undotree.lua b/.config/nvim/lua/pluginsconfig/undotree.lua
new file mode 100644
index 0000000..72e342a
--- /dev/null
+++ b/.config/nvim/lua/pluginsconfig/undotree.lua
@@ -0,0 +1,23 @@
+local present, undotree = pcall(require, "undotree")
+
+if not present then
+ return
+end
+
+undotree.setup({
+ float_diff = true, -- using float window previews diff, set this `true` will disable layout option
+ layout = "left_bottom", -- "left_bottom", "left_left_bottom"
+ ignore_filetype = { 'Undotree', 'UndotreeDiff', 'qf', 'TelescopePrompt', 'spectre_panel', 'tsplayground' },
+ window = {
+ winblend = 0,
+ },
+ keymaps = {
+ ['j'] = "move_next",
+ ['k'] = "move_prev",
+ ['J'] = "move_change_next",
+ ['K'] = "move_change_prev",
+ ['<cr>'] = "action_enter",
+ ['p'] = "enter_diffbuf",
+ ['q'] = "quit",
+ },
+})