Initial configuration converted to lua

Still many missing plugins and configurations
This commit is contained in:
Marko Korhonen 2020-12-14 19:11:20 +02:00
parent c41172efbd
commit ec02529615
No known key found for this signature in database
GPG key ID: 911B85FBC6003FE5
19 changed files with 137 additions and 472 deletions

View file

@ -1,5 +1,3 @@
actions:
vim-plug: nvim +PlugInstall +qall
config:
backup: true
banner: true
@ -25,20 +23,15 @@ dotfiles:
d_imapnotify:
dst: ~/.config/imapnotify
src: .config/imapnotify
f_init.vim:
dst: ~/.config/nvim/init.vim
src: .config/nvim/init.vim
d_nvim_config:
actions:
- vim-plug
dst: ~/.config/nvim/conf.d
src: .config/nvim/conf.d
f_nvim_init:
dst: ~/.config/nvim/init.lua
src: .config/nvim/init.lua
d_nvim_lua:
dst: ~/.config/nvim/lua
src: .config/nvim/lua
f_user-dirs.dirs:
dst: ~/.config/user-dirs.dirs
src: .config/user-dirs.dirs
f_coc-settings.json:
dst: ~/.config/nvim/coc-settings.json
src: .config/nvim/coc-settings.json
d_sway:
dst: ~/.config/sway
src: .config/sway
@ -177,9 +170,8 @@ profiles:
- f_ranger.conf
- f_ssh.conf
- f_authorized_keys
- d_nvim_config
- f_init.vim
- f_coc-settings.json
- d_nvim_lua
- f_nvim_init
- f_gitconfig
- f_alacritty.yml
email:
@ -239,21 +231,8 @@ profiles:
- terminal
- Pacman
mko-laptop:
dotfiles:
- f_nvimpager
- f_hushlogin
- f_ripgrep_ignore
- f_ranger_commands.py
- f_rtv.cfg
- f_mailcap
- d_zsh
- f_zshrc
- f_tmux.conf
- f_ranger.conf
- d_nvim_config
- f_init.vim
- f_coc-settings.json
- f_alacritty.yml
include:
- terminal
AnittaPC:
include:
- terminal

View file

@ -1,33 +0,0 @@
{
"python.jediEnabled": false,
"suggest.noselect": false,
"suggest.echodocSupport": true,
"suggest.maxCompleteItemCount": 20,
"coc.preferences.formatOnSaveFiletypes": [],
"prettier.singleQuote": false,
"diagnostic.errorSign": "•",
"diagnostic.warningSign": "•",
"diagnostic.infoSign": "•",
"suggest.snippetIndicator": "~",
"rust-analyzer.serverPath": "/usr/bin/rust-analyzer",
"languageserver": {
"bash": {
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
},
"xml": {
"command": "xml-language-server",
"args": ["start"],
"filetypes": ["xml"],
"ignoredRootPaths": ["~"]
}
},
"markdownlint.config": {
"rules": {
"default": true,
"line_length": false
}
}
}

View file

@ -1,95 +0,0 @@
" Auto-install vim-plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
" Set coc extensions
let g:coc_global_extensions = [
\ 'coc-tsserver',
\ 'coc-html',
\ 'coc-tsserver',
\ 'coc-json',
\ 'coc-yaml',
\ 'coc-texlab',
\ 'coc-prettier',
\ 'coc-python',
\ 'coc-emmet',
\ 'coc-rust-analyzer',
\ 'coc-markdownlint',
\ 'coc-snippets',
\ 'coc-java'
\ ]
call plug#begin()
" statusline/tabline
Plug 'vim-airline/vim-airline'
" Make editing passwords safer
Plug 'https://git.zx2c4.com/password-store', { 'rtp': 'contrib/vim/redact_pass.vim' }
" Colorize color words
Plug 'norcalli/nvim-colorizer.lua'
" NeoVim in Firefox
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
" Spelling
Plug 'vim-scripts/Vimchant'
" Pandoc plugins
Plug 'vim-pandoc/vim-pandoc'
Plug 'conornewton/vim-pandoc-markdown-preview'
" Fuzzy finder
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Language syntax pack
Plug 'sheerun/vim-polyglot'
" Read editorconfig settings
Plug 'editorconfig/editorconfig-vim'
" Make directory if it doesn't exist
Plug 'pbrisbin/vim-mkdir'
" Tree explorer
Plug 'scrooloose/nerdtree'
" Moar snippets
Plug 'honza/vim-snippets'
" Filetype icons
Plug 'ryanoasis/vim-devicons'
" Surround stuff with brackets and quotes
Plug 'tpope/vim-surround'
" Do stuff as sudo
Plug 'lambdalisue/suda.vim'
" Conguer of Completion
Plug 'neoclide/coc.nvim', {'do': './install.sh nightly'}
" VimL source for CoC
Plug 'Shougo/neco-vim'
Plug 'neoclide/coc-neco'
" Git plugin
Plug 'jreybert/vimagit'
" Git diff in gutter
Plug 'airblade/vim-gitgutter'
" Gpg support
Plug 'jamessan/vim-gnupg'
" Colorscheme
Plug 'joshdick/onedark.vim'
" Latex plugin
Plug 'lervag/vimtex'
call plug#end()

