add nvim config

This commit is contained in:
Oystein Kristoffer Tveit 2021-05-04 23:08:47 +02:00
parent ca1657e415
commit 24a7066546
7 changed files with 187 additions and 0 deletions

View File

@ -0,0 +1,25 @@
-- Map leader to space
vim.g.mapleader = ' '
local fn = vim.fn
local execute = vim.api.nvim_command
require('settings')
require('plugins')
require('keys')
vim.cmd 'colorscheme monokai'
require('plugin-settings')
-- Setup Lua language server using submodule
-- require('lsp_lua')
-- Another option is to groups configuration in one folder
-- require('config')
-- OR you can invoke them individually here
--require('config.colorscheme') -- color scheme
--require('config.completion') -- completion
--require('config.fugitive') -- fugitive

View File

@ -0,0 +1,17 @@
-- " Quickly insert an empty new line without entering insert mode
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', {silent = true})
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', {silent = true})
vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', {silent = true})
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', {silent = true})
vim.cmd([[
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
]])
vim.cmd([[let mapleader = " "]])

View File

@ -0,0 +1 @@
require('plugins.vim-which-key')

View File

@ -0,0 +1,35 @@
-- vim.cmd [[packadd packer.nvim]]
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
execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
execute 'packadd packer.nvim'
end
vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile' -- Auto compile when there are changes in plugins.lua
-- require('packer').init({display = {non_interactive = true}})
require('packer').init({display = {auto_clean = false}})
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'crusoexia/vim-monokai'
use 'airblade/vim-gitgutter'
use 'junegunn/fzf.vim'
use 'tpope/vim-commentary'
use 'tmux-plugins/vim-tmux'
use 'christoomey/vim-tmux-navigator'
use 'junegunn/goyo.vim'
use 'junegunn/limelight.vim'
use 'liuchengxu/vim-which-key'
use 'sheerun/vim-polyglot'
use 'numirias/semshi'
end)

View File

@ -0,0 +1,2 @@
-- vim.cmd([[nnoremap <silent> <leader> :WhichKey '<Space>'<CR>]])
vim.api.nvim_set_keymap('n', '<space>', ':WhichKey <Space>', { noremap = true, silent = true })

View File

@ -0,0 +1,19 @@
vim.wo.relativenumber = true
vim.cmd 'set nu rnu' -- Make current linenumber absolute
vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else
vim.wo.scrolloff = 5 -- Start scrolling when n lines from edge
vim.api.nvim_set_option('smarttab', true)
vim.api.nvim_set_option('cindent', true)
vim.api.nvim_set_option('expandtab', true)
vim.api.nvim_set_option('breakindent', true) -- Wrapped lines gets indented
vim.api.nvim_set_option('tabstop', 2)
vim.api.nvim_set_option('shiftwidth', 2)
vim.cmd 'set formatoptions-=cro' -- No continued comment on <return>
vim.api.nvim_set_option('termguicolors', true)
vim.wo.conceallevel = 2

View File

@ -0,0 +1,88 @@
" Automatically generated packer.nvim plugin loader code
if !has('nvim-0.5')
echohl WarningMsg
echom "Invalid Neovim version for packer.nvim!"
echohl None
finish
endif
packadd packer.nvim
try
lua << END
local package_path_str = "/home/h7x4/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/h7x4/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/h7x4/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/h7x4/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/h7x4/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s))
if not success then
print('Error running ' .. component .. ' for ' .. name)
error(result)
end
return result
end
_G.packer_plugins = {
["fzf.vim"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/fzf.vim"
},
["goyo.vim"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/goyo.vim"
},
["limelight.vim"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/limelight.vim"
},
["packer.nvim"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/packer.nvim"
},
semshi = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/semshi"
},
["vim-commentary"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-commentary"
},
["vim-gitgutter"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-gitgutter"
},
["vim-monokai"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-monokai"
},
["vim-polyglot"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-polyglot"
},
["vim-tmux"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-tmux"
},
["vim-tmux-navigator"] = {
loaded = true,
path = "/home/h7x4/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator"
}
}
END
catch
echohl ErrorMsg
echom "Error in packer_compiled: " .. v:exception
echom "Please check your config for correctness"
echohl None
endtry