port nvim config to lua (oooh yeah!)

This commit is contained in:
LordMZTE 2021-04-20 14:34:02 +02:00
parent 76729f4294
commit ddf033ee92
6 changed files with 114 additions and 107 deletions

View file

@ -12,6 +12,9 @@
"filetypes": ["ocaml", "reason"]
}
},
"java.home": "/usr/lib/jvm/java-11-graalvm"
"java.home": "/usr/lib/jvm/java-11-graalvm",
"java.format.enabled": true,
"java.format.onType.enabled": true,
"java.format.settings.url": "/home/lordmzte/.config/coc/extensions/node_modules/redhat.java/https:/raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"
}

4
nvim/init.lua Normal file
View file

@ -0,0 +1,4 @@
require("settings")
require("maps")
require("plugins")

View file

@ -1,106 +0,0 @@
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
command GoToFile cd %:p:h
tnoremap <Esc> <C-\><C-n>
set number
call plug#begin(stdpath('data') . '/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
Plug 'jdonaldson/vaxe', {'branch' : 'neovaxe', 'do' : 'sh install.sh'}
Plug 'SirVer/ultisnips'
let g:UltiSnipsSnippetDirectories=["UltiSnips", "bundle/UltiSnips/UltiSnips"]
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'cespare/vim-toml'
Plug '~/go/src/github.com/junegunn/fzf'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'cespare/vim-toml'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-endwise'
Plug 'vimwiki/vimwiki'
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jreybert/vimagit'
Plug 'airblade/vim-gitgutter'
Plug 'dag/vim-fish'
Plug 'uiiaoo/java-syntax.vim'
call plug#end()
colorscheme dracula
let g:airline_powerline_fonts = 1
let g:neovide_iso_layout = v:true
let NERDTreeShowHidden=1
set guifont=Iosevka:h12
nnoremap <silent> fzf :FZF<CR>
" quick cursor movement while holding ctrl
nnoremap <C-Up> 5k
nnoremap <C-Down> 5j
" quick pasting/yoinking to system register
nnoremap +y "+y
nnoremap +p "+p
nnoremap +d "+d
nnoremap *y "*y
nnoremap *p "*p
nnoremap *d "*d
" firemvim config
let g:firenvim_config = {
\ 'localSettings': {
\ '.*twitch\.tv.*': {
\ 'takeover': 'never'
\ }
\ }
\ }
" Symbol renaming.
nmap cn <Plug>(coc-rename)
" Apply AutoFix to problem on the current line.
nmap cf <Plug>(coc-fix-current)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <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>
" Use space o to show symbols
nnoremap <silent> <space>o :CocList -I symbols<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')
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') && !exists("g:started_by_firenvim") | NERDTree | endif
filetype plugin on
set nocompatible
set mouse=a
set termguicolors

41
nvim/lua/maps.lua Normal file
View file

@ -0,0 +1,41 @@
local map = vim.api.nvim_set_keymap
-- Getting stuck in ~~vim~~ terminal
map("t", "<Esc>", "<C-\\><C-n>", { noremap = true })
map("n", "fzf", ":FZF<CR>", { silent = true, noremap = true })
-- Quick cursor movement
map("n", "<C-Down>", "5k", { noremap = true })
map("n", "<C-Up>", "5j", { noremap = true })
-- Quick pasting/yoinking to system register
map("n", "+y", "\"+y", { noremap = true })
map("n", "+p", "\"+p", { noremap = true })
map("n", "+d", "\"+d", { noremap = true })
map("n", "*y", "\"*y", { noremap = true })
map("n", "*p", "\"*p", { noremap = true })
map("n", "*d", "\"*d", { noremap = true })
-- symbol renaming
map("n", "cn", "<Plug>(coc-rename)", { silent = true, noremap = true })
-- apply AutoFix to problem on current line
map("n", "cf", "<Plug>(coc-fix-current)", { silent = true, noremap = true })
-- open action dialog
map("n", "ca", ":CocAction<CR>", { silent = true, noremap = true })
-- GoTo code navigation.
map("n", "gd", "<Plug>(coc-definition)", { silent = true, noremap = true })
map("n", "gy", "<Plug>(coc-type-definition)", { silent = true, noremap = true })
map("n", "gi", "<Plug>(coc-implementation)", { silent = true, noremap = true })
map("n", "gr", "<Plug>(coc-references)", { silent = true, noremap = true })
-- Use K to show documentation in preview window.
map("n", "K", ":call CocActionAsync(\'doHover\')<CR>", { silent = true, noremap = true })
-- use space o to show symbols
map("n", "<space>o", ":CocList -I symbols<CR>", { silent = true, noremap = true })
-- format code
map("n", "cr", ":call CocActionAsync(\'format\')<CR>", { silent = true, noremap = true })

26
nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,26 @@
vim.cmd [[packadd packer.nvim]]
return require("packer").startup(function(use)
use "wbthomason/packer.nvim"
use {"neoclide/coc.nvim", branch = "release"}
use "scrooloose/nerdtree"
use {"jdonaldson/vaxe", branch = "neovaxe", run = "sh install.sh"}
use "SirVer/ultisnips"
use "Xuyuanp/nerdtree-git-plugin"
use "tiagofumo/vim-nerdtree-syntax-highlight"
use "ryanoasis/vim-devicons"
use "cespare/vim-toml"
use "~/go/src/github.com/junegunn/fzf"
use {"dracula/vim", as = "dracula"}
use "jiangmiao/auto-pairs"
use "tpope/vim-endwise"
use "vimwiki/vimwiki"
use {"glacambre/firenvim", run = function() vim.fn["firenvim#install"](0) end}
use 'vim-airline/vim-airline'
use 'vim-airline/vim-airline-themes'
use 'jreybert/vimagit'
use 'airblade/vim-gitgutter'
use 'dag/vim-fish'
use 'uiiaoo/java-syntax.vim'
end)

39
nvim/lua/settings.lua Normal file
View file

@ -0,0 +1,39 @@
local cmd = vim.cmd
local o = vim.o
local wo = vim.wo
local g = vim.g
cmd("syntax on")
o.tabstop = 4
o.shiftwidth = 4
o.expandtab = true
wo.number = true
o.guifont = "Iosevka:h12"
o.mouse = "a"
o.termguicolors = true
g.airline_powerline_fonts = 1
g.neovide_iso_layout = true
g.NERDTreeShowHidden = true
cmd("colorscheme dracula")
-- firenvim config
local localSettings = {}
localSettings[".*twitch\\.tv.*"] = {
takeover = "never"
}
g.firenvim_config = {
localSettings = localSettings
}
-- Highlight the symbol and its references when holding the cursor.
cmd("autocmd CursorHold * silent call CocActionAsync('highlight')")
cmd("autocmd StdinReadPre * let s:std_in=1")
cmd("autocmd VimEnter * if argc() == 0 && !exists('s:std_in') && !exists('g:started_by_firenvim') | NERDTree | endif")
cmd("filetype plugin on")