View file

@ -1,46 +0,0 @@
" Set colorscheme
colorscheme onedark
" Floating window transparency
set winblend=10
" Enable italics
let g:onedark_terminal_italics=1
" Disable built-in statusline because airline shows it
set noshowmode
" Airline
set laststatus=2
set encoding=utf-8
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_section_warning = ''
let g:airline_section_error = ''
let g:airline_theme='onedark'
" True color support
set termguicolors
" Line numbering
set relativenumber
set number
" Always show signcolumn
set signcolumn=yes
" Autoindent and syntax highlight
set autoindent
set smartindent
syntax on
filetype on
filetype plugin indent on
set tabstop=4
set shiftwidth=4
" Make gutter and cursorline bg transparent
highlight CursorLineNr guibg=transparent
highlight SignColumn guibg=transparent
" Don't wrap in the middle of words
set linebreak

View file

@ -1,39 +0,0 @@
" Change leader to space
nnoremap <SPACE> <Nop>
let mapleader = ' '
" Toggle nerdtree
map <silent> <C-t> :NERDTreeToggle<CR>
" Markdown preview
nmap <C-s> <Plug>MarkdownPreview
nmap <M-s> <Plug>MarkdownPreviewStop
nmap <C-p> <Plug>MarkdownPreviewToggle
set splitbelow
set splitright
" Move between buffers
nnoremap <C-N> :bn<CR>
nnoremap <C-B> :bp<CR>
" Move between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable mouse
set mouse=a
" Toggle equalalways
function ToggleEqual ()
:set equalalways!
:set equalalways!
endfunction
nnoremap <leader>= :call ToggleEqual()<CR>
" Navigate display lines insted of physical lines
nnoremap j gj
nnoremap k gk

View file

@ -1,129 +0,0 @@
" Enable symbol highlight
autocmd CursorHold * silent call CocActionAsync('highlight')
" If hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" Smaller updatetime for CursorHold & CursorHoldI
set updatetime=300
" Don't give |ins-completion-menu| messages.
set shortmess+=c
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
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 <cr> to confirm snippet
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() :
\"\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[c` and `]c` to navigate diagnostics
nmap <silent> [c <Plug>(coc-diagnostic-prev)
nmap <silent> ]c <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
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
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add diagnostic info for https://github.com/itchyny/lightline.vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'cocstatus': 'coc#status'
\ },
\ }
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>

View file

@ -1,12 +0,0 @@
" LaTex settings
let g:vimtex_view_method='zathura'
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_MultipleCompileFormats='pdf, aux'
let g:vimtex_compiler_progname='nvr'
" YAML settings
au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Run rustfmt on save
let g:rustfmt_autosave = 1

View file

@ -1,41 +0,0 @@
" Enable python support
let g:python3_host_prog='/usr/bin/python3'
let pyxversion=3
" LaTex fallback flavor
let g:tex_flavor = 'latex'
" Use suda by default
let g:suda_smart_edit = 1
" Remap exit terminal mode to esc
au TermOpen * tnoremap <buffer> <Esc> <c-\><c-n>
" Use system clipboard
set clipboard=unnamedplus
" Remove extra line
set cmdheight=1
" Disable auto commenting
set formatoptions-=cro
" Set pandoc preview program
let g:pandoc_preview_pdf_cmd = "zathura"
" Case insensitive search
set ignorecase
set smartcase
" Nerdtree settings
let NERDTreeMinimalUI = 1 "remove press ? for help"
let NERDTreeAutoDeleteBuffer = 1 " delete buffer when file is deleted
let NERDTreeQuitOnOpen = 1 " close nerdtree when opening file
let NERDTreeDirArrows = 1
" Firenvim filetypes
au BufEnter github.com_*.txt set filetype=markdown
au BufEnter gitlab.com_*.txt set filetype=markdown
au BufEnter git.reekynet.com_*.txt set filetype=markdown
au BufEnter www.reddit.com_*.txt set filetype=markdown
au BufEnter node.reekynet.com_*.txt set filetype=json

View file

