Last active
February 26, 2024 17:11
-
-
Save neanias/6d8a1f695b6246d1fbd7 to your computer and use it in GitHub Desktop.
[UNMAINTAINED] Portable neovim setup
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
#!/bin/bash | |
cd ~ | |
echo "Linking .nvimrc into home directory (~)" | |
if [ -z "$XDG_CONFIG_HOME" ]; then | |
export XDG_CONFIG_HOME=~/.config | |
fi | |
if [ ! -d $XDG_CONFIG_HOME/nvim ]; then | |
echo "Creating $XDG_CONFIG_HOME/nvim..." | |
mkdir -p "$XDG_CONFIG_HOME/nvim/lua" | |
fi | |
ln -Fis $HOME/nvimrc/init.vim $XDG_CONFIG_HOME/nvim/ | |
echo "Linking update_nvimrc into home directory ($HOME)" | |
ln -Fis $HOME/nvimrc/update_nvimrc . | |
echo | |
echo "Installing plugins" | |
exec nvim +PackerInstall +PackerCompile +qall | |
echo |
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 nocompatible " be iMproved, required | |
lua << EOF | |
local execute = vim.api.nvim_command | |
local fn = vim.fn | |
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' | |
if fn.empty(fn.glob(install_path)) > 0 then | |
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) | |
execute 'packadd packer.nvim' | |
end | |
vim.cmd [[packadd packer.nvim]] | |
return require("packer").startup({function(use) | |
-- Let packer manage itself | |
use "wbthomason/packer.nvim" | |
use "Raimondi/delimitMate" | |
-- { Neovim 0.5.0 plugins | |
-- Treesitter | |
use { | |
"nvim-treesitter/nvim-treesitter", | |
run = ':TSUpdate', | |
config = function() | |
require('nvim-treesitter.configs').setup { | |
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages | |
ignore_install = {}, -- List of parsers to ignore installing | |
highlight = { | |
enable = true, -- false will disable the whole extension | |
disable = {}, -- list of language that will be disabled | |
}, | |
indent = { | |
enable = true, | |
}, | |
refactor = { | |
smart_rename = { | |
enable = true, | |
keymaps = { | |
smart_rename = "grr", | |
}, | |
}, | |
navigation = { | |
enable = true, | |
keymaps = { | |
goto_definition = "gd", | |
list_definitions = "gD", | |
list_definitions_toc = "gO", | |
goto_next_usage = "<a-*>", | |
goto_previous_usage = "<a-#>", | |
}, | |
}, | |
} | |
} | |
end | |
} -- We recommend updating the parsers on update | |
use "nvim-treesitter/nvim-treesitter-refactor" | |
use { | |
"romgrk/nvim-treesitter-context", | |
config = function() | |
require('treesitter-context.config').setup { enable = true, } | |
end | |
} | |
-- To keep track of bindings | |
use { | |
"folke/which-key.nvim", | |
event = "VimEnter", | |
config = function() | |
require("which-key").setup() | |
end | |
} | |
use { | |
"folke/trouble.nvim", | |
requires = "kyazdani42/nvim-web-devicons", | |
config = function() | |
require("trouble").setup() | |
end | |
} | |
-- Finders | |
use { | |
"nvim-telescope/telescope.nvim", | |
requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}}, | |
config = function() | |
local trouble = require("trouble.providers.telescope") | |
local telescope = require("telescope") | |
telescope.setup { | |
defaults = { | |
mappings = { | |
i = { ["<C-t>"] = trouble.open_with_trouble }, | |
n = { ["<C-t>"] = trouble.open_with_trouble }, | |
}, | |
}, | |
} | |
end | |
} | |
use { | |
"neovim/nvim-lspconfig", | |
config = function() | |
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', '<comma>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | |
buf_set_keymap('n', '<comma>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | |
buf_set_keymap('n', '<comma>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | |
buf_set_keymap('n', '<comma>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | |
buf_set_keymap('n', '<comma>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | |
buf_set_keymap('n', '<comma>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | |
buf_set_keymap('n', 'grf', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | |
buf_set_keymap('n', '<comma>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', '<comma>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) | |
buf_set_keymap('n', '<comma>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) | |
end | |
-- Use a loop to conveniently call 'setup' on multiple servers and | |
-- map buffer local keybindings when the language server attaches | |
local servers = { "solargraph" } | |
for _, lsp in ipairs(servers) do | |
nvim_lsp[lsp].setup { | |
on_attach = on_attach, | |
flags = { | |
debounce_text_changes = 150, | |
} | |
} | |
end | |
end | |
} | |
use { | |
"hoob3rt/lualine.nvim", | |
requires = {"kyazdani42/nvim-web-devicons", opt = true}, | |
as = "lualine", | |
config = function() | |
local background = vim.opt.background:get() | |
require('lualine').setup { options = { theme = 'solarized_'..background } } | |
end | |
} | |
-- } | |
-- TPope time | |
use { | |
"tpope/vim-abolish", | |
"tpope/vim-endwise", | |
"tpope/vim-eunuch", | |
"tpope/vim-fugitive", | |
"tpope/vim-obsession", | |
"tpope/vim-projectionist", | |
"tpope/vim-repeat", | |
"tpope/vim-surround", | |
"tpope/vim-unimpaired", | |
} | |
use { "tpope/vim-rails", ft = { "ruby", "eruby", "haml", "slim", "coffee" } } | |
use { "tpope/vim-rake", ft = "ruby" } | |
-- Better commenting | |
use "preservim/nerdcommenter" | |
-- Nice file browsing | |
use { | |
"kyazdani42/nvim-tree.lua", | |
requires = "kyazdani42/nvim-web-devicons", | |
cmd = { "NvimTreeToggle", "NvimTreeFindFile" } | |
} | |
use { | |
"mbbill/undotree", | |
cmd = "UndotreeToggle" | |
} | |
-- Check that it actually has ctags before kick-off | |
use { | |
"preservim/tagbar", | |
cond = function() | |
return vim.call("executable", "ctags") == 1 | |
end, | |
cmd = "TagbarToggle" | |
} | |
-- Snippets | |
use "honza/vim-snippets" | |
-- Syntax & languages | |
-- Do I still need ALE? | |
use { | |
"dense-analysis/ale", | |
ft = {"typescript", "rust", "ruby"}, | |
cmd = "ALEEnable", | |
config = "vim.cmd[[ALEEnable]]" | |
} | |
use "sheerun/vim-polyglot" | |
use { "jmcantrell/vim-virtualenv", ft = "python" } | |
use { "slashmili/alchemist.vim", ft = "elixir" } | |
use { "neoclide/coc.nvim", branch = "release" } | |
use { | |
"neoclide/coc-solargraph", | |
run = "yarn install --frozen-lockfile", | |
cond = function() return vim.call("executable", "solargraph") == 1 end | |
} | |
-- EditorConfig | |
use "editorconfig/editorconfig-vim" | |
-- Pretty colours | |
use "ishan9299/nvim-solarized-lua" | |
use "junegunn/rainbow_parentheses.vim" | |
-- Other stuff | |
use { 'junegunn/vim-easy-align', cmd = "EasyAlign" } | |
use { 'AndrewRadev/splitjoin.vim', branch = 'main' } | |
use 'AndrewRadev/switch.vim' | |
use { 'ck3g/vim-change-hash-syntax', ft = "ruby" } | |
use 'nathanaelkane/vim-indent-guides' | |
use { | |
"nelstrom/vim-textobj-rubyblock", | |
requires = { | |
{"lucapette/vim-textobj-underscore"}, {"kana/vim-textobj-user"} | |
} | |
} | |
use 'airblade/vim-gitgutter' | |
use 'vim-scripts/YankRing.vim' | |
-- Test runner | |
use { 'vim-test/vim-test', cmd = { "TestFile", "TestSuite", "TestNearest" } } | |
-- Better search | |
use "henrik/vim-indexed-search" | |
use "haya14busa/incsearch.vim" | |
-- Vim motions on speed | |
use { | |
"phaazon/hop.nvim", | |
as = "hop", | |
cmd = { "HopWord", "HopChar1" }, | |
config = function() | |
require("hop").setup {} | |
end | |
} | |
-- FZF | |
use { | |
"junegunn/fzf.vim", | |
requires = { "junegunn/fzf.vim", run = function() vim.fn["fzf#install()"](0) end } | |
} | |
end, | |
config = { | |
display = { | |
open_fn = require("packer.util").float, | |
}, | |
}, | |
}) | |
EOF | |
filetype plugin indent on " required | |
set number | |
set ruler | |
set autoindent | |
set smartindent | |
set expandtab | |
set smarttab | |
set showmode | |
set showcmd | |
set tabstop=4 | |
set shiftwidth=2 | |
set autoread | |
runtime macros/matchit.vim | |
" Needed for solarized | |
set termguicolors | |
syntax enable | |
set hlsearch | |
set ignorecase | |
set smartcase | |
set lazyredraw | |
set magic | |
set hidden | |
set showmatch | |
set mat=2 | |
set noswapfile | |
let mapleader="," | |
set so=8 | |
set wildignore=*.o,*~,*.pyc | |
set cmdheight=1 | |
set ffs=unix,dos,mac | |
" Fix backspace not working | |
set backspace=indent,eol,start | |
set nowrap | |
set spelllang=en_gb | |
if has('nvim') " NeoVim terminal: | |
tnoremap <ESC> <C-\><C-n> | |
tnoremap <Leader><ESC> <C-\><C-n> | |
" 100k lines of scrollback in terminal buffer: | |
set scrollback=-1 | |
" autocmd BufEnter * if &buftype == 'terminal' | :startinsert | endif | |
autocmd TermOpen term://* startinsert | |
endif | |
" Strip trailing whitespace in Python and Ruby files | |
autocmd BufWritePre *.py,*.rb :StripTrailingWhitespaces | |
" Set the syntax for .rbapi files to be Ruby | |
au BufNewFile,BufRead,BufReadPost *.rbapi set syntax=ruby | |
vnoremap <silent> * :call VisualSelection('f')<CR> | |
vnoremap <silent> # :call VisualSelection('b')<CR> | |
" Telescope | |
" Using lua functions | |
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr> | |
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr> | |
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr> | |
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr> | |
nnoremap <leader>fs <cmd>lua require('telescope.builtin').search_history()<cr> | |
nnoremap <leader>ft <cmd>lua require('telescope.builtin').treesitter()<cr> | |
" ==== NvimTree | |
" Open the project tree and expose current file in the nerdtree with Ctrl-\ | |
nnoremap <silent> <C-\> :NvimTreeFindFile<CR> | |
" ==== NERD commenter | |
" Add spaces after comment delimiters by default | |
let g:NERDSpaceDelims = 1 | |
" Use Q to intelligently close a window | |
" (if there are multiple windows into the same buffer) | |
" or kill the buffer entirely if it's the last window looking into that buffer | |
function! CloseWindowOrKillBuffer() | |
let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')")) | |
" We should never bdelete a nerd tree | |
if matchstr(expand("%"), 'Nvim') == 'Nvim' | |
wincmd c | |
return | |
endif | |
if number_of_windows_to_this_buffer > 1 | |
wincmd c | |
else | |
bdelete | |
endif | |
endfunction | |
nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR> | |
" ALE | |
let g:ale_linters = { | |
\ 'typescript': ['tslint', 'tsserver', 'typecheck'], | |
\ 'rust': ['cargo', 'rls'], | |
\ 'ruby': ['rubocop', 'ruby', 'brakeman'] | |
\} | |
let g:ale_ruby_rubocop_executable = 'bundle' | |
let g:ale_rust_rls_toolchain = 'stable' | |
let g:ale_python_auto_pipenv = 1 | |
" coc.nvim | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? coc#_select_confirm() : | |
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
let g:coc_snippet_next = "<tab>" | |
" 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 | |
" Rainbow brackets | |
au VimEnter * RainbowParentheses | |
" Vim Markdown | |
let g:vim_markdown_folding_disabled = 1 | |
let g:vim_markdown_frontmatter = 1 | |
" Tagbar | |
"open the taglist (method browser) using ,t | |
nnoremap <silent> ,T :TagbarToggle<CR> | |
let g:tagbar_type_ruby = { | |
\ 'kinds' : [ | |
\ 'm:modules', | |
\ 'c:classes', | |
\ 'd:describes', | |
\ 'C:contexts', | |
\ 'f:methods', | |
\ 'F:singleton methods' | |
\ ] | |
\ } | |
let g:tagbar_type_snippets = { | |
\ 'ctagstype' : 'snippets', | |
\ 'kinds' : [ | |
\ 's:snippets', | |
\ ] | |
\ } | |
" Indent guides | |
let g:indent_guides_auto_colors = 1 | |
let g:indent_guides_start_level = 2 | |
let g:indent_guides_guide_size = 1 | |
" Handy key bindings for surrounding things | |
" ,# Surround a word with #{ruby interpolation} | |
map ,# ysiw# | |
vmap ,# c#{<C-R>"}<ESC> | |
" ," Surround a word with "quotes" | |
map ," ysiw" | |
vmap ," c"<C-R>""<ESC> | |
" ,' Surround a word with 'single quotes' | |
map ,' ysiw' | |
vmap ,' c'<C-R>"'<ESC> | |
" ,) or ,( Surround a word with (parens) | |
" The difference is in whether a space is put in | |
map ,( ysiw( | |
map ,) ysiw) | |
vmap ,( c( <C-R>" )<ESC> | |
vmap ,) c(<C-R>")<ESC> | |
" ,[ Surround a word with [brackets] | |
map ,] ysiw] | |
map ,[ ysiw[ | |
vmap ,[ c[ <C-R>" ]<ESC> | |
vmap ,] c[<C-R>"]<ESC> | |
" ,{ Surround a word with {braces} | |
map ,} ysiw} | |
map ,{ ysiw{ | |
vmap ,} c{ <C-R>" }<ESC> | |
vmap ,{ c{<C-R>"}<ESC> | |
map ,` ysiw` | |
" Hop configuration | |
nmap <leader><leader>w <cmd>HopWord<cr> | |
nmap <leader><leader>b <cmd>HopWord<cr> | |
nmap <leader><leader>f <cmd>HopChar1<cr> | |
" nmap ,<ESC> ,,w | |
" nmap ,<S-ESC> ,,b | |
" ================ Persistent Undo ================== | |
" Keep undo history across sessions, by storing in file. | |
" Only works all the time. | |
if has('persistent_undo') | |
silent !mkdir ~/.config/nvim/backups > /dev/null 2>&1 | |
set undodir=~/.config/nvim/backups | |
set undofile | |
endif | |
" Undotree | |
nnoremap <leader>u :UndotreeToggle<CR> | |
let g:undotree_WindowLayout = 3 | |
" Create window splits easier. The default | |
" way is Ctrl-w,v and Ctrl-w,s. I remap | |
" this to vv and ss | |
nnoremap <silent> vv <C-w>v | |
nnoremap <silent> ss <C-w>s | |
" Smart way to move between windows | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-h> <C-W>h | |
map <C-l> <C-W>l | |
" SplitJoin plugin | |
nmap sj :SplitjoinSplit<cr> | |
nmap sk :SplitjoinJoin<cr> | |
" Disable highlight when // is pressed | |
map <silent> // :noh<CR> | |
" Remap VIM 0 to first non-blank character | |
map 0 ^ | |
" --- Easy Align --- | |
" Start interactive EasyAlign in visual mode (e.g. vipga) | |
xmap ga <Plug>(EasyAlign) | |
" Start interactive EasyAlign for a motion/text object (e.g. gaip) | |
nmap ga <Plug>(EasyAlign) | |
" Remove the Windows ^M - when the encodings gets messed up | |
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm | |
" Pretty self-explanatory (function def further down) | |
command! StripTrailingWhitespaces call <SID>StripTrailingWhitespaces() | |
nmap ,w :StripTrailingWhitespaces<CR> | |
" Incsearch.vim | |
map / <Plug>(incsearch-forward) | |
map ? <Plug>(incsearch-backward) | |
map g/ <Plug>(incsearch-stay) | |
" :h g:incsearch#auto_nohlsearch | |
set hlsearch | |
let g:incsearch#auto_nohlsearch = 1 | |
map n <Plug>(incsearch-nohl-n) | |
map N <Plug>(incsearch-nohl-N) | |
map * <Plug>(incsearch-nohl-*) | |
map # <Plug>(incsearch-nohl-#) | |
map g* <Plug>(incsearch-nohl-g*) | |
map g# <Plug>(incsearch-nohl-g#) | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Helper functions | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function! CmdLine(str) | |
exe "menu Foo.Bar :" . a:str | |
emenu Foo.Bar | |
unmenu Foo | |
endfunction | |
function! VisualSelection(direction) range | |
let l:saved_reg = @" | |
execute "normal! vgvy" | |
let l:pattern = escape(@", '\\/.*$^~[]') | |
let l:pattern = substitute(l:pattern, "\n$", "", "") | |
if a:direction == 'b' | |
execute "normal ?" . l:pattern . "^M" | |
elseif a:direction == 'gv' | |
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.') | |
elseif a:direction == 'replace' | |
call CmdLine("%s" . '/'. l:pattern . '/') | |
elseif a:direction == 'f' | |
execute "normal /" . l:pattern . "^M" | |
endif | |
let @/ = l:pattern | |
let @" = l:saved_reg | |
endfunction | |
" Returns true if paste mode is enabled | |
function! HasPaste() | |
if &paste | |
return 'PASTE MODE ' | |
endif | |
return '' | |
endfunction | |
" via: http://rails-bestpractices.com/posts/60-remove-trailing-whitespace | |
" Strip trailing whitespace | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s | |
call cursor(l, c) | |
endfunction | |
" Colourful | |
if has('gui_running') || has('nvim') | |
" set background=dark | |
colorscheme solarized | |
endif |
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
vim.cmd [[packadd packer.nvim]] | |
return require("packer").startup(function(use) | |
-- Let packer manage itself | |
use "wbthomason/packer.nvim" | |
use "Raimondi/delimitMate" | |
-- { Neovim 0.5.0 plugins | |
-- Treesitter | |
use { | |
"nvim-treesitter/nvim-treesitter", | |
run = ':TSUpdate', | |
config = function() | |
require('nvim-treesitter.configs').setup { | |
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages | |
ignore_install = {}, -- List of parsers to ignore installing | |
highlight = { | |
enable = true, -- false will disable the whole extension | |
disable = {}, -- list of language that will be disabled | |
}, | |
indent = { | |
enable = true, | |
}, | |
refactor = { | |
smart_rename = { | |
enable = true, | |
keymaps = { | |
smart_rename = "grr", | |
}, | |
}, | |
navigation = { | |
enable = true, | |
keymaps = { | |
goto_definition = "gd", | |
list_definitions = "gD", | |
list_definitions_toc = "gO", | |
goto_next_usage = "<a-*>", | |
goto_previous_usage = "<a-#>", | |
}, | |
}, | |
} | |
} | |
end | |
} -- We recommend updating the parsers on update | |
use "nvim-treesitter/nvim-treesitter-refactor" | |
use { | |
"romgrk/nvim-treesitter-context", | |
config = function() | |
require('treesitter-context.config').setup { enable = true, } | |
end | |
} | |
-- To keep track of bindings | |
use { | |
"folke/which-key.nvim", | |
event = "VimEnter", | |
config = function() | |
require("which-key").setup() | |
end | |
} | |
-- Finders | |
use { | |
"nvim-telescope/telescope.nvim", | |
requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}}, | |
config = function() | |
local trouble = require("trouble.providers.telescope") | |
local telescope = require("telescope") | |
telescope.setup { | |
defaults = { | |
mappings = { | |
i = { ["<C-t>"] = trouble.open_with_trouble }, | |
n = { ["<C-t>"] = trouble.open_with_trouble }, | |
}, | |
}, | |
} | |
end | |
} | |
use { | |
"folke/trouble.nvim", | |
requires = "kyazdani42/nvim-web-devicons", | |
config = function() | |
require("trouble").setup() | |
end | |
} | |
use { | |
"neovim/nvim-lspconfig", | |
config = function() | |
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', '<comma>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | |
buf_set_keymap('n', '<comma>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | |
buf_set_keymap('n', '<comma>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | |
buf_set_keymap('n', '<comma>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | |
buf_set_keymap('n', '<comma>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | |
buf_set_keymap('n', '<comma>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | |
buf_set_keymap('n', 'grf', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | |
buf_set_keymap('n', '<comma>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', '<comma>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) | |
buf_set_keymap('n', '<comma>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) | |
end | |
-- Use a loop to conveniently call 'setup' on multiple servers and | |
-- map buffer local keybindings when the language server attaches | |
local servers = { "solargraph" } | |
for _, lsp in ipairs(servers) do | |
nvim_lsp[lsp].setup { | |
on_attach = on_attach, | |
flags = { | |
debounce_text_changes = 150, | |
} | |
} | |
end | |
end | |
} | |
use { | |
"hoob3rt/lualine.nvim", | |
requires = {"kyazdani42/nvim-web-devicons", opt = true}, | |
config = function() | |
require('lualine').setup { options = { theme = 'solarized' } } | |
end | |
} | |
-- } | |
-- TPope time | |
use { | |
"tpope/vim-abolish", | |
"tpope/vim-endwise", | |
"tpope/vim-eunuch", | |
"tpope/vim-fugitive", | |
"tpope/vim-obsession", | |
"tpope/vim-projectionist", | |
"tpope/vim-repeat", | |
"tpope/vim-surround", | |
"tpope/vim-unimpaired", | |
} | |
use { "tpope/vim-rails", ft = { "ruby", "eruby", "haml", "slim", "coffee" } } | |
use { "tpope/vim-rake", ft = "ruby" } | |
-- Better commenting | |
use "preservim/nerdcommenter" | |
-- Nice file browsing | |
use { | |
"kyazdani42/nvim-tree.lua", | |
requires = "kyazdani42/nvim-web-devicons", | |
cmd = { "NvimTreeToggle", "NvimTreeFindFile" } | |
} | |
use { | |
"mbbill/undotree", | |
cmd = "UndotreeToggle" | |
} | |
-- Check that it actually has ctags before kick-off | |
use { | |
"preservim/tagbar", | |
cond = function() | |
return vim.call("executable", "ctags") == 1 | |
end, | |
cmd = "TagbarToggle" | |
} | |
-- Snippets | |
use "honza/vim-snippets" | |
-- Syntax & languages | |
use { | |
"dense-analysis/ale", | |
ft = {"typescript", "rust", "ruby"}, | |
cmd = "ALEEnable", | |
config = "vim.cmd[[ALEEnable]]" | |
} | |
use "sheerun/vim-polyglot" | |
use "jmcantrell/vim-virtualenv" | |
use { "slashmili/alchemist.vim", ft = "elixir" } | |
use { "neoclide/coc.nvim", branch = "release" } | |
use { "neoclide/coc-neosnippet", run = "yarn install --frozen-lockfile" } | |
use { | |
"neoclide/coc-solargraph", | |
run = "yarn install --frozen-lockfile", | |
cond = function() return vim.call("executable", "solargraph") == 1 end | |
} | |
-- EditorConfig | |
use "editorconfig/editorconfig-vim" | |
-- Pretty colours | |
use "ishan9299/nvim-solarized-lua" | |
use "junegunn/rainbow_parentheses.vim" | |
-- Other stuff | |
use { 'junegunn/vim-easy-align', cmd = "EasyAlign" } | |
use { 'AndrewRadev/splitjoin.vim', branch = 'main' } | |
use 'AndrewRadev/switch.vim' | |
use { 'ck3g/vim-change-hash-syntax', ft = { "ruby", "eruby" } } | |
use 'nathanaelkane/vim-indent-guides' | |
use { | |
"nelstrom/vim-textobj-rubyblock", | |
requires = { | |
{"lucapette/vim-textobj-underscore"}, {"kana/vim-textobj-user"} | |
} | |
} | |
use 'airblade/vim-gitgutter' | |
use 'vim-scripts/YankRing.vim' | |
-- Test runner | |
use { 'vim-test/vim-test', cmd = { "TestFile", "TestSuite", "TestNearest" } } | |
-- Better search | |
use "henrik/vim-indexed-search" | |
use "haya14busa/incsearch.vim" | |
-- Vim motions on speed | |
use { | |
"phaazon/hop.nvim", | |
as = "hop", | |
cmd = { "HopWord", "HopChar1" }, | |
config = function() | |
require("hop").setup {} | |
end | |
} | |
-- FZF | |
use { | |
"junegunn/fzf.vim", | |
requires = { "junegunn/fzf.vim", run = function() vim.fn["fzf#install()"](0) end } | |
} | |
end | |
) |
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
#!/bin/bash | |
cd ~/nvimrc | |
exec git stash | |
exec git pull --quiet | |
exec git stash apply | |
cd ~ |
Hi, I don't actually maintain this any more. I don't know if it's Windows compatible
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How exactly use this? Windows compatible?