Last active
October 31, 2021 01:52
-
-
Save thiagoramos23/9a2b743fa487d093cf76f306fdf5a062 to your computer and use it in GitHub Desktop.
This file contains 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 runtimepath^=~/.vim runtimepath+=~/.vim/after | |
" let &packpath = &runtimepath | |
" source ~/.vimrc | |
"'' VIM PRE-PLUG ''" | |
filetype plugin indent on | |
set exrc | |
set hidden | |
set nobackup | |
set nocompatible | |
set nowritebackup | |
set secure | |
set shortmess+=c | |
set termguicolors | |
set guicursor= | |
set updatetime=200 | |
syntax enable | |
set cursorcolumn | |
set mouse=a | |
call plug#begin('~/.config/nvim/plugged') | |
""" Coc | |
Plug 'elixir-lsp/elixir-ls', { 'do': { -> g:ElixirLS.compile() } } | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'elixir-lsp/coc-elixir', {'do': 'yarn install && yarn prepack'} | |
Plug 'iamcco/coc-tailwindcss', {'do': 'yarn install --frozen-lockfile && yarn run build'} | |
" Plug 'thiagoramos23/coc-solargraph', {'do': 'npm install --frozen-lockfile'} | |
""" Built in LSP """ | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'kabouzeid/nvim-lspinstall' | |
Plug 'williamboman/nvim-lsp-installer' | |
" Plug 'liuchengxu/vista.vim' | |
""" Language Support ''" | |
Plug 'rust-lang/rust.vim' | |
Plug 'sheerun/vim-polyglot' | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'tpope/vim-rails' | |
Plug 'tpope/vim-rake' | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-endwise' | |
Plug 'elixir-editors/vim-elixir' | |
Plug 'tpope/vim-bundler' | |
Plug 'tpope/vim-rhubarb' | |
Plug 'vim-test/vim-test' | |
Plug 'mhinz/vim-mix-format' | |
"""Telescope | |
Plug 'nvim-lua/popup.nvim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'nvim-telescope/telescope-fzy-native.nvim' | |
" Git | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'shumphrey/fugitive-gitlab.vim' | |
""" Themes | |
Plug 'morhetz/gruvbox' | |
"" Utilities | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'stsewd/fzf-checkout.vim' | |
Plug 'preservim/nerdcommenter' | |
Plug 'voldikss/vim-floaterm' | |
Plug 'vimwiki/vimwiki' | |
" Airline | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
""Visual Multi | |
Plug 'mg979/vim-visual-multi', {'branch': 'master'} | |
"Blame | |
Plug 'tveskag/nvim-blame-line' | |
"Indent Line | |
Plug 'Yggdroot/indentLine' | |
"Dash Support | |
Plug 'rizzatti/dash.vim' | |
" Bookmarks | |
Plug 'MattesGroeger/vim-bookmarks' | |
"Tmux Navigator | |
Plug 'christoomey/vim-tmux-navigator' | |
"Vimux | |
Plug 'preservim/vimux' | |
Plug 'pgr0ss/vimux-ruby-test' | |
"Vim Code Review | |
Plug 'junkblocker/patchreview-vim' | |
Plug 'codegram/vim-codereview' | |
"To align parameters | |
Plug 'junegunn/vim-easy-align' | |
" Tab Bar | |
Plug 'kyazdani42/nvim-web-devicons' | |
Plug 'romgrk/barbar.nvim' | |
" Nvim Completion | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'hrsh7th/cmp-nvim-lsp' | |
Plug 'hrsh7th/cmp-buffer' | |
Plug 'hrsh7th/nvim-cmp' | |
" For vsnip user. | |
Plug 'hrsh7th/cmp-vsnip' | |
Plug 'hrsh7th/vim-vsnip' | |
call plug#end() | |
"'' END PLUG ''" | |
"'' VIM POST-PLUG ''" | |
"" Color Scheme | |
colorscheme gruvbox | |
set background=dark " Setting dark mode | |
set splitright | |
set encoding=utf-8 | |
set noerrorbells | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set nowrap | |
set number | |
set noshowmode | |
set relativenumber "" PogChamp | |
set scrolloff=3 | |
hi Normal guibg=NONE ctermbg=NONE | |
hi EndOfBuffer guibg=NONE ctermbg=NONE | |
"'' Definitions ''" | |
let mapleader = "," | |
" Mix Format Elixir | |
let g:mix_format_on_save = 1 | |
nmap <C-]> :CocCommand explorer --width 60<CR> | |
nmap <space>e :CocCommand explorer --preset floating<CR> | |
"'' VIM Keymaps ''" | |
nnoremap vv :vsp<CR> | |
nnoremap ss :sp<CR> | |
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr> | |
nnoremap <silent> <c-j> :TmuxNavigateDown<cr> | |
nnoremap <silent> <c-k> :TmuxNavigateUp<cr> | |
nnoremap <silent> <c-l> :TmuxNavigateRight<cr> | |
nnoremap <leader>ev :vsplit ~/.vimrc<cr> | |
nnoremap <leader>sv :source ~/.vimrc<cr> | |
nmap <silent> <leader>qq :nohlsearch<CR> | |
noremap <silent> zz % | |
nnoremap <silent> <Leader>co :copen 20<CR> | |
nnoremap <silent> <Leader>cl :cexpr []<CR> | |
nnoremap ;; <C-c> | |
" Outline LSP VISTA | |
" nnoremap <silent><nowait> <space>o :Vista show<cr> | |
let g:vista_sidebar_width = 50 | |
" | |
" " Copy to clipboard | |
vnoremap <leader>y "+y | |
nnoremap <leader>Y "+yg_ | |
nnoremap <leader>y "+y | |
nnoremap <leader>yy "+yy | |
" " Paste from clipboard | |
nnoremap <leader>p "+p | |
nnoremap <leader>P "+P | |
vnoremap <leader>p "+p | |
vnoremap <leader>P "+P | |
" Run Specs | |
nmap <silent> <leader>rn :TestNearest<CR> | |
nmap <silent> <leader>rf :TestFile<CR> | |
nmap <silent> <leader>rs :TestSuite<CR> | |
nmap <silent> <leader>rl :TestLast<CR> | |
nmap <silent> <leader>rv :TestVisit<CR> | |
let test#ruby#rspec#executable="bundle exec rspec" | |
let g:rspec_command = "bundle exec rspec {spec}" | |
let g:rspec_runner = "os_x_iterm2" | |
let g:test#strategy = "vimux" | |
let g:VimuxHeight = "30" | |
"let g:test#preserve_screen = 1 | |
" Test | |
"let g:test#strategy = "neoterm" | |
"let g:neoterm_shell = '$SHELL -l' " use the login shell | |
"let g:neoterm_default_mod = 'vert' | |
"let g:neoterm_autoscroll = 1 " autoscroll to the bottom when entering insert mode | |
"let g:neoterm_size = 80 | |
"let g:neoterm_fixedsize = 1 " fixed siz. The autosizing was wonky for me | |
"let g:neoterm_keep_term_open = 0 " when buffer closes, exit the terminal too. | |
"let test#ruby#rspec#options = { 'suite': '--profile 5' } | |
nnoremap <leader>r yiw:%s/\<<C-r>"\>/<C-r>"/gc<left><left><left> | |
nnoremap <leader>f yiw:/\<<C-r>"\><left><left><left> | |
let g:AutoClosePreserveDotReg = 0 | |
let g:fugitive_gitlab_domains = ['https://my.gitlab.com'] | |
nnoremap <silent> <leader>b :ToggleBlameLine<CR> | |
"'' Conquer of Completion (CoC) ''" | |
if filereadable(expand("~/.config/nvim/plugged/coc.nvim/plugin/coc.vim")) | |
let g:coc_global_extensions=[ | |
\'coc-actions', | |
\'coc-angular', | |
\'coc-css', | |
\'coc-cssmodules', | |
\'coc-docker', | |
\'coc-floaterm', | |
\'coc-go', | |
\'coc-highlight', | |
\'coc-html', | |
\'coc-json', | |
\'coc-markdownlint', | |
\'coc-marketplace', | |
\'coc-prettier', | |
\'coc-python', | |
\'coc-rust-analyzer', | |
\'coc-sh', | |
\'coc-snippets', | |
\'coc-sql', | |
\'coc-tabnine', | |
\'coc-tailwindcss', | |
\'coc-tsserver', | |
\'coc-yaml', | |
\'coc-rls', | |
\'coc-explorer', | |
\] | |
" Elixir LSP | |
let g:ElixirLS = {} | |
let ElixirLS.path = stdpath('config').'/plugged/elixir-ls' | |
let ElixirLS.lsp = ElixirLS.path.'/release/language_server.sh' | |
let ElixirLS.cmd = join([ | |
\ 'cp .release-tool-versions .tool-versions &&', | |
\ 'asdf install &&', | |
\ 'mix do', | |
\ 'local.hex --force --if-missing,', | |
\ 'local.rebar --force,', | |
\ 'deps.get,', | |
\ 'compile,', | |
\ 'elixir_ls.release &&', | |
\ 'rm .tool-versions' | |
\ ], ' ') | |
function ElixirLS.on_stdout(_job_id, data, _event) | |
let self.output[-1] .= a:data[0] | |
call extend(self.output, a:data[1:]) | |
endfunction | |
let ElixirLS.on_stderr = function(ElixirLS.on_stdout) | |
function ElixirLS.on_exit(_job_id, exitcode, _event) | |
if a:exitcode[0] == 0 | |
echom '>>> ElixirLS compiled' | |
else | |
echoerr join(self.output, ' ') | |
echoerr '>>> ElixirLS compilation failed' | |
endif | |
endfunction | |
function ElixirLS.compile() | |
let me = copy(g:ElixirLS) | |
let me.output = [''] | |
echom '>>> compiling ElixirLS' | |
let me.d = jobstart('cd ' . me.path . ' && git pull && ' . me.cmd, me) | |
endfunction | |
" If you want to | |
" then have the post-update hook use this function instead: | |
" function ElixirLS.compile_sync() | |
" echom '>>> compiling ElixirLS' | |
" silent call system(g:ElixirLS.cmd) | |
" echom '>>> ElixirLS compiled' | |
" endfunction | |
" Then, update the Elixir language server | |
"call coc#config('elixir', { | |
" \ 'command': g:ElixirLS.lsp, | |
" \ 'filetypes': ['elixir', 'eelixir'] | |
" \}) | |
"call coc#config('elixir.pathToElixirLS', g:ElixirLS.lsp) | |
" END OF ELIXIR LSP | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
if has("patch-8.1.1564") | |
" Recently vim can merge signcolumn and number column into one | |
set signcolumn=number | |
else | |
set signcolumn=yes | |
endif | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
if has('nvim') | |
inoremap <silent><expr> <c-space> coc#refresh() | |
else | |
inoremap <silent><expr> <c-@> coc#refresh() | |
endif | |
" Make <CR> auto-select the first completion item and notify coc.nvim to | |
" format on enter, <cr> could be remapped by other vim plugin | |
" inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
" \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
" Use `[g` and `]g` to navigate diagnostics | |
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" GoTo code navigation. | |
nmap <silent> gd <Plug>(coc-definition) | |
"nmap <silent> gt <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
elseif (coc#rpc#ready()) | |
call CocActionAsync('doHover') | |
else | |
execute '!' . &keywordprg . " " . expand('<cword>') | |
endif | |
endfunction | |
" Highlight the symbol and its references when holding the cursor. | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Symbol renaming. | |
nmap <leader>rna <Plug>(coc-rename) | |
" Formatting selected code. | |
" xmap <leader>f <Plug>(coc-format-selected) | |
" nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder. | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap keys for applying codeAction to the current buffer. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Map function and class text objects | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
xmap if <Plug>(coc-funcobj-i) | |
omap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap af <Plug>(coc-funcobj-a) | |
xmap ic <Plug>(coc-classobj-i) | |
omap ic <Plug>(coc-classobj-i) | |
xmap ac <Plug>(coc-classobj-a) | |
omap ac <Plug>(coc-classobj-a) | |
" Remap <C-f> and <C-b> for scroll float windows/popups. | |
if has('nvim-0.4.0') || has('patch-8.2.0750') | |
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" | |
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" | |
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
endif | |
" Use CTRL-S for selections ranges. | |
" Requires 'textDocument/selectionRange' support of language server. | |
nmap <silent> <C-s> <Plug>(coc-range-select) | |
xmap <silent> <C-s> <Plug>(coc-range-select) | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Mappings for CoCList | |
" Show all diagnostics. | |
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions. | |
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> | |
" Show commands. | |
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document. | |
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols. | |
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list. | |
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> | |
endif | |
"'' Floatterm ''" | |
if filereadable(expand("~/.config/nvim/plugged/vim-floaterm/plugin/floaterm.vim")) | |
nnoremap <leader>fl :FloatermNew --autoclose=2 --height=0.9 --width=0.9 --wintype=floating lazygit<CR> | |
nnoremap <leader>fr :FloatermNew --autoclose=2 --height=0.75 --width=0.75 --wintype=floating ranger<CR> | |
nnoremap <leader>ft :FloatermNew --autoclose=2 --height=0.9 --width=0.9 --wintype=floating<CR> | |
endif | |
"'' FZF ''" | |
if filereadable(expand("~/.config/nvim/plugged/fzf.vim/plugin/fzf.vim")) | |
let $FZF_DEFAULT_COMMAND='rg --files --follow --no-ignore-vcs --hidden -g "!{**/node_modules/**,.git/*,**/*.pem,**/*.beam}"' | |
let $FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' | |
nnoremap <C-p> :Files<CR> | |
nnoremap <leader>. :Buffers<CR> | |
nnoremap <leader>o :%bd\|e#\|bd#<cr> | |
nnoremap <C-f> :Rg<CR> | |
endif | |
autocmd FileType * let b:coc_suggest_disable = 1 | |
" Find files using Telescope command-line sugar. | |
" nnoremap <C-p> <cmd>Telescope find_files<cr> | |
" nnoremap <leader>fg <cmd>Telescope live_grep<cr> | |
" nnoremap <leader>. <cmd>Telescope buffers<cr> | |
nnoremap <leader>fh <cmd>Telescope help_tags<cr> | |
" Using Lua functions | |
" nnoremap <C-p> <cmd>lua require('telescope.builtin').find_files()<cr> | |
" nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr> | |
" nnoremap <leader>. <cmd>lua require('telescope.builtin').buffers()<cr> | |
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr> | |
" Move to previous/next | |
nnoremap <silent> <leader>p :BufferPrevious<CR> | |
nnoremap <silent> <leader>[ :BufferNext<CR> | |
" Re-order to previous/next | |
nnoremap <silent> <A-<> :BufferMovePrevious<CR> | |
nnoremap <silent> <A->> :BufferMoveNext<CR> | |
" Goto buffer in position... | |
nnoremap <silent> <leader>1 :BufferGoto 1<CR> | |
nnoremap <silent> <leader>2 :BufferGoto 2<CR> | |
nnoremap <silent> <leader>3 :BufferGoto 3<CR> | |
nnoremap <silent> <leader>4 :BufferGoto 4<CR> | |
nnoremap <silent> <leader>5 :BufferGoto 5<CR> | |
nnoremap <silent> <leader>6 :BufferGoto 6<CR> | |
nnoremap <silent> <leader>7 :BufferGoto 7<CR> | |
nnoremap <silent> <leader>8 :BufferGoto 8<CR> | |
nnoremap <silent> <leader>l :BufferLast<CR> | |
" Close buffer | |
nnoremap <silent> <leader>c :BufferClose<CR> | |
" Wipeout buffer | |
" :BufferWipeout<CR> | |
" Close commands | |
" :BufferCloseAllButCurrent<CR> | |
" :BufferCloseBuffersLeft<CR> | |
" :BufferCloseBuffersRight<CR> | |
" Magic buffer-picking mode | |
nnoremap<silent> <C-s> :BufferPick<CR> | |
" Sort automatically by... | |
nnoremap <silent> <Space>bd :BufferOrderByDirectory<CR> | |
nnoremap <silent> <Space>bl :BufferOrderByLanguage<CR> | |
" NOTE: If barbar's option dict isn't created yet, create it | |
let bufferline = get(g:, 'bufferline', {}) | |
" Enable/disable animations | |
let bufferline.animation = v:true | |
" Enable/disable auto-hiding the tab bar when there is a single buffer | |
let bufferline.auto_hide = v:true | |
" Enable/disable current/total tabpages indicator (top right corner) | |
let bufferline.tabpages = v:true | |
" Enable/disable close button | |
let bufferline.closable = v:true | |
" Enables/disable clickable tabs | |
" - left-click: go to buffer | |
" - middle-click: delete buffer | |
let bufferline.clickable = v:true | |
" Enable/disable icons | |
" if set to 'numbers', will show buffer index in the tabline | |
" if set to 'both', will show buffer index and icons in the tabline | |
let bufferline.icons = v:true | |
" Sets the icon's highlight group. | |
" If false, will use nvim-web-devicons colors | |
let bufferline.icon_custom_colors = v:false | |
" Configure icons on the bufferline. | |
let bufferline.icon_separator_active = '▎' | |
let bufferline.icon_separator_inactive = '▎' | |
let bufferline.icon_close_tab = ' ' | |
let bufferline.icon_close_tab_modified = '●' | |
" Sets the maximum padding width with which to surround each tab. | |
let bufferline.maximum_padding = 4 | |
" Sets the maximum buffer name length. | |
let bufferline.maximum_length = 30 | |
" If set, the letters for each buffer in buffer-pick mode will be | |
" assigned based on their name. Otherwise or in case all letters are | |
" already assigned, the behavior is to assign letters in order of | |
" usability (see order below) | |
let bufferline.semantic_letters = v:true | |
" New buffer letters are assigned in this order. This order is | |
" optimal for the qwerty keyboard layout but might need adjustement | |
" for other layouts. | |
let bufferline.letters = | |
\ 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP' | |
" Sets the name of unnamed buffers. By default format is "[Buffer X]" | |
" where X is the buffer number. But only a static string is accepted here. | |
let bufferline.no_name_title = v:null | |
set completeopt=menu,menuone,noselect | |
lua << EOF | |
--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 <c-x><c-o> | |
-- 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', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) | |
-- buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) | |
-- buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) | |
-- buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) | |
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) | |
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | |
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | |
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | |
-- buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | |
-- buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | |
-- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | |
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | |
-- buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) | |
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) | |
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) | |
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) | |
-- buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) | |
--end | |
-- | |
----local path_to_elixirls = "/User/branches/.config/nvim/plugged/elixir-ls/release/language_server.sh" | |
--local path_to_elixirls = "/Users/branches/.local/share/nvim/lsp_servers/elixir/elixir-ls/language_server.sh" | |
--local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) | |
-- | |
--local servers = { "solargraph", "elixirls" } | |
--for _, lsp in ipairs(servers) do | |
-- if lsp == "elixirls" then | |
-- nvim_lsp[lsp].setup { | |
-- capabilities = capabilities, | |
-- on_attach = on_attach, | |
-- cmd = { path_to_elixirls }, | |
-- settings = { | |
-- elixirLS = { | |
-- -- I choose to disable dialyzer for personal reasons, but | |
-- -- I would suggest you also disable it unless you are well | |
-- -- aquainted with dialzyer and know how to use it. | |
-- dialyzerEnabled = true, | |
-- -- I also choose to turn off the auto dep fetching feature. | |
-- -- It often get's into a weird state that requires deleting | |
-- -- the .elixir_ls directory and restarting your editor. | |
-- fetchDeps = false | |
-- } | |
-- } | |
-- } | |
-- else | |
-- nvim_lsp[lsp].setup { | |
-- on_attach = on_attach, | |
-- flags = { | |
-- debounce_text_changes = 150, | |
-- } | |
-- } | |
-- end | |
--end | |
-- | |
-- -- Setup nvim-cmp. | |
--local cmp = require'cmp' | |
-- | |
--cmp.setup({ | |
-- snippet = { | |
-- expand = function(args) | |
-- -- For `vsnip` user. | |
-- vim.fn["vsnip#anonymous"](args.body) | |
-- | |
-- -- For `luasnip` user. | |
-- -- require('luasnip').lsp_expand(args.body) | |
-- | |
-- -- For `ultisnips` user. | |
-- -- vim.fn["UltiSnips#Anon"](args.body) | |
-- end, | |
-- }, | |
-- mapping = { | |
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4), | |
-- ['<C-f>'] = cmp.mapping.scroll_docs(4), | |
-- ['<C-Space>'] = cmp.mapping.complete(), | |
-- ['<C-e>'] = cmp.mapping.close(), | |
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), | |
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), | |
-- }, | |
-- sources = { | |
-- { name = 'nvim_lsp' }, | |
-- | |
-- -- For vsnip user. | |
-- { name = 'vsnip' }, | |
-- | |
-- -- For luasnip user. | |
-- -- { name = 'luasnip' }, | |
-- | |
-- -- For ultisnips user. | |
-- -- { name = 'ultisnips' }, | |
-- | |
-- { name = 'buffer' }, | |
-- } | |
--}) | |
--EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment