Add nvim config
This commit is contained in:
parent
e1f091a0a2
commit
695d122bac
2 changed files with 247 additions and 0 deletions
29
dot_config/nvim/ginit.vim
Normal file
29
dot_config/nvim/ginit.vim
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
" Enable Mouse
|
||||
set mouse=a
|
||||
|
||||
" Set Editor Font
|
||||
if exists(':GuiFont')
|
||||
" Use GuiFont! to ignore font errors
|
||||
GuiFont Monaco Nerd Font Mono:h10
|
||||
endif
|
||||
|
||||
" Disable GUI Tabline
|
||||
if exists(':GuiTabline')
|
||||
GuiTabline 0
|
||||
endif
|
||||
|
||||
" Disable GUI Popupmenu
|
||||
if exists(':GuiPopupmenu')
|
||||
GuiPopupmenu 0
|
||||
endif
|
||||
|
||||
" Enable GUI ScrollBar
|
||||
if exists(':GuiScrollBar')
|
||||
GuiScrollBar 1
|
||||
endif
|
||||
|
||||
" Right Click Context Menu (Copy-Cut-Paste)
|
||||
nnoremap <silent><RightMouse> :call GuiShowContextMenu()<CR>
|
||||
inoremap <silent><RightMouse> <Esc>:call GuiShowContextMenu()<CR>
|
||||
xnoremap <silent><RightMouse> :call GuiShowContextMenu()<CR>gv
|
||||
snoremap <silent><RightMouse> <C-G>:call GuiShowContextMenu()<CR>gv
|
||||
218
dot_config/nvim/init.lua
Normal file
218
dot_config/nvim/init.lua
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
vim.g.mapleader = ','
|
||||
vim.g.maplocalleader = '\\'
|
||||
|
||||
local Plug = vim.fn['plug#']
|
||||
vim.call('plug#begin')
|
||||
|
||||
Plug 'junegunn/vim-plug'
|
||||
|
||||
-- Language Server protocol config
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
|
||||
-- Colorschemes
|
||||
Plug 'shaunsingh/solarized.nvim'
|
||||
|
||||
-- Syntax Highlighting and folding
|
||||
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
|
||||
|
||||
Plug 'nvim-lualine/lualine.nvim'
|
||||
|
||||
-- Tags
|
||||
Plug 'liuchengxu/vista.vim'
|
||||
|
||||
-- Navigation
|
||||
Plug 'preservim/nerdtree'
|
||||
|
||||
-- Telescope finding shit
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug('nvim-telescope/telescope.nvim', {['branch'] = '0.1.x'})
|
||||
Plug('nvim-telescope/telescope-fzf-native.nvim', {['do'] = 'make' })
|
||||
Plug 'doctorfree/cheatsheet.nvim'
|
||||
|
||||
-- Omnisharp
|
||||
Plug 'Hoffs/omnisharp-extended-lsp.nvim'
|
||||
|
||||
-- Git
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'tommcdo/vim-fubitive'
|
||||
|
||||
-- ZK Zettlekasten Notes
|
||||
Plug 'zk-org/zk-nvim'
|
||||
|
||||
-- Misc
|
||||
Plug 'lukas-reineke/indent-blankline.nvim'
|
||||
|
||||
vim.call('plug#end')
|
||||
|
||||
require'lspconfig'.pylsp.setup{
|
||||
settings = { pylsp = {
|
||||
plugins = {
|
||||
pycodestyle = { enabled = false, },
|
||||
pyflakes = { enabled = false, },
|
||||
rope_autoimport = { enabled = true, },
|
||||
},
|
||||
configurationSources = 'flake8'
|
||||
}}
|
||||
}
|
||||
require'lspconfig'.omnisharp.setup{
|
||||
cmd = { "dotnet", "/usr/lib/omnisharp-roslyn/OmniSharp.dll" },
|
||||
enable_roslyn_analyzers = false,
|
||||
handlers = {
|
||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||
},
|
||||
}
|
||||
require'lspconfig'.marksman.setup{}
|
||||
require'lspconfig'.ruff_lsp.setup{}
|
||||
|
||||
require'zk'.setup()
|
||||
|
||||
vim.diagnostic.config{
|
||||
float = {
|
||||
source = 'always',
|
||||
}
|
||||
}
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<leader>k', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<leader>fo', function() vim.lsp.buf.format { async = true } end, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Treesiter for syntax highlighting and folding
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "python", "html" },
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "markdown" },
|
||||
},
|
||||
indent = { enable = true, },
|
||||
}
|
||||
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldenable = false
|
||||
|
||||
|
||||
-- Tag bar
|
||||
vim.g.vista_default_executive = 'nvim_lsp'
|
||||
vim.keymap.set('n', '<F8>', ':Vista!!<CR>')
|
||||
|
||||
|
||||
-- Colourscheme
|
||||
vim.opt.background = 'light'
|
||||
|
||||
vim.g.solarized_borders = true
|
||||
|
||||
|
||||
-- This setting needs to be set before solarized is loaded
|
||||
-- so it can't go into ginit.vim, since that is loaded after
|
||||
-- this file
|
||||
if vim.fn.has('gui_running') == 0 then
|
||||
vim.g.solarized_disable_background = true
|
||||
else
|
||||
vim.g.solarized_disable_background = false
|
||||
end
|
||||
require('solarized').set()
|
||||
|
||||
|
||||
-- Lualine (powerline like thing) setup
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'solarized'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- Nerdree mappings
|
||||
vim.keymap.set('n', '<C-n>', ':NERDTreeToggle<CR>')
|
||||
vim.keymap.set('n', '<C-f>', ':NERDTreeFind<CR>')
|
||||
|
||||
|
||||
-- Telescope
|
||||
require('telescope').setup{
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case",
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
live_grep = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
lsp_references = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
}
|
||||
}
|
||||
local tele_builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', tele_builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', tele_builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>gr', tele_builtin.lsp_references, {})
|
||||
require('telescope').load_extension('fzf')
|
||||
|
||||
|
||||
-- General Setup
|
||||
-- Relative line numbering
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
-- Ruler at 80 and 100 cols
|
||||
vim.o.colorcolumn = "80,100"
|
||||
|
||||
-- Show Spaces, newlines tabs etc
|
||||
vim.opt.listchars = {
|
||||
trail = '•',
|
||||
extends = '>',
|
||||
precedes = '<',
|
||||
nbsp = '␣',
|
||||
eol = '↲',
|
||||
tab = '→,',
|
||||
}
|
||||
vim.opt.list = true
|
||||
|
||||
-- Clear highlights from search with Ctrl-l
|
||||
vim.keymap.set('n', '<C-l>', ':noh<CR>')
|
||||
|
||||
|
||||
-- Indentline
|
||||
require("ibl").setup()
|
||||
|
||||
|
||||
-- Whitespace --
|
||||
vim.o.expandtab = true
|
||||
vim.o.smartindent = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
Loading…
Add table
Reference in a new issue