@ -1,43 +0,0 @@
" FZF in floating window
autocmd! FileType fzf
autocmd FileType fzf call SetFZFoptions()
function SetFZFoptions()
set noshowmode noruler nonumber norelativenumber
tunmap <buffer> <Esc>
endfunction
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
function! FloatingFZF()
let buf = nvim_create_buf(v:false, v:true)
call setbufvar(buf, '&signcolumn', 'no')
let width = float2nr(&columns * 0.8)
let height = float2nr(&lines * 0.6)
let horizontal = 1
let vertical = 1
let opts = {
\ 'relative': 'editor',
\ 'row': (&lines - height) / 2,
\ 'col': (&columns - width) / 2,
\ 'width': width,
\ 'height': height,
\ 'style': 'minimal'
\ }
call nvim_open_win(buf, v:true, opts)
endfunction
" Looks
"let $FZF_DEFAULT_OPTS=' --color=dark --color=fg:15,bg:-1,hl:1,fg+:#ffffff,bg+:0,hl+:1 --color=info:0,prompt:0,pointer:12,marker:4,spinner:11,header:-1 --layout=reverse --margin=1,4'
" ripgrep custom settings
command! -bang -nargs=* Rg
\ call fzf#vim#grep('rg --column --line-number --no-heading --color=always --smart-case '
\ . (len(<q-args>) > 0 ? <q-args> : '""'), 0,
\ fzf#vim#with_preview({'options': ['--delimiter=:', '--nth=2..', '--layout=reverse', '--info=inline']}), <bang>0)
" Keybinds
nmap <C-f> :Files<CR>
nmap <C-g> :Rg<CR>

View file

@ -0,0 +1,9 @@
require 'pluginmanager'
require 'keybinds'
require 'settings'
require 'autocmd'
-- Plugin configurations
require 'plugins/airline'
require 'plugins/nerdtree'
require 'plugins/lsp'

View file

@ -1,3 +0,0 @@
for f in split(glob('~/.config/nvim/conf.d/*.vim'), '\n')
exe 'source' f
endfor

View file

@ -0,0 +1,4 @@
local cmd = vim.cmd
-- Remap exit terminal mode to esc
cmd('au TermOpen * tnoremap <buffer> <Esc> <c-\\><c-n>')

View file

@ -0,0 +1,10 @@
local map = function(type, key, value)
vim.fn.nvim_buf_set_keymap(0, type, key, value, {noremap = true, silent = true})
end
-- Open/close nerdtree
map('n', '<C-t>', '<cmd>NERDTreeToggle<CR>')
-- FZF
map('n', '<C-f>', '<cmd>Files<CR>')
map('n', '<C-g>', '<cmd>Rg<CR>')

View file

@ -0,0 +1,46 @@
local fn = vim.fn
local cmd = vim.cmd
-- Install packer if it's not yet installed
local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
local packer_not_installed = fn.empty(fn.glob(install_path))
if packer_not_installed > 0 then
print('Packer is not installed, cloning it now...')
cmd ('silent !git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
end
-- Configure packer
cmd 'packadd packer.nvim'
require('packer').startup(function()
-- The plugin manager itself
use {'wbthomason/packer.nvim', opt = true}
-- Colorscheme
use 'joshdick/onedark.vim'
-- Custom status and tabline
use 'vim-airline/vim-airline'
-- Tree explorer
use 'scrooloose/nerdtree'
-- Fuzzy finder
use 'junegunn/fzf'
use 'junegunn/fzf.vim'
-- Do stuff as sudo
use 'lambdalisue/suda.vim'
-- Configs for built-in LSP
use 'neovim/nvim-lspconfig'
-- Completion framework
use 'nvim-lua/completion-nvim'
end)
-- Install plugins if packer was not installed
if packer_not_installed > 0 then
cmd 'PackerInstall'
end

View file

@ -0,0 +1,10 @@
local g = vim.g
local o = vim.o
o.showmode = false
o.laststatus = 2
g["airline#extensions#tabline#enabled"]= 1
g.airline_powerline_fonts = 1
g.airline_section_warning = ''
g.airline_section_error = ''
g.airline_theme = 'onedark'

View file

@ -0,0 +1 @@
vim.cmd "autocmd BufEnter * lua require'completion'.on_attach()"

View file

@ -0,0 +1,3 @@
local cmd = vim.cmd
require 'lspconfig'.rust_analyzer.setup{}

View file

@ -0,0 +1,44 @@
local o = vim.o
local cmd = vim.cmd
------ Appearance ------
-- Set colorscheme
cmd 'colorscheme onedark'
-- True colors
o.termguicolors = true
-- Floating window transparency
o.winblend = 10
-- Remove extra line
o.cmdheight = 1
-- Always show signcolumn
o.signcolumn = 'yes'
-- Gutter and cursoline bg transparent
cmd 'highlight CursorLineNr guibg=transparent'
cmd 'highlight SignColumn guibg=transparent'
------ Misc -------
-- Case insensitive search
o.ignorecase = true
o.smartcase = true
-- Use system clipboard
o.clipboard = 'unnamedplus'
-- Autoindent and syntax higlight
o.autoindent = true
o.smartindent = true
o.tabstop = 4
o.shiftwidth = 4
cmd 'syntax on'
cmd 'filetype on'
cmd 'filetype plugin indent on'
-- Disable auto commenting
o.formatoptions = 'cro'