refactor: Rename vim to nvim
This commit is contained in:
parent
d32bb32c0f
commit
27b8254a68
14 changed files with 3 additions and 3 deletions
12
nvim/.config/nvim/.netrwhist
Normal file
12
nvim/.config/nvim/.netrwhist
Normal file
|
@ -0,0 +1,12 @@
|
|||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =2
|
||||
let g:netrw_dirhist_2='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images/nginx/root/etc/nginx/conf.d'
|
||||
let g:netrw_dirhist_1='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images/nginx/root/etc/nginx'
|
||||
let g:netrw_dirhist_0='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images/nginx/root/etc'
|
||||
let g:netrw_dirhist_9='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images/nginx/root'
|
||||
let g:netrw_dirhist_8='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images/nginx'
|
||||
let g:netrw_dirhist_7='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker/images'
|
||||
let g:netrw_dirhist_6='/home/opdavies/Code/Personal/oliverdavies.uk/tools/docker'
|
||||
let g:netrw_dirhist_5='/home/opdavies/Code/Personal/oliverdavies.uk/tools'
|
||||
let g:netrw_dirhist_4='/home/opdavies/Code/Personal/oliverdavies.uk'
|
||||
let g:netrw_dirhist_3='/home/opdavies/Code/Personal/oliverdavies.uk/source'
|
60
nvim/.config/nvim/init.vim
Normal file
60
nvim/.config/nvim/init.vim
Normal file
|
@ -0,0 +1,60 @@
|
|||
let mapleader = " "
|
||||
|
||||
function! s:LoadPlugins()
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
source ~/.config/nvim/plugins.vim
|
||||
call plug#end()
|
||||
endfunction
|
||||
|
||||
function! s:SourceConfigFilesIn(directory)
|
||||
let directory_splat = '~/.config/nvim/' . a:directory . '/*'
|
||||
for config_file in split(glob(directory_splat), '\n')
|
||||
if filereadable(config_file)
|
||||
execute 'source' config_file
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
call s:LoadPlugins()
|
||||
|
||||
syntax on
|
||||
filetype on
|
||||
filetype indent on
|
||||
filetype plugin on
|
||||
|
||||
set autoindent
|
||||
set complete+=kspell
|
||||
set expandtab
|
||||
set foldlevelstart=99 " Start unfolded
|
||||
set foldmethod=indent
|
||||
set noswapfile
|
||||
set nowrap
|
||||
set number relativenumber
|
||||
set scrolloff=10 " Automatically scroll
|
||||
set shiftwidth=2
|
||||
set smartindent
|
||||
set tabstop=2 softtabstop=2
|
||||
set termguicolors
|
||||
|
||||
call s:SourceConfigFilesIn('plugins')
|
||||
|
||||
" Remaps
|
||||
nnoremap <leader>pv :Vex<CR>
|
||||
nnoremap <Leader>so :so ~/.config/nvim/init.vim<CR>
|
||||
nnoremap <C-p> :Files<CR>
|
||||
|
||||
" Remove arrow keys
|
||||
noremap <up> <nop>
|
||||
noremap <down> <nop>
|
||||
noremap <left> <nop>
|
||||
noremap <right> <nop>
|
||||
|
||||
autocmd FileType gitcommit highlight ColorColumn ctermbg=8
|
||||
autocmd FileType gitcommit setlocal colorcolumn=50,72
|
||||
autocmd FileType gitcommit setlocal textwidth=72
|
||||
autocmd FileType gitcommit setlocal spell
|
||||
|
||||
" Display extra whitespace
|
||||
set list listchars=tab:»·,trail:·
|
||||
|
||||
lua require("opdavies")
|
134
nvim/.config/nvim/lua/opdavies/init.lua
Normal file
134
nvim/.config/nvim/lua/opdavies/init.lua
Normal file
|
@ -0,0 +1,134 @@
|
|||
require('colorbuddy').colorscheme('gruvbuddy')
|
||||
|
||||
-- TreeSitter
|
||||
|
||||
local configs = require'nvim-treesitter.configs'
|
||||
|
||||
configs.setup {
|
||||
ensure_installed = "maintained",
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
|
||||
-- LSP
|
||||
|
||||
local lspconfig = require'lspconfig'
|
||||
local completion = require'completion'
|
||||
|
||||
local function custom_on_attach(client)
|
||||
print('Attaching to ' .. client.name)
|
||||
completion.on_attach(client)
|
||||
end
|
||||
|
||||
local default_config = {
|
||||
on_attach = custom_on_attach,
|
||||
}
|
||||
|
||||
lspconfig.intelephense.setup{
|
||||
filetypes = { "install", "inc", "module", "php", "test", "theme" },
|
||||
}
|
||||
|
||||
lspconfig.tsserver.setup(default_config)
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = true,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
}
|
||||
)
|
||||
|
||||
local key_mapper = function(mode, key, result)
|
||||
vim.api.nvim_set_keymap(
|
||||
mode,
|
||||
key,
|
||||
result,
|
||||
{noremap = true, silent = true}
|
||||
)
|
||||
end
|
||||
|
||||
key_mapper('n', '<c-k>', ':lua vim.lsp.buf.signature_help()<CR>')
|
||||
key_mapper('n', '<leader>af', ':lua vim.lsp.buf.code_action()<CR>')
|
||||
key_mapper('n', '<leader>rn', ':lua vim.lsp.buf.rename()<CR>')
|
||||
key_mapper('n', 'K', ':lua vim.lsp.buf.hover()<CR>')
|
||||
key_mapper('n', 'gD', ':lua vim.lsp.buf.declaration()<CR>')
|
||||
key_mapper('n', 'gW', ':lua vim.lsp.buf.workspace_symbol()<CR>')
|
||||
key_mapper('n', 'gd', ':lua vim.lsp.buf.definition()<CR>')
|
||||
key_mapper('n', 'gi', ':lua vim.lsp.buf.implementation()<CR>')
|
||||
key_mapper('n', 'gr', ':lua vim.lsp.buf.references()<CR>')
|
||||
key_mapper('n', 'gt', ':lua vim.lsp.buf.type_definition()<CR>')
|
||||
key_mapper('n', 'gw', ':lua vim.lsp.buf.document_symbol()<CR>')
|
||||
|
||||
key_mapper('n', '<leader>dn', ':lua vim.lsp.diagnostic.goto_next()<CR>')
|
||||
key_mapper('n', '<leader>dp', ':lua vim.lsp.diagnostic.goto_prev()<CR>')
|
||||
key_mapper('n', '<leader>ds', ':lua vim.lsp.diagnostic.show_line_diagnostics()<CR>')
|
||||
|
||||
key_mapper('n', '<C-p>', ':lua require"telescope.builtin".find_files()<CR>')
|
||||
key_mapper('n', '<leader>fb', ':lua require"telescope.builtin".buffers()<CR>')
|
||||
key_mapper('n', '<leader>fh', ':lua require"telescope.builtin".help_tags()<CR>')
|
||||
key_mapper('n', '<leader>fs', ':lua require"telescope.builtin".live_grep()<CR>')
|
||||
|
||||
-- Compe
|
||||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
min_length = 1;
|
||||
preselect = 'enable';
|
||||
throttle_time = 80;
|
||||
source_timeout = 200;
|
||||
incomplete_delay = 400;
|
||||
max_abbr_width = 100;
|
||||
max_kind_width = 100;
|
||||
max_menu_width = 100;
|
||||
documentation = true;
|
||||
|
||||
source = {
|
||||
path = true;
|
||||
nvim_lsp = true;
|
||||
};
|
||||
}
|
||||
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
local check_back_space = function()
|
||||
local col = vim.fn.col('.') - 1
|
||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Use (s-)tab to:
|
||||
--- move to prev/next item in completion menuone
|
||||
--- jump to prev/next snippet's placeholder
|
||||
_G.tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-n>"
|
||||
elseif check_back_space() then
|
||||
return t "<Tab>"
|
||||
else
|
||||
return vim.fn['compe#complete']()
|
||||
end
|
||||
end
|
||||
_G.s_tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-p>"
|
||||
else
|
||||
return t "<S-Tab>"
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||
|
||||
--This line is important for auto-import
|
||||
vim.api.nvim_set_keymap('i', '<cr>', 'compe#confirm("<cr>")', { expr = true })
|
||||
vim.api.nvim_set_keymap('i', '<c-space>', 'compe#complete()', { expr = true })
|
0
nvim/.config/nvim/plugged/.gitkeep
Normal file
0
nvim/.config/nvim/plugged/.gitkeep
Normal file
27
nvim/.config/nvim/plugins.vim
Normal file
27
nvim/.config/nvim/plugins.vim
Normal file
|
@ -0,0 +1,27 @@
|
|||
Plug 'APZelos/blamer.nvim'
|
||||
Plug 'Yggdroot/indentLine'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'arcticicestudio/nord-vim'
|
||||
Plug 'christoomey/vim-sort-motion'
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'hrsh7th/nvim-compe'
|
||||
Plug 'icatalina/vim-case-change'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
|
||||
Plug 'nanotech/jellybeans.vim'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-lua/popup.nvim'
|
||||
Plug 'nvim-telescope/telescope-fzy-native.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'preservim/nerdcommenter'
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'tjdevries/colorbuddy.vim'
|
||||
Plug 'tjdevries/cyclist.vim'
|
||||
Plug 'tjdevries/gruvbuddy.nvim'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'vim-airline/vim-airline'
|
5
nvim/.config/nvim/plugins/airline.vim
Normal file
5
nvim/.config/nvim/plugins/airline.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
3
nvim/.config/nvim/plugins/blamer.vim
Normal file
3
nvim/.config/nvim/plugins/blamer.vim
Normal file
|
@ -0,0 +1,3 @@
|
|||
let g:blamer_delay = 500
|
||||
let g:blamer_enabled = 0
|
||||
let g:blamer_relative_time = 1
|
3
nvim/.config/nvim/plugins/indentline.vim
Normal file
3
nvim/.config/nvim/plugins/indentline.vim
Normal file
|
@ -0,0 +1,3 @@
|
|||
let g:indentLine_showFirstIndentLevel = 1
|
||||
|
||||
autocmd FileType markdown let g:indentLine_setConceal= 0
|
4
nvim/.config/nvim/plugins/nerdtree.vim
Normal file
4
nvim/.config/nvim/plugins/nerdtree.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
let g:NERDTreeShowHidden=1
|
||||
let g:NERDTreeWinPos = "right"
|
||||
|
||||
nnoremap <leader>ne :NERDTreeToggle<CR>
|
2
nvim/.config/nvim/plugins/nord.vim
Normal file
2
nvim/.config/nvim/plugins/nord.vim
Normal file
|
@ -0,0 +1,2 @@
|
|||
let g:nord_bold_vertical_split_line = 1
|
||||
let g:nord_cursor_line_number_background = 1
|
4
nvim/.config/nvim/plugins/telescope.vim
Normal file
4
nvim/.config/nvim/plugins/telescope.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
Loading…
Add table
Add a link
Reference in a new issue