summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorMichal Idziorek <michal.idziorek@citi.com>2023-04-28 19:28:02 +0200
committerMichal Idziorek <michal.idziorek@citi.com>2023-04-28 19:28:02 +0200
commit4150fc776fa2c3889d541eb72fedd98a5084cd7b (patch)
treefc11af05ebc0f0a4354d6a4ead4c07c2f30fe5ba /nvim
parent7e9d60ab13d69ec20826e26b8cd9797f824fd256 (diff)
start init.vim cleanup/refresh
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/init.vim171
-rw-r--r--nvim/.config/nvim/plugin/test.lua1
-rw-r--r--nvim/.config/nvim/plugin/test.vim1
3 files changed, 110 insertions, 63 deletions
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index bb42647..7cd0d16 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -1,22 +1,39 @@
+" ============================
" Miguel's Fresh Neovim Config
-" since 29th Apr 2021
+" ============================
+" 29th Apr 2021 - 27th Apr 2023
"
-" link ./init.vim <- ~/.config/nvim/init.vim
-" link ./plugin/ <- ~/.config/nvim/plugin/
+" {{{ INSTALLATION
"
-" 1. install vim-plug / why not :h packages?
-" 2. run :PlugUpdate
-" 3. run :checkhealth
+" 1. $ stow nvim
+" ./init.vim <- ~/.config/nvim/init.vim
+" ./plugin/ <- ~/.config/nvim/plugin/
+"
+" 2. install vim-plug (https://github.com/junegunn/vim-plug)
+" 3. :PlugUpdate
+" 4. :checkhealth (locale problem??)
+"
+" }}}
-" TODO
-" watch youtube: ThePrimeagen / GregHurrell
-" split into mutiple files
-" tree-sitter parser generator
-" nvim-telescope/telescope plugin
+" {{{ TODO
+"
+" watch ThePrimeagen & GregHurrell
+" split into mutiple files
+" :help treesitter
+" consider/compare telescope.nvim or fzf-lua
+"
+" }}}
" {{{ vim-plug
call plug#begin('~/.vim/plugged')
+" colors
+Plug 'jnurmine/Zenburn'
+
+" lualine
+Plug 'nvim-lualine/lualine.nvim'
+
+" tpope!
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-sensible'
@@ -29,6 +46,7 @@ Plug 'tpope/vim-eunuch'
Plug 'godlygeek/tabular'
+" consider telescope & fzf-lua instead below
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
@@ -38,40 +56,39 @@ Plug 'majutsushi/tagbar'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
-"Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
+" lsp
Plug 'neovim/nvim-lspconfig'
+Plug 'nvim-lua/lsp-status.nvim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'mbbill/undotree'
-" haskell related
+" LANGUAGE SPECIFIC
+
+" Haskell
Plug 'neovimhaskell/haskell-vim'
-Plug 'alx741/vim-stylishask'
+Plug 'alx741/vim-stylishask' " let hls run this?
Plug 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' }
-" agda related / requires python2 / pip2 :(
-Plug 'derekelkins/agda-vim'
-
-" colors / style
-" rafi/awesome-vim-colorschemes?
-" gruvbox-community/gruvbox?
-Plug 'jnurmine/Zenburn'
-
-Plug 'vim-airline/vim-airline'
-Plug 'vim-airline/vim-airline-themes'
+" Agda
+Plug 'derekelkins/agda-vim' "this requires python2 / pip2 :(
call plug#end()
" }}}
-" 256 colorscheme
+" {{{ colors
colorscheme zenburn
-" experimental
-" autocmd TextChanged,InsertLeave * if &readonly==0 && filereadable(bufname('%')) | silent update | endif
+syntax on
+hi DiffAdd ctermfg=none ctermbg=23
+hi DiffDelete ctermfg=none ctermbg=52
+hi DiffChange ctermfg=none ctermbg=236
+hi DiffText ctermfg=none ctermbg=94
+" }}}
-" {{{ misc
+" {{{ options
set nocompatible
set cursorcolumn
set cursorline
@@ -83,36 +100,23 @@ set relativenumber
set hidden
set colorcolumn=80
set backspace=2
-" }}}
-
set noswapfile
set nobackup
set undofile
set undodir=~/.vim/undodir
-
-" set guicursor=
set noerrorbells
-
-" disable preview window on autocompletion
-set completeopt-=preview
-
-set updatetime=300
+set updatetime=1000
set signcolumn=yes
-
set mouse=a
-
-syntax on
+" disable preview window on autocompletion
+set completeopt-=preview
+" }}}
" detect type and autoload plugin and indent files
filetype plugin indent on
let g:deoplete#enable_at_startup = 1
-let g:airline_theme='wombat'
-let g:airline_powerline_fonts = 1
-
-lua require('lspconfig').hls.setup{}
-
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
@@ -198,7 +202,7 @@ nnoremap <leader>dd :wincmd gf<cr>:Gvdiff! develop2<cr>
nnoremap <leader>tc :tabc<cr>
" ctrl-space auto complete in insert mode
-inoremap <C-Space> <C-N>
+inoremap <C-Space> <C-X><C-O>
" FZF settings
nmap <leader>f :Files<cr>| " fuzzy find files in the working directory (where you launched Vim from)
@@ -211,16 +215,18 @@ nmap <leader>t :Tags<cr>| " fuzzy find tags
" haskell specific
augroup filetype_haskell
autocmd!
- autocmd Filetype haskell nnoremap <buffer> <C-]> :lua vim.lsp.buf.definition()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>i :lua vim.lsp.buf.hover()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>q :lua vim.lsp.buf.code_action()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>r :lua vim.lsp.buf.references()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>s :lua vim.lsp.buf.document_symbol()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>S :lua vim.lsp.buf.workspace_symbol()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>m :lua vim.diagnostic.open_float()<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>e :lua vim.diagnostic.setloclist({open = true})<CR>
- autocmd Filetype haskell nnoremap <buffer> <leader>E :lua vim.diagnostic.setqflist({open = true})<CR>
-
+ autocmd Filetype haskell nnoremap <buffer> <C-]> :lua vim.lsp.buf.definition()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>i :lua vim.lsp.buf.hover()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>q :lua vim.lsp.buf.code_action()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>r :lua vim.lsp.buf.references()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>s :lua vim.lsp.buf.document_symbol()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>S :lua vim.lsp.buf.workspace_symbol()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>m :lua vim.diagnostic.open_float()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>e :lua vim.diagnostic.setloclist({open = true})<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>E :lua vim.diagnostic.setqflist({open = true})<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>l :lua vim.lsp.codelens.run()<CR>
+ autocmd Filetype haskell nnoremap <buffer> <leader>L :lua vim.lsp.codelens.refresh()<CR>
+ autocmd Filetype haskell autocmd InsertLeave <buffer> lua vim.lsp.codelens.refresh()
" vim.lsp.buf.formatting()
" vim.lsp.buf.rename() ?
" print(vim.lsp.buf.server_ready())
@@ -228,15 +234,12 @@ augroup filetype_haskell
" autocmd Filetype haskell nnoremap <buffer> <leader>x :call LanguageClient#explainErrorAtPoint()<CR>
autocmd Filetype haskell setlocal softtabstop=2
autocmd Filetype haskell setlocal shiftwidth=2
+ autocmd Filetype haskell setlocal omnifunc=v:lua.vim.lsp.omnifunc
+
augroup END
-" }}}
-
-hi DiffAdd ctermfg=none ctermbg=23
-hi DiffDelete ctermfg=none ctermbg=52
-hi DiffChange ctermfg=none ctermbg=236
-hi DiffText ctermfg=none ctermbg=94
+" }}}
" write current file as superuser
cmap w!! SudoWrite
@@ -285,3 +288,47 @@ let g:tagbar_type_haskell = {
\ 'instance' : 'ft'
\ }
\ }
+
+" {{{ lua
+lua << END
+local lsp_status = require('lsp-status')
+lsp_status.register_progress()
+
+require('lualine').setup
+ { options = { icons_enabled = true
+ , theme = 'auto'
+ , component_separators = { left = '', right = ''}
+ , section_separators = { left = '', right = ''}
+ , disabled_filetypes = { statusline = {}, winbar = {}, }
+ , ignore_focus = {}
+ , always_divide_middle = true
+ , globalstatus = false
+ , refresh = { statusline = 1000, tabline = 1000, winbar = 1000, }
+ }
+ , sections = { lualine_a = {'mode'}
+ , lualine_b = {'branch', 'diff', 'diagnostics'}
+ , lualine_c = { "filename", 'data', "require'lsp-status'.status()" }
+ , 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 = {}
+ , winbar = {}
+ , inactive_winbar = {}
+ , extensions = {}
+ }
+
+require('lspconfig').hls.setup
+ { autostart = true
+ , cmd = { "haskell-language-server-wrapper", "--lsp" }
+ , settings = { haskell = { checkProject = true
+ }
+ }
+ }
+END
+" }}}
diff --git a/nvim/.config/nvim/plugin/test.lua b/nvim/.config/nvim/plugin/test.lua
new file mode 100644
index 0000000..6106fc3
--- /dev/null
+++ b/nvim/.config/nvim/plugin/test.lua
@@ -0,0 +1 @@
+print ('hello lua')
diff --git a/nvim/.config/nvim/plugin/test.vim b/nvim/.config/nvim/plugin/test.vim
deleted file mode 100644
index 09990d4..0000000
--- a/nvim/.config/nvim/plugin/test.vim
+++ /dev/null
@@ -1 +0,0 @@
-echo "hello"