let g:mapleader = "\" let g:maplocalleader = ',' set termguicolors syntax on " set hidden " Always show the signcolumn if has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif call plug#begin(stdpath('data') . '/plugged') Plug 'neovim/nvim-lspconfig' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'windwp/nvim-autopairs' Plug 'terrortylor/nvim-comment' Plug 'kyazdani42/nvim-tree.lua' Plug 'glepnir/dashboard-nvim' Plug 'hoob3rt/lualine.nvim' Plug 'ziglang/zig.vim' Plug 'simrat39/rust-tools.nvim' " One Dark Pro Plug 'joshdick/onedark.vim' " Plug 'liuchengxu/vim-which-key' " TODO: Configure this Plug 'mfussenegger/nvim-dap' " Autocomplete Plug 'nvim-lua/completion-nvim' Plug 'steelsojka/completion-buffers' Plug 'nvim-treesitter/completion-treesitter' Plug 'kristijanhusak/completion-tags' Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip-integ' " Telescope Config Plug 'nvim-lua/popup.nvim' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' " Barbar Config Plug 'kyazdani42/nvim-web-devicons' Plug 'romgrk/barbar.nvim' call plug#end() " nvim-completion autocmd BufEnter * lua require'completion'.on_attach() " Use and to navigate through popup menu inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " Set completeopt to have a better completion experience set completeopt=menuone,noinsert,noselect " Avoid showing message extra message when using completion set shortmess+=c let g:completion_enable_snippet = 'vim-vsnip' let g:completion_enable_auto_popup = 1 imap (completion_trigger) " --Telescope Keybinds-- nnoremap ff lua require('telescope.builtin').find_files() nnoremap fg lua require('telescope.builtin').live_grep() nnoremap fb lua require('telescope.builtin').buffers() nnoremap fh lua require('telescope.builtin').help_tags() " Which Key Keybinds " nnoremap :WhichKey '' " nnoremap :WhichKey ',' " Nvim Tree Keybinds let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default let g:nvim_tree_gitignore = 1 "0 by default let g:nvim_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR` or `vim` let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last window let g:nvim_tree_auto_ignore_ft = [ 'startify', 'dashboard' ] "empty by default, don't auto open tree on specific filetypes. let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree let g:nvim_tree_lsp_diagnostics = 1 "0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics let g:nvim_tree_special_files = [ 'README.md', 'Makefile', 'MAKEFILE' ] " List of filenames that gets highlighted with NvimTreeSpecialFile let g:nvim_tree_show_icons = { \ 'git': 1, \ 'folders': 1, \ 'files': 1, \ } "If 0, do not show the icons for one of 'git' 'folder' and 'files' "1 by default, notice that if 'files' is 1, it will only display "if nvim-web-devicons is installed and on your runtimepath " default will show icon by default if no icon is provided " default shows no icon by default let g:nvim_tree_icons = { \ 'default': '', \ 'symlink': '', \ 'git': { \ 'unstaged': "✗", \ 'staged': "✓", \ 'unmerged': "", \ 'renamed': "➜", \ 'untracked': "★", \ 'deleted': "", \ 'ignored': "◌" \ }, \ 'folder': { \ 'default': "", \ 'open': "", \ 'empty': "", \ 'empty_open': "", \ 'symlink': "", \ 'symlink_open': "", \ }, \ 'lsp': { \ 'hint': "", \ 'info': "", \ 'warning': "", \ 'error': "", \ } \ } nnoremap :NvimTreeToggle nnoremap r :NvimTreeRefresh nnoremap n :NvimTreeFindFile " NvimTreeOpen and NvimTreeClose are also available if you need them " Inverse tab in insert mode inoremap " Remove search highlight on double escape nnoremap :nohlsearch " a list of groups can be found at `:help nvim_tree_highlight` highlight NvimTreeFolderIcon guibg=blue colorscheme onedark lua << EOF -- NVIM 0.5 LSP Setup -- nvim lspconfig local nvim_lsp = require('lspconfig') -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end --Enable completion triggered by buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. local opts = { noremap=true, silent=true } -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) buf_set_keymap("n", "f", "lua vim.lsp.buf.formatting()", opts) end -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { "pyright", "zls", "tsserver" } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, flags = { debounce_text_changes = 150, } } end -- Rust Tools require'rust-tools'.setup{ hover_actions = { -- the border that is used for the hover window -- see vim.api.nvim_open_win() border = { {"╭", "FloatBorder"}, {"─", "FloatBorder"}, {"╮", "FloatBorder"}, {"│", "FloatBorder"}, {"╯", "FloatBorder"}, {"─", "FloatBorder"}, {"╰", "FloatBorder"}, {"│", "FloatBorder"} }, }, } -- Tree Sitter Config require'nvim-treesitter.configs'.setup { highlight = { enable = true }, indent = { enable = true }, autotag = { enable = true }, } -- Telescope Defaults require('telescope').setup{ defaults = { vimgrep_arguments = { 'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, prompt_prefix = "> ", selection_caret = "> ", entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", sorting_strategy = "descending", layout_strategy = "horizontal", layout_config = { horizontal = { mirror = false, }, vertical = { mirror = false, }, }, file_sorter = require'telescope.sorters'.get_fuzzy_file, file_ignore_patterns = {}, generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, winblend = 0, border = {}, borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, color_devicons = true, use_less = true, path_display = {}, set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil, 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, -- Developer configurations: Not meant for general override buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker } } -- Barbar Keybinds vim.api.nvim_set_keymap('n', '', ':BufferNext', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':BufferPrevious', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', ':BufferClose', { noremap = true, silent = true }) -- Autopairs setup require'nvim-autopairs'.setup() -- Comments require'nvim_comment'.setup() -- Autocomplete -- lualine Config require'lualine'.setup { options = { theme = "onedark" }, } -- Dashboard config vim.g.dashboard_default_executive = 'telescope' vim.g.dashboard_custom_section = { a = {description = {' Find File '}, command = 'Telescope find_files'}, b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'}, c = {description = {' Load Last Session '}, command = 'SessionLoad'}, d = {description = {' Find Word '}, command = 'Telescope live_grep'}, e = {description = {' Settings '}, command = ':e ~/.config/nvim/init.vim'} -- e = {description = {' Marks '}, command = 'Telescope marks'} } EOF