~mlb/dotfiles

277f50b906d580cbcfe359079d0d42482a54890f — Matías Larre Borges 5 months ago d0bd096
Updating plugin list
M nvim/conf/00-plugins.vim => nvim/conf/00-plugins.vim +13 -0
@@ 1,7 1,11 @@
call plug#begin(stdpath('data') . '/plugged')
Plug 'junegunn/vim-emoji'                               " Macros to refer to emojis

Plug 'itchyny/lightline.vim'                            " Improved status line
Plug 'macthecadillac/lightline-gitdiff'                 " Git integration in lightline

Plug 'airblade/vim-gitgutter'                           " Git integration in gutter

Plug 'Shougo/defx.nvim', {
            \'do': ':UpdateRemotePlugins' }             " File browser
Plug 'kristijanhusak/defx-icons'                        " Nice icons in defx


@@ 21,8 25,17 @@ Plug 'tpope/vim-obsession'                              " Session management
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }     " fzf integration
Plug 'junegunn/fzf.vim'

Plug 'elixir-lsp/elixir-ls', {
            \ 'do': { -> g:ElixirLS.compile() } }       " Installs elixir language server
Plug 'elixir-editors/vim-elixir'                        " Elixir support
Plug 'mhinz/vim-mix-format'                             " Elixir auto-formatting

Plug 'chrisbra/colorizer'                               " Colorizes colornames and codes

Plug 'nvim-treesitter/nvim-treesitter'                  " treesitter support (requires neovim nightly)

Plug 'nvim-lua/popup.nvim'                              " telescope: popup
Plug 'nvim-lua/plenary.nvim'                            " telescope: plenary
Plug 'nvim-lua/telescope.nvim'                          " telescope: telescope

call plug#end()

M nvim/conf/50-coc.vim => nvim/conf/50-coc.vim +46 -0
@@ 1,4 1,6 @@
" COC config {{{

"
set hidden

" Smaller updatetime for CursorHold & CursorHoldI


@@ 124,3 126,47 @@ let g:coc_snippet_prev = '<c-k>'
imap <C-j> <Plug>(coc-snippets-expand-jump)
" }}}

" Elixir-LS config {{{
let g:ElixirLS = {}
let ElixirLS.path = stdpath('data').'/plugged/elixir-ls'
let ElixirLS.lsp = ElixirLS.path.'/release/language_server.sh'
let ElixirLS.cmd = join([
        \ 'asdf install &&',
        \ 'mix do',
        \ 'local.hex --force --if-missing,',
        \ 'local.rebar --force,',
        \ 'deps.get,',
        \ 'compile,',
        \ 'elixir_ls.release'
        \ ], ' ')

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.id = jobstart('cd ' . me.path . ' && git pull && ' . me.cmd, me)
endfunction

" Update the Elixir language server
call coc#config('elixir', {
  \ 'command': g:ElixirLS.lsp,
  \ 'filetypes': ['elixir', 'eelixir']
  \})
call coc#config('elixir.pathToElixirLS', g:ElixirLS.lsp)
" }}}

A nvim/conf/50-gitgutter.vim => nvim/conf/50-gitgutter.vim +4 -0
@@ 0,0 1,4 @@
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '~'
let g:gitgutter_sign_removed = '-'
let g:gitgutter_sign_modified_removed = emoji#for('scissors')

M nvim/conf/50-lightline.vim => nvim/conf/50-lightline.vim +10 -2
@@ 13,7 13,7 @@ let g:lightline.inactive = {
let g:lightline.active = {
            \ 'left': [ [ 'mode', 'paste', ],
            \           [ 'gitbranch', 'readonly', 'relativepath', 'modified' ],
            \           [ 'currentFunc' ] ],
            \           [ 'currentFuncCoC', 'currentFuncTS' ] ],
            \ 'right': [ [ 'lineinfo' ],
            \            [ 'devicons_filetype', 'devicons_fileformat'],
            \            [ 'obsession' ],


@@ 28,7 28,8 @@ let g:lightline.tabline = {

let g:lightline.component = {
            \ 'myCurrentDir': "\uf413 %{fnamemodify(getcwd(), ':t')}",
            \ 'currentFunc': '%{CocCurrentFunction()}',
            \ 'currentFuncCoC': '%{CocCurrentFunction()}',
            \ 'currentFuncTS': '%{TreeSitterCurrentElement()}',
            \ 'obsession': '%{ObsessionStatusEnhance()}',
            \ 'gitstatus': '%{lightline_gitdiff#get_status()}',
            \ 'bufinfo': '%{bufname("%")}:%{bufnr("%")}',


@@ 118,6 119,13 @@ let g:lightline.component_visible_condition = {

" Helper functions {{{

" Current element using TreeSitter
function! TreeSitterCurrentElement()
    let x = luaeval("require'nvim-treesitter'.statusline(50)")
    return x !=# '' ? "\uf450 [" . x . ']' : ''
endfunction

" Indicator for whether session is being recorded
function! ObsessionStatusEnhance()
    let obsStatus = ObsessionStatus("\uf04b","\uf04c")
    if obsStatus !=# ""

A nvim/conf/50-treesitter.vim => nvim/conf/50-treesitter.vim +34 -0
@@ 0,0 1,34 @@
lua <<EOF
require'nvim-treesitter'.statusline(size) -- statusline indicator
require'nvim-treesitter.configs'.setup {
    highlight = {
        enable = true,                    -- false will disable the whole extension
        disable = { },        -- list of language that will be disabled
    },
    incremental_selection = {
        enable = true,
        disable = { },
        keymaps = {                       -- mappings for incremental selection (visual mappings)
          init_selection = 'gnn',         -- maps in normal mode to init the node/scope selection
          node_incremental = "grn",       -- increment to the upper named parent
          scope_incremental = "grc",      -- increment to the upper scope (as defined in locals.scm)
          node_decremental = "grm",       -- decrement to the previous node
        }
    },
    refactor = {
      highlight_defintions = {
        enable = true
      },
      smart_rename = {
        enable = true,
        smart_rename = "grr"              -- mapping to rename reference under cursor
      },
      navigation = {
        enable = true,
        goto_definition = "gnd",          -- mapping to go to definition of symbol under cursor
        list_definitions = "gnD"          -- mapping to list all definitions in current file
      }
    },
    ensure_installed = 'all' -- one of 'all', 'language', or a list of languages
}
EOF

M nvim/conf/70-mappings.vim => nvim/conf/70-mappings.vim +4 -5
@@ 11,9 11,8 @@ map <silent><F1> :Defx -columns=git:icons:filename:type -split=vertical -winwidt
nmap <silent><Leader>f :Defx -columns=git:icons:filename:type `expand('%:p:h')` -search=`expand('%:p')`<CR>
" }}}

" fzf {{{
nnoremap <silent> <Leader>b :Buffers<CR>
nnoremap <silent> <Leader>o :Files .<CR>
nnoremap <silent> <Leader>A :Rg <cword> .<CR>
nnoremap <silent> <Leader>s :Rg <CR>
" telescope {{{
nnoremap <silent> gf <cmd>lua require('telescope.builtin').git_files(require('telescope.themes').get_dropdown())<CR>
nnoremap <silent> gr <cmd>lua require('telescope.builtin').treesitter(require('telescope.themes').get_dropdown())<CR>
nnoremap <silent> <Leader>s <cmd>lua require('telescope.builtin').grep_string(require('telescope.themes').get_dropdown())<CR>
" }}}