finish migrating all to lua

This commit is contained in:
Maciej Lebiest 2023-02-11 18:36:50 +01:00
parent e319cb3c2f
commit 9f472d1536
6 changed files with 103 additions and 107 deletions

13
init.lua Normal file
View file

@ -0,0 +1,13 @@
require("initializer")
vim.opt.mouse = "c" -- set mouse in command line mode
vim.opt.colorcolumn = "80" -- highlight this column
vim.opt.relativenumber = true
vim.opt.number = true
vim.opt.clipboard = "unnamedplus" -- synchronize with system clipboard
vim.opt.swapfile = false
vim.opt.cursorline = true
vim.opt.termguicolors = true
vim.cmd [[
highlight clear
colorscheme dracula
]]

View file

@ -1,62 +0,0 @@
" load main lua file with additional configs
lua require("initializer")
" highlight all .conf files as apache config (:])
autocmd BufEnter *.conf :setlocal filetype=apache
"au BufNewFile,BufRead *.sls set filetype=sls.yaml
"nerdtree bindings
nnoremap <leader>n :NvimTreeFocus<CR>
nnoremap <C-t> :NvimTreeToggle<CR>
" nerdcommenter custom bindings
nmap <c-/> <plug>NERDCommenterToggle
vmap <c-/> <plug>NERDCommenterToggle
set termguicolors
highlight clear
colorscheme dracula
set splitright
set splitbelow
" indent/unindent with tab/shift-tab
nmap <Tab> >>
nmap <S-tab> <<
imap <S-Tab> <Esc><<i
vmap <Tab> >gv
vmap <S-Tab> <gv
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
" general configs
set modeline
set encoding=UTF-8
set showmatch " show matching
set ignorecase " case insensitive
set mouse=v " middle-click paste with
set hlsearch " highlight search
set incsearch " incremental search
set tabstop=4 " number of columns occupied by a tab
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set relativenumber " add relative line numbers
set wildmode=longest,list " get bash-like tab completions
set cc=80 " set an 80 column border for good coding style
filetype plugin indent on "allow auto-indenting depending on file type
syntax on " syntax highlighting
"set mouse=a " enable mouse click
set clipboard+=unnamedplus " using system clipboard
filetype plugin on
set cursorline " highlight current cursorline
set ttyfast " Speed up scrolling in Vim
" set spell " enable spell check (may need to download language package)
set noswapfile " disable creating swap file
" set backupdir=~/.cache/vim " Directory to store backup files.

View file

@ -1,7 +1,5 @@
require("nvim-tree").setup({
hijack_cursor = true,
open_on_setup = true,
open_on_setup_file = true,
sync_root_with_cwd = true,
view = {
adaptive_size = true,

38
lua/config-noice.lua Normal file
View file

@ -0,0 +1,38 @@
return {
config = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
hover = {
enabled = true,
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
signature = {
enabled = false,
auto_open = {
enabled = true,
trigger = true, -- Automatically show signature help when typing a trigger character from the LSP
luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes
throttle = 50, -- Debounce lsp signature help request by 50ms
},
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
}
}

View file

@ -12,3 +12,33 @@ codewindow.setup({
z_index = 1, -- The z-index the floating window will be on
})
codewindow.apply_default_keybinds()
local function open_nvim_tree()
-- open the tree
require("nvim-tree.api").tree.open()
end
-- Functional wrapper for mapping custom keybindings
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
----------------------
-- general setup start
----------------------
-- open nvim tree on start
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
-- tab lines in normal and visual mode
map("n", "<Tab>", ">>")
map("n", "<S-Tab>", "<<")
map("i", "<S-Tab>", "<Esc><<i")
map("n", "<Tab>", ">>")
map("v", "<Tab>", ">gv")
map("v", "<S-Tab>", "<gv")

View file

@ -1,7 +1,11 @@
require("lazy").setup({
-- NERDTree stuff
{ 'nvim-tree/nvim-web-devicons' }, -- optional, for file icons
{ 'nvim-tree/nvim-tree.lua' },
{ 'nvim-tree/nvim-tree.lua',
keys = {
{ "<leader>n", "<cmd>NvimTreeFocus<cr>" },
{ "<C-t>", "<cmd>NvimTreeToggle<cr>" }
} },
-- neovim lsp plugins and depencencies
{ 'neovim/nvim-lspconfig' },
@ -28,58 +32,26 @@ require("lazy").setup({
{ 'lewis6991/gitsigns.nvim' },
{ 'petertriho/nvim-scrollbar' },
{ 'kevinhwang91/nvim-hlslens' },
{ 'L3MON4D3/LuaSnip', version = '*' },
{ 'L3MON4D3/LuaSnip', version = '*' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'lambdalisue/suda.vim' },
{ 'akinsho/bufferline.nvim', version = '*' },
{ 'akinsho/bufferline.nvim', version = '*' },
{ 'gorbit99/codewindow.nvim' },
{ 'preservim/nerdcommenter' },
{ 'preservim/nerdcommenter',
keys = {
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "v" },
{ "<c-/>", "<plug>NERDCommenterToggle", mode = "n" }
} },
{ 'rmagatti/auto-session' },
{ 'tpope/vim-fugitive' },
{ 'Glench/Vim-Jinja2-Syntax' },
{ 'vmware-archive/salt-vim' },
{ 'stephpy/vim-yaml' },
{ 'lukas-reineke/indent-blankline.nvim' },
{ 'rcarriga/nvim-notify' },
{ 'MunifTanjim/nui.nvim' },
{ 'folke/noice.nvim',
config = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
hover = {
enabled = true,
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
signature = {
enabled = false,
auto_open = {
enabled = true,
trigger = true, -- Automatically show signature help when typing a trigger character from the LSP
luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes
throttle = 50, -- Debounce lsp signature help request by 50ms
},
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
},
dependencies = {
config = require("config-noice").config,
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
@ -104,10 +76,17 @@ require("lazy").setup({
{ 'projekt0n/github-nvim-theme' },
--Fuzzy search by Telescope and its dependencies:
{ 'nvim-lua/plenary.nvim' },
{
'nvim-telescope/telescope.nvim', branch = 'master',
dependencies = { 'nvim-lua/plenary.nvim' }
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>" },
{ "<leader>fb", "<cmd>Telescope buffers<cr>" },
{ "<leader>fh", "<cmd>Telescope help_tags<cr>" }
}
},
{ 'BurntSushi/ripgrep' },
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },