-
-
Save erikh/b96e680a7d82c9563623d3ef6d804acb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set hidden | |
| set autoindent | |
| set smartindent | |
| set statusline=%F\ \[%M%R\] | |
| set laststatus=2 | |
| set titlestring=vim:\ %F\ \[%M%R\] | |
| set title | |
| set nocp | |
| set nomore | |
| set number | |
| set hls | |
| set noswf | |
| set foldenable | |
| set foldlevel=0 | |
| set foldminlines=10 | |
| set nowrap | |
| set noincsearch | |
| set expandtab | |
| set tabstop=2 | |
| set shiftround | |
| set shiftwidth=2 | |
| set smarttab | |
| set softtabstop=2 | |
| set exrc | |
| set novisualbell | |
| set equalalways | |
| set shell=/bin/bash | |
| set background=dark | |
| set completeopt=menu,menuone,noselect | |
| if (has("nvim")) | |
| let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
| endif | |
| " if (has("termguicolors")) | |
| " set termguicolors | |
| " endif | |
| set notermguicolors | |
| call plug#begin('~/.vim/plugged') | |
| Plug 'cstrahan/vim-capnp' | |
| Plug 'vyfor/cord.nvim' | |
| Plug 'posva/vim-vue' | |
| Plug 'vim-scripts/tcomment' | |
| Plug 'mitsuhiko/vim-jinja' | |
| Plug 'hashivim/vim-terraform' | |
| Plug 'jlanzarotta/bufexplorer' | |
| Plug 'rust-lang/rust.vim' | |
| Plug 'prettier/vim-prettier' | |
| Plug 'jparise/vim-graphql' | |
| Plug 'MaxMEllon/vim-jsx-pretty' | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'jjo/vim-cue' | |
| Plug 'arzg/vim-rust-syntax-ext' | |
| Plug 'drewtempelmeyer/palenight.vim' | |
| Plug 'neovim/nvim-lspconfig' | |
| Plug 'williamboman/mason.nvim' | |
| Plug 'williamboman/mason-lspconfig.nvim' | |
| Plug 'hrsh7th/nvim-cmp' | |
| Plug 'hrsh7th/cmp-nvim-lsp' | |
| Plug 'hrsh7th/cmp-buffer' | |
| Plug 'hrsh7th/cmp-path' | |
| Plug 'hrsh7th/cmp-cmdline' | |
| Plug 'hrsh7th/cmp-vsnip' | |
| Plug 'hrsh7th/vim-vsnip' | |
| Plug 'fatih/vim-go' | |
| Plug 'dylanaraps/wal.vim' | |
| Plug 'nordtheme/vim' | |
| Plug 'niklasl/vim-rdf' | |
| Plug 'marko-cerovac/material.nvim' | |
| call plug#end() | |
| let g:material_style = "oceanic" | |
| colorscheme wal | |
| filetype plugin indent on | |
| syntax on | |
| let g:python_host_prog = "python" | |
| let g:python3_host_prog = "python3" | |
| let g:rustfmt_autosave = 1 | |
| let g:go_def_mode='gopls' | |
| let g:go_auto_type_info=0 | |
| let g:go_info_mode='gopls' | |
| let g:go_fmt_command = "goimports" | |
| let g:go_highlight_operators = 1 | |
| let g:go_highlight_extra_types = 1 | |
| let g:go_highlight_functions = 1 | |
| let g:go_highlight_function_arguments = 1 | |
| let g:go_highlight_function_calls = 1 | |
| let g:go_highlight_structs = 1 | |
| let g:go_highlight_build_constraints = 1 | |
| let g:go_highlight_types = 1 | |
| let g:go_highlight_fields = 1 | |
| let g:go_auto_type_info = 0 | |
| let g:go_metalinter_autosave = 0 | |
| let g:go_fmt_autosave = 1 | |
| let g:go_list_type = "quickfix" | |
| let g:go_auto_sameids = 1 | |
| let g:go_gocode_unimported_packages = 1 | |
| let g:go_gocode_propose_builtins = 0 | |
| let g:terraform_fmt_on_save = 1 | |
| let g:jsx_ext_required = 0 | |
| let g:syntastic_nasm_nasm_exe = "yasm" | |
| let g:syntastic_nasm_nasm_args = "-g dwarf2 -f elf64 -o/dev/null %" | |
| let g:syntastic_go_checkers = ['gopls', 'golint', 'govet', 'gocyclo'] | |
| let g:syntastic_javascript_checkers = [ 'eslint' ] | |
| let g:syntastic_python_checkers = [ 'pylsp' ] | |
| let g:prettier#autoformat = 0 | |
| highlight Normal ctermbg=none | |
| highlight NonText ctermbg=none | |
| highlight Normal guibg=none | |
| highlight NonText guibg=none | |
| autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync | |
| au BufWinEnter,BufRead,BufNewFile *.rs setfiletype rust | |
| au BufWinEnter,BufRead,BufNewFile *.json setfiletype json | |
| au BufWinEnter,BufRead,BufNewFile *.rhtml setfiletype eruby | |
| au BufWinEnter,BufRead,BufNewFile *.ru setfiletype ruby | |
| au BufWinEnter,BufRead,BufNewFile taskfile setfiletype javascript | |
| au BufWinEnter,BufRead,BufNewFile Gemfile setfiletype ruby | |
| au BufWinEnter,BufRead,BufNewFile Capfile setfiletype ruby | |
| au BufWinEnter,BufRead,BufNewFile Rakefile setfiletype ruby | |
| au BufWinEnter,BufRead,BufNewFile Vagrantfile setfiletype ruby | |
| au BufWinEnter,BufRead,BufNewFile *.md setfiletype markdown | |
| au BufWinEnter,BufRead,BufNewFile *.md set spell | |
| au BufWinEnter,BufRead,BufNewFile *.md set wrap | |
| au BufWinLeave *.md set nospell | |
| au BufWinLeave *.md set nowrap | |
| au BufWinEnter,BufRead,BufNewFile *.pp setfiletype puppet | |
| au BufWinEnter,BufRead,BufNewFile *.tf setfiletype terraform | |
| au BufWinEnter,BufRead,BufNewFile *.gotmpl setfiletype gotexttmpl | |
| lua <<EOF | |
| local has_words_before = function() | |
| local line, col = unpack(vim.api.nvim_win_get_cursor(0)) | |
| return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil | |
| end | |
| -- Setup nvim-cmp. | |
| local cmp = require'cmp' | |
| 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), | |
| ["<Tab>"] = cmp.mapping(function(fallback) | |
| if cmp.visible() then | |
| cmp.select_next_item() | |
| elseif has_words_before() then | |
| cmp.complete() | |
| else | |
| fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`. | |
| end | |
| end, { "i", "s" }), | |
| ["<S-Tab>"] = cmp.mapping(function() | |
| if cmp.visible() then | |
| cmp.select_prev_item() | |
| end | |
| end, { "i", "s" }), | |
| ['<C-c>'] = cmp.mapping.abort(), | |
| ['<CR>'] = 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' }, | |
| }), | |
| formatting = { | |
| format = function(entry, vim_item) | |
| vim_item.menu = entry:get_completion_item().detail | |
| return vim_item | |
| end | |
| } | |
| }) | |
| -- 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' } | |
| }) | |
| }) | |
| local installer = require("mason").setup() | |
| local installer = require("mason-lspconfig").setup() | |
| local lsps = {"rust_analyzer", "dockerls", "vimls", "gopls", "pylsp"} | |
| for i, k in ipairs(lsps) do | |
| local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) | |
| require("lspconfig")[k].setup { capabilities = capabilities } | |
| end | |
| require('lspconfig').gopls.setup { | |
| cmd = { | |
| "/home/erikh/bin/gopls" | |
| } | |
| } | |
| require('lspconfig').rust_analyzer.setup { | |
| settings = { | |
| ["rust-analyzer"] = { | |
| enable = true, | |
| procMacro = { enable = true }, | |
| cargo = { features = "all", noDefaultFeatures = true }, | |
| inlayHints = { | |
| bindingModeHints = { enable = true }, | |
| discriminantHints = { enable = true }, | |
| expressionAdjustmentHints = { | |
| enable = true | |
| }, | |
| implicitDrops = { enable = true }, | |
| lifetimeElisionHints = { enable = true }, | |
| rangeExclusiveHints = { enable = true }, | |
| }, | |
| lens = { | |
| enable = true, | |
| implementations = { enable = true }, | |
| references = { | |
| adt = { enable = true }, | |
| enumVariant = { enable = true }, | |
| method = { enable = true }, | |
| trait = { enable = true }, | |
| }, | |
| run = { enable = true }, | |
| }, | |
| } | |
| } | |
| } | |
| EOF | |
| lua <<EOF | |
| -- Mappings. | |
| -- See `:help vim.diagnostic.*` for documentation on any of the below functions | |
| local opts = { noremap=true, silent=true } | |
| vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) | |
| vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) | |
| vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) | |
| vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', 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 <c-x><c-o> | |
| 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 | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | |
| vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) | |
| end | |
| EOF | |
| vmap # :TComment<CR> | |
| let mapleader = "," | |
| let maplocalleader = "," | |
| map <Leader>e :Explore<CR> | |
| map <Leader>f :FZF!<CR> | |
| map <Leader>s :split<CR> | |
| map <Leader>v :vsplit<CR> | |
| map <Leader>d :filetype detect<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment