From afbf49f0a65a0ea77ecba455f17f592efe3089d8 Mon Sep 17 00:00:00 2001 From: Leander <80996591+m0ntagur@users.noreply.github.com> Date: Sat, 13 Aug 2022 00:27:04 +0200 Subject: Add files via upload --- autopairs.lua | 6 +++ autotag.lua | 4 ++ cmp.lua | 34 +++++++++++++++++ colorizer.lua | 6 +++ dashboard.lua | 27 +++++++++++++ init.vim | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lspconfig.lua | 38 +++++++++++++++++++ lspkind.lua | 49 ++++++++++++++++++++++++ lspsaga.lua | 16 ++++++++ lualine.lua | 43 +++++++++++++++++++++ mason.lua | 24 ++++++++++++ telescope.lua | 78 +++++++++++++++++++++++++++++++++++++ treesitter.lua | 23 +++++++++++ web-devicons.lua | 12 ++++++ zen-mode.lua | 7 ++++ 15 files changed, 481 insertions(+) create mode 100644 autopairs.lua create mode 100644 autotag.lua create mode 100644 cmp.lua create mode 100644 colorizer.lua create mode 100644 dashboard.lua create mode 100644 init.vim create mode 100644 lspconfig.lua create mode 100644 lspkind.lua create mode 100644 lspsaga.lua create mode 100644 lualine.lua create mode 100644 mason.lua create mode 100644 telescope.lua create mode 100644 treesitter.lua create mode 100644 web-devicons.lua create mode 100644 zen-mode.lua diff --git a/autopairs.lua b/autopairs.lua new file mode 100644 index 0000000..f04342b --- /dev/null +++ b/autopairs.lua @@ -0,0 +1,6 @@ +local status, autopairs = pcall(require, "nvim-autopairs") +if (not status) then return end + +autopairs.setup({ + disable_filetype = { "TelescopePrompt" }, +}) \ No newline at end of file diff --git a/autotag.lua b/autotag.lua new file mode 100644 index 0000000..ac6fb8f --- /dev/null +++ b/autotag.lua @@ -0,0 +1,4 @@ +local status, autotag = pcall(require, 'nvim-ts-autotag') +if (not status) then return end + +autotag.setup() diff --git a/cmp.lua b/cmp.lua new file mode 100644 index 0000000..09a2772 --- /dev/null +++ b/cmp.lua @@ -0,0 +1,34 @@ +local status, cmp = pcall(require, "cmp") +if (not status) then return end + +local lspkind = require 'lspkind' + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true + }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'buffer' }, + }), + formatting = { + format = lspkind.cmp_format({ with_text = false, maxwidth = 50 }) + } +}) + +vim.cmd [[ + set completeopt=menuone,noinsert,noselect + highlight! default link CmpItemKind CmpItemMenuDefault +]] \ No newline at end of file diff --git a/colorizer.lua b/colorizer.lua new file mode 100644 index 0000000..62a654c --- /dev/null +++ b/colorizer.lua @@ -0,0 +1,6 @@ +local status, colorizer = pcall(require, "colorizer") +if (not status) then return end + +colorizer.setup({ + '*'; +}) diff --git a/dashboard.lua b/dashboard.lua new file mode 100644 index 0000000..fb72238 --- /dev/null +++ b/dashboard.lua @@ -0,0 +1,27 @@ +local status, dashboard = pcall(require, 'dashboard') +if not status then return end + +dashboard.custom_header= { +'', +'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠞⢳⠀⠀⠀⠀⠀', +'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡔⠋⠀⢰⠎⠀⠀⠀⠀⠀', +'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⢆⣤⡞⠃⠀⠀⠀⠀⠀⠀', +'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⢠⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀', +'⠀⠀⠀⠀⢀⣀⣾⢳⠀⠀⠀⠀⢸⢠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀', +'⣀⡤⠴⠊⠉⠀⠀⠈⠳⡀⠀⠀⠘⢎⠢⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀', +'⠳⣄⠀⠀⡠⡤⡀⠀⠘⣇⡀⠀⠀⠀⠉⠓⠒⠺⠭⢵⣦⡀⠀⠀⠀', +'⠀⢹⡆⠀⢷⡇⠁⠀⠀⣸⠇⠀⠀⠀⠀⠀⢠⢤⠀⠀⠘⢷⣆⡀⠀', +'⠀⠀⠘⠒⢤⡄⠖⢾⣭⣤⣄⠀⡔⢢⠀⡀⠎⣸⠀⠀⠀⠀⠹⣿⡀', +'⠀⠀⢀⡤⠜⠃⠀⠀⠘⠛⣿⢸⠀⡼⢠⠃⣤⡟⠀⠀⠀⠀⠀⣿⡇', +'⠀⠀⠸⠶⠖⢏⠀⠀⢀⡤⠤⠇⣴⠏⡾⢱⡏⠁⠀⠀⠀⠀⢠⣿⠃', +'⠀⠀⠀⠀⠀⠈⣇⡀⠿⠀⠀⠀⡽⣰⢶⡼⠇⠀⠀⠀⠀⣠⣿⠟⠀', +'⠀⠀⠀⠀⠀⠀⠈⠳⢤⣀⡶⠤⣷⣅⡀⠀⠀⠀⣀⡠⢔⠕⠁⠀⠀', +'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠫⠿⠿⠿⠛⠋⠁⠀⠀⠀⠀', +'', +} + +dashboard.custom_center = { + { icon=' ', desc='Find File', action='Telescope find_files find_command=rg,--hidden,--files'}, + { icon=' ', desc='File Browser', action='Telescope file_browser'}, + { icon=' ', desc='Settings', action='e C:/Users/Leander/AppData/Local/nvim/init.vim'}, +} diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..22da85c --- /dev/null +++ b/init.vim @@ -0,0 +1,114 @@ +" Configuration +" --------------------------------------- + set encoding=UTF-8 + set fileencoding=UTF-8 + + syntax on + set number + set notitle + set autoindent + set nobackup + set laststatus=2 + set ignorecase + set smarttab + set breakindent + set shiftwidth=2 + set showcmd + set ai + set si + set nowrap + set clipboard^=unnamed,unnamedplus + set termguicolors + +" Plugins +" --------------------------------------- + + call plug#begin() + + " Themes + " 🏙️ TokyoNight + " A clean, dark Neovim theme written in Lua + Plug 'folke/tokyonight.nvim' + + " 🌟 NeoSolarized + " A fixed solarized colorscheme for better truecolor support. + Plug 'overcache/NeoSolarized' + + " Plugin + " 😄 DevIcons + " Adds file type icons to Vim plugins + Plug 'kyazdani42/nvim-web-devicons' + + " 📏 Lualine + " Customizable status line + Plug 'nvim-lualine/lualine.nvim' + + " 📄 lspconfig + " Language Server Protocol Configuration + Plug 'neovim/nvim-lspconfig' + + " 📦 Mason + " + Plug 'williamboman/mason.nvim' + Plug 'williamboman/mason-lspconfig' + + " ⚡ lspsaga + " A light-weight lsp plugin based on neovim's built-in lsp with a highly performant UI. + Plug 'glepnir/lspsaga.nvim', { 'branch': 'main' } + + " 💻 CMP + " A completion engine plugin written in Lua + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-buffer' + + " 🏷️ Autotag/pairs + " + Plug 'windwp/nvim-autopairs' + Plug 'windwp/nvim-ts-autotag' + + " ✨ LuaSnip + " Snippet Engine for Neovim written in Lua + Plug 'L3MON4D3/LuaSnip' + + " 📦 lspkind + " Adds symbol next to the autocompletion + Plug 'onsails/lspkind.nvim' + + " 🌳 Treesitter + " Better highlighting + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + + " 🔭 Telescopec + " Find, Filter, Preview, Pick Files + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } + Plug 'nvim-telescope/telescope-file-browser.nvim' + + " 🚦 Trouble + " A pretty list for showing diagnostics, references, telescope results, quickfix and location lists + " Plug 'folke/trouble.nvim' + + " 🎨 Colorizer + " A high-performance color highlighter for Neovim + Plug 'norcalli/nvim-colorizer.lua' + + " 🧘 Zen Mode + " Distraction-free coding for Neovim + Plug 'folke/zen-mode.nvim' + + " 🎛️ Dashboard + " Customizable NeoVim start screen + Plug 'glepnir/dashboard-nvim' + + call plug#end() + +" Theme +" --------------------------------------- + + " 🏙️ Tokyo Night Configuration + let g:tokyonight_style = "storm" + let g:tokyonight_transparent = 1 + let g:tokyonight_transparent_sidebar = 1 + + colorscheme tokyonight diff --git a/lspconfig.lua b/lspconfig.lua new file mode 100644 index 0000000..80950e3 --- /dev/null +++ b/lspconfig.lua @@ -0,0 +1,38 @@ +local status, lspconfig = pcall(require, 'lspconfig') +if (not status) then return end + + + +lspconfig.pyright.setup {} + +lspconfig.sumneko_lua.setup { + settings = { + Lua = { + diagnostics = { + -- get the language server to recognize the 'vim' globals + globals = { 'vim' } + }, + + workspace = { + libary = vim.api.nvim_get_runtime_file("", true) + } + } + } +} + +-- Diagnostic symbols in the sign column (gutter) +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 + +vim.diagnostic.config({ + virtual_text = { + prefix = '●' + }, + update_in_insert = true, + float = { + source = "always", -- Or "if_many" + }, +}) diff --git a/lspkind.lua b/lspkind.lua new file mode 100644 index 0000000..6027051 --- /dev/null +++ b/lspkind.lua @@ -0,0 +1,49 @@ +require('lspkind').init({ + -- DEPRECATED (use mode instead): enables text annotations + -- + -- default: true + -- with_text = true, + + -- defines how annotations are shown + -- default: symbol + -- options: 'text', 'text_symbol', 'symbol_text', 'symbol' + mode = 'symbol_text', + + -- default symbol map + -- can be either 'default' (requires nerd-fonts font) or + -- 'codicons' for codicon preset (requires vscode-codicons font) + -- + -- default: 'default' + preset = 'codicons', + + -- override preset symbols + -- + -- default: {} + symbol_map = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "ﰠ", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "塞", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + TypeParameter = "" + }, +}) diff --git a/lspsaga.lua b/lspsaga.lua new file mode 100644 index 0000000..e215b30 --- /dev/null +++ b/lspsaga.lua @@ -0,0 +1,16 @@ +local status, saga = pcall(require, "lspsaga") +if (not status) then return end + +saga.init_lsp_saga { + server_filetype_map = { + typescript = 'typescript' + } +} + +local opts = { noremap = true, silent = true } +vim.keymap.set('n', '', 'Lspsaga diagnostic_jump_next', opts) +vim.keymap.set('n', 'K', 'Lspsaga hover_doc', opts) +vim.keymap.set('n', 'gd', 'Lspsaga lsp_finder', opts) +vim.keymap.set('i', '', 'Lspsaga signature_help', opts) +vim.keymap.set('n', 'gp', 'Lspsaga preview_definition', opts) +vim.keymap.set('n', 'gr', 'Lspsaga rename', opts) diff --git a/lualine.lua b/lualine.lua new file mode 100644 index 0000000..00a13fb --- /dev/null +++ b/lualine.lua @@ -0,0 +1,43 @@ +local status, lualine = pcall(require, 'lualine') +if (not status) then return end + +lualine.setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + 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 = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/mason.lua b/mason.lua new file mode 100644 index 0000000..91952e4 --- /dev/null +++ b/mason.lua @@ -0,0 +1,24 @@ +local status, mason = pcall(require, 'mason') +if (not status) then return end + +local status2, masonlspconfig = pcall(require, 'mason-lspconfig') +if (not status2) then return end + +mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" + } + } +}) + +masonlspconfig.setup { + + ensure_installed = {}, + + -- false: Servers are not automatically installed. + -- true: All servers set up via lspconfig are automatically installed. + automatic_installation = false, +} diff --git a/telescope.lua b/telescope.lua new file mode 100644 index 0000000..37b9b86 --- /dev/null +++ b/telescope.lua @@ -0,0 +1,78 @@ +local status, telescope = pcall(require, "telescope") +if (not status) then return end +local actions = require('telescope.actions') +local builtin = require("telescope.builtin") + +local function telescope_buffer_dir() + return vim.fn.expand('%:p:h') +end + +local fb_actions = require "telescope".extensions.file_browser.actions + +telescope.setup { + defaults = { + mappings = { + n = { + ["q"] = actions.close + }, + }, + }, + extensions = { + file_browser = { + theme = "dropdown", + -- disables netrw and use telescope-file-browser in its place + hijack_netrw = true, + mappings = { + -- your custom insert mode mappings + ["i"] = { + [""] = function() vim.cmd('normal vbd') end, + }, + ["n"] = { + -- your custom normal mode mappings + ["N"] = fb_actions.create, + ["h"] = fb_actions.goto_parent_dir, + ["/"] = function() + vim.cmd('startinsert') + end + }, + }, + }, + }, +} + +telescope.load_extension("file_browser") + +vim.keymap.set('n', ';f', + function() + builtin.find_files({ + no_ignore = false, + hidden = true + }) + end) +vim.keymap.set('n', ';r', function() + builtin.live_grep() +end) +vim.keymap.set('n', '\\\\', function() + builtin.buffers() +end) +vim.keymap.set('n', ';t', function() + builtin.help_tags() +end) +vim.keymap.set('n', ';;', function() + builtin.resume() +end) +vim.keymap.set('n', ';e', function() + builtin.diagnostics() +end) +vim.keymap.set("n", "sf", function() + telescope.extensions.file_browser.file_browser({ + path = "%:p:h", + cwd = telescope_buffer_dir(), + respect_gitignore = false, + hidden = true, + grouped = true, + previewer = false, + initial_mode = "normal", + layout_config = { height = 40 } + }) +end) \ No newline at end of file diff --git a/treesitter.lua b/treesitter.lua new file mode 100644 index 0000000..a6b3c40 --- /dev/null +++ b/treesitter.lua @@ -0,0 +1,23 @@ +local status, ts = pcall(require, 'treesitter') +if (not status) then return end + +ts.setup { + highlight = { + enable = true, + disable = {} + }, + indent = { + enable = true, + disable = {} + }, + ensure_installed = { + 'lua', + 'python', + "css", + "html", + "json", + }, + autotag = { + enable = true, + }, +} diff --git a/web-devicons.lua b/web-devicons.lua new file mode 100644 index 0000000..536b57f --- /dev/null +++ b/web-devicons.lua @@ -0,0 +1,12 @@ +local status, icons = pcall(require, 'nvim-web-devicons') +if (not status) then return end + +icons.setup { + -- your personnal icons can go here (to override) + -- DevIcon will be appended to `name` + override = { + }, + -- globally enable default icons (default to false) + -- will get overriden by `get_icons` option + default = true +} diff --git a/zen-mode.lua b/zen-mode.lua new file mode 100644 index 0000000..a973262 --- /dev/null +++ b/zen-mode.lua @@ -0,0 +1,7 @@ +local status, zenMode = pcall(require, "zen-mode") +if (not status) then return end + +zenMode.setup { +} + +vim.keymap.set('n', 'o', 'ZenMode', { silent = true }) -- cgit v1.3.1