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

@ -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'