let mapleader=" " set mouse=a set number set relativenumber set autoindent set smarttab set ignorecase set smartcase set termguicolors syntax on " Autocompletion set wildmode=longest,list,full " Fix splitting set splitbelow splitright "Tab settings set expandtab set shiftwidth=4 set softtabstop=4 set tabstop=4 set clipboard+=unnamedplus call plug#begin() Plug 'andweeb/presence.nvim' Plug 'ap/vim-css-color' Plug 'jiangmiao/auto-pairs' Plug 'kyazdani42/nvim-web-devicons' Plug 'L3MON4D3/LuaSnip' Plug 'lewis6991/gitsigns.nvim' Plug 'lukas-reineke/indent-blankline.nvim' Plug 'mattn/emmet-vim' Plug 'Mofiqul/dracula.nvim' Plug 'norcalli/nvim-colorizer.lua' Plug 'numToStr/Comment.nvim' Plug 'nvim-lualine/lualine.nvim' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'preservim/nerdtree' Plug 'rafi/awesome-vim-colorschemes' Plug 'ryanoasis/vim-devicons' Plug 'sbdchd/neoformat' Plug 'vimwiki/vimwiki' Plug 'saecki/crates.nvim' " cmp Plug 'williamboman/nvim-lsp-installer' Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' Plug 'hrsh7th/nvim-cmp' Plug 'saadparwaiz1/cmp_luasnip' call plug#end() colorscheme dracula set cursorline set cursorcolumn highlight CursorLine ctermbg=Yellow cterm=bold guibg=#2b2b2b highlight CursorColumn ctermbg=Yellow cterm=bold guibg=#2b2b2b nnoremap n :NERDTreeFocus nnoremap :NERDTree nnoremap :NERDTreeToggle nnoremap :NERDTreeFind let NERDTreeShowHidden=1 " Verticaly center document when entering insert mode autocmd InsertEnter * norm zz " Remove trailing whitespace on save autocmd BufWritePre * %s/\s\+$//e " Enable Disable auto comment map c :setlocal formatoptions-=cro map C :setlocal formatoptions=cro " Enable spell checking, s for spell check map s :setlocal spell! spelllang=en_us " Enable Disable auto indent map i :setlocal autoindent map I :setlocal noautoindent " Shortcutting split navigation map h map j map k map l " Moving line up or down by one line nmap :m -2 nmap :m -2 nmap :m +1 nmap :m +1 " Alias replace all to S " nnoremap S :%s//gI nnoremap S :%s// " run current script with python3 by CTRL+R in command and insert mode autocmd FileType python map :w:exec '!python3' shellescape(@%, 1) autocmd FileType python imap :w:exec '!python3' shellescape(@%, 1) autocmd FileType rust map :w:exec '!cargo run' autocmd FileType rust imap :w:exec '!cargo run' " Prettier configuration let g:neoformat_enabled_python = ['autopep8'] let g:neoformat_try_node_exe = 1 autocmd BufWritePre,InsertLeave *.{py,rs,html,css,md,lua} Neoformat " Find files using Telescope command-line sugar. nnoremap ff Telescope find_files hidden=true nnoremap fg Telescope live_grep nnoremap fb Telescope buffers nnoremap fh Telescope help_tags lua << END require('gitsigns').setup() require('Comment').setup() require 'colorizer'.setup() require('crates').setup() vim.opt.list = true vim.opt.listchars:append "eol:↴" vim.opt.listchars:append "space:⋅" require('indent_blankline').setup({ space_char_blankline = " ", show_end_of_line = true, show_current_context = true, show_current_context_start = true, }) require("nvim-lsp-installer").setup({ automatic_installation = true, -- automatically detect which servers to install (based on which servers are set up via lspconfig) ui = { icons = { server_installed = "✓", server_pending = "➜", server_uninstalled = "✗" } } }) require('lualine').setup { options = { icons_enabled = true, theme = 'dracula', component_separators = { left = '', right = ''}, section_separators = { left = '', right = ''}, disabled_filetypes = {}, always_divide_middle = true, globalstatus = false, }, 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 = {}, extensions = {} } require('telescope').setup{ defaults = { vimgrep_arguments = { 'rg', '--with-filename', '--line-number', '--column', '--smart-case', '--no-ignore', -- **This is the added flag** '--hidden' -- **Also this flag. The combination of the two is the same as `-uu`** } } } -- To get fzf loaded and working with telescope, you need to call -- load_extension, somewhere after setup function: require('telescope').load_extension('fzf') END " LSP configs lua << END -- Mappings. -- See `:help vim.diagnostic.*` for documentation on any of the below functions local opts = { noremap=true, silent=true } vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -- 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) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) end local lsp_flags = { -- This is the default in Nvim 0.7+ debounce_text_changes = 150, } END " cmp configs set completeopt=menu,menuone,noselect lua <'] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- 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' }, }) }) -- 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').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- Replace with each lsp server you've enabled. require('lspconfig')['pyright'].setup{ on_attach = on_attach, flags = lsp_flags, } require('lspconfig')['rust_analyzer'].setup{ on_attach = on_attach, flags = lsp_flags, -- Server-specific settings... settings = { ["rust-analyzer"] = {} } } require('lspconfig')['bashls'].setup{} require('lspconfig')['cssls'].setup{} require('lspconfig')['emmet_ls'].setup{} require('lspconfig')['ltex'].setup{} require('lspconfig')['marksman'].setup{} require('lspconfig')['taplo'].setup{} require('lspconfig')['vimls'].setup{} require('lspconfig')['yamlls'].setup{} EOF lua <