" {{{ plugins call plug#begin(stdpath('data') . '/plugged') " misc Plug 'nvim-lua/plenary.nvim' Plug 'tpope/vim-sensible' Plug 'itchyny/vim-gitbranch' Plug 'andweeb/presence.nvim' Plug 'ntpeters/vim-better-whitespace' Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug 'mg979/vim-visual-multi' Plug 'rhysd/committia.vim' Plug 'tpope/vim-sleuth' Plug 'm-demare/hlargs.nvim' Plug 'nvim-treesitter/nvim-treesitter' Plug 'windwp/nvim-ts-autotag' " interface Plug 'romgrk/barbar.nvim' Plug 'lukas-reineke/indent-blankline.nvim' Plug 'folke/lsp-colors.nvim' Plug 'nacro90/numb.nvim' Plug 'xiyaowong/nvim-cursorword' Plug 'kevinhwang91/nvim-hlslens' " language specific Plug 'sheerun/vim-polyglot' Plug 'dense-analysis/ale' Plug 'neovim/nvim-lspconfig' "Plug 'jose-elias-alvarez/null-ls.nvim' Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-cmdline' Plug 'hrsh7th/cmp-buffer' Plug 'dmitmel/cmp-cmdline-history' Plug 'hrsh7th/cmp-nvim-lsp-signature-help' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/vim-vsnip' call plug#end() " }}} " {{{ options set notermguicolors colorscheme lena set fileformat=unix set fileformats=unix,dos set number set cul set tabstop=2 set shiftwidth=2 set expandtab set mouse+=nia au WinEnter * set cul au WinLeave * set nocul let g:better_whitespace_enabled = 1 let bufferline = get(g:, 'bufferline', {}) let bufferline.icons = v:false let bufferline.icon_separator_active = '▎' let bufferline.icon_separator_inactive = '▎' let bufferline.icon_close_tab = 'x' let bufferline.icon_close_tab_modified = '●' let bufferline.icon_pinned = '▲' let g:presence_buttons = 0 let g:ale_linters = { \ 'javascript': ['eslint'], \ 'typescript': ['eslint', 'tsserver'], \} let g:ale_fixers = { \ '*': ['trim_whitespace'], \ 'vim': [], \ 'javascript': ['prettier', 'eslint'], \ 'typescript': ['prettier', 'eslint'], \ 'json': ['prettier'], \ 'css': ['prettier'], \} let g:ale_fix_on_save = 1 set fillchars+=vert:▎ set completeopt=menu,menuone,noselect " }}} " {{{ scripts lua << EOF vim.cmd("highlight IndentBlanklineIndent1 ctermfg=11 cterm=nocombine") vim.cmd("highlight IndentBlanklineIndent2 ctermfg=10 cterm=nocombine") vim.cmd("highlight IndentBlanklineIndent3 ctermfg=13 cterm=nocombine") vim.cmd("highlight IndentBlanklineIndent4 ctermfg=12 cterm=nocombine") vim.opt.list = true vim.opt.listchars:append("space:⋅") vim.opt.listchars:append("eol:↴") require("indent_blankline").setup( { char = "▎", space_char_blankline = " ", char_blankline = " ", char_highlight_list = { "IndentBlanklineIndent1", "IndentBlanklineIndent2", "IndentBlanklineIndent3", "IndentBlanklineIndent4", }, show_current_context = true, show_current_context_start = true, } ) EOF :lua require("numb").setup() :lua require("nvim-ts-autotag").setup() lua << EOF require("hlslens").setup( { calm_down = true, nearest_only = true, nearest_float_when = "auto", } ) EOF lua << EOF --[[local null_ls = require("null-ls") local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) null_ls.setup({ sources = { null_ls.builtins.diagnostics.eslint, null_ls.builtins.diagnostics.zsh, null_ls.builtins.formatting.eslint, null_ls.builtins.formatting.prettier, }, on_attach = function(client, buffer) if client.supports_method("textDocument/formatting") then vim.api.nvim_clear_autocmds({group = augroup, buffer = buffer}) vim.api.nvim_create_autocmd("BufWritePre", { group = augroup, buffer = buffer, callback = function() vim.lsp.buf.formatting_sync() end, }) end end, })--]] EOF lua <"] = cmp.mapping(cmp.mapping.complete(), {"i", "s", "c"}), [""] = cmp.mapping(function(fallback) local entry = cmp.get_selected_entry() if entry then cmp.confirm({behavior = cmp.ConfirmBehavior.Insert, select = true}) else fallback() end end, {"i", "s", "c"}), [""] = cmp.mapping(function(fallback) -- This little snippet will confirm with tab, and if no entry is selected, will confirm the first item if cmp.visible() then local entry = cmp.get_selected_entry() if not entry then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) else cmp.confirm() end else fallback() end end, {"i", "s", "c"}), [""] = cmp.mapping(cmp.mapping.abort(), {"i", "s", "c"}), [""] = cmp.mapping(cmp.mapping.abort(), {"i", "s", "c"}), [""] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {"i", "s", "c"}), [""] = cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {"i", "s", "c"}), } cmp.setup( { snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = cmp.mapping.preset.insert(mapping), sources = cmp.config.sources( { {name = "nvim_lsp", priority = 1}, {name = "vsnip"}, }, { {name = "buffer"}, {name = "path"}, } ), } ) cmp.setup.cmdline( ":", { sources = { {name = "cmdline", group_index = 1}, {name = "cmdline_history", group_index = 2}, }, mapping = cmp.mapping.preset.insert(mapping), } ) cmp.setup.cmdline( "/", { sources = { {name = "cmdline_history"}, {name = "buffer"} }, mapping = cmp.mapping.preset.insert(mapping), } ) local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) lspconfig.eslint.setup( { capabilities = capabilities, } ) --[[lspconfig.tsserver.setup( { capabilities = capabilities, } )--]] EOF " }}} " {{{ keys tnoremap inoremap inoremap map! cnoremap nnoremap :m-2 nnoremap :m+ inoremap :m-2 inoremap :m+ "nnoremap :NERDTreeToggle "nnoremap :SymbolsOutline ":lua require'bufferline.state'.set_offset(require'nvim-tree.view'.win_open() and 30 or 0) "inoremap pumvisible() ? "\" : "\" "inoremap pumvisible() ? "\": "\" " barbar keys " Move to previous/next nnoremap :BufferPrevious nnoremap :BufferNext " Re-order to previous/next nnoremap :BufferMovePrevious nnoremap > :BufferMoveNext " Goto buffer in position... nnoremap :BufferGoto 1 nnoremap :BufferGoto 2 nnoremap :BufferGoto 3 nnoremap :BufferGoto 4 nnoremap :BufferGoto 5 nnoremap :BufferGoto 6 nnoremap :BufferGoto 7 nnoremap :BufferGoto 8 nnoremap :BufferLast " Pin/unpin buffer nnoremap :BufferPin " Close buffer nnoremap :BufferClose " }}} " {{{ colors hi Normal ctermbg=NONE hi LineNr ctermfg=7 hi CursorLineNr ctermfg=1 ctermbg=0 hi CursorLine cterm=NONE ctermfg=NONE ctermbg=0 hi StatusLine ctermfg=2 ctermbg=8 cterm=NONE hi StatusLineNC ctermfg=7 ctermbg=0 cterm=NONE hi VertSplit ctermbg=0 ctermfg=0 hi ExtraWhitespace ctermbg=1 hi SignColumn ctermbg=8 hi BufferCurrent ctermfg=5 ctermbg=NONE hi BufferCurrentIndex ctermfg=5 ctermbg=NONE hi BufferCurrentMod ctermfg=9 ctermbg=NONE hi BufferCurrentSign ctermfg=5 ctermbg=NONE hi BufferCurrentTarget ctermfg=5 ctermbg=NONE hi BufferVisible ctermfg=7 ctermbg=NONE hi BufferVisibleIndex ctermfg=7 ctermbg=NONE hi BufferVisibleMod ctermfg=9 ctermbg=NONE hi BufferVisibleSign ctermfg=7 ctermbg=NONE hi BufferVisibleTarget ctermfg=7 ctermbg=NONE hi BufferInactive ctermfg=7 ctermbg=0 hi BufferInactiveIndex ctermfg=5 ctermbg=0 hi BufferInactiveMod ctermfg=1 ctermbg=0 hi BufferInactiveSign ctermfg=10 ctermbg=0 hi BufferInactiveTarget ctermfg=11 ctermbg=0 hi BufferTabpages ctermfg=7 ctermbg=0 hi BufferTabpageFill ctermfg=7 ctermbg=0 hi BufferOffset ctermfg=0 ctermbg=0 hi! link SignColumn LineNr hi LspDiagnosticsDefaultHint ctermfg=6 hi LspDiagnosticsDefaultError ctermfg=1 hi LspDiagnosticsDefaultWarning ctermfg=3 hi LspDiagnosticsDefaultInformation ctermfg=7 hi ALEErrorSign ctermfg=1 hi ALEWarningSign ctermfg=3 hi StatusLineMode ctermbg=1 ctermfg=0 hi StatusLineGitBranch ctermbg=5 ctermfg=0 hi StatusLineChar ctermbg=4 ctermfg=0 hi StatusLineFormat ctermbg=3 ctermfg=0 hi StatusLineFileType ctermbg=7 ctermfg=0 " }}} " {{{ statusline function! GetMode() let l:m = mode(1) if l:m ==# "i" let l:mode = "INS" elseif l:m ==# "c" let l:mode = "CMD" elseif l:m[0] ==# "R" let l:mode = "REP" elseif l:m ==# "Rv" let l:mode = "REP" elseif l:m =~# '\v(v|V| |s|S| )' let l:mode = "VIS" else return "" endif return ' '.l:mode.' ' endfunction function! GitBranch() let l:branch = gitbranch#name() return strlen(l:branch) ? ' ' . l:branch . ' ' : '' endfunction set statusline= set statusline+=%#StatusLineMode# set statusline+=%{GetMode()} set statusline+=%#StatusLineGitBranch# set statusline+=%{GitBranch()} set statusline+=%* set statusline+=\ %f set statusline+=\ %m%r set statusline+=%= set statusline+=%#StatusLineChar# set statusline+=\ %l,\ %c\ set statusline+=%#StatusLineFormat# set statusline+=\ %{&fileencoding?&fileencoding:&encoding}\ %{&fileformat}\ set statusline+=%#StatusLineFileType# set statusline+=\ %{&filetype}\ " }}}