210 lines
8.3 KiB
Lua
210 lines
8.3 KiB
Lua
-- Tab
|
|
vim.opt.tabstop = 2 -- number of visual spaces per TAB
|
|
vim.opt.softtabstop = 2 -- number of spacesin tab when editing
|
|
vim.opt.shiftwidth = 2 -- insert 4 spaces on a tab
|
|
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
|
|
|
-- UI config
|
|
vim.opt.number = true -- show absolute number
|
|
vim.opt.relativenumber = true -- add numbers to each line on the left side
|
|
vim.opt.splitbelow = true -- open new vertical split bottom
|
|
vim.opt.splitright = true -- open new horizontal splits right
|
|
-- vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
|
|
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
|
|
|
|
-- Searching
|
|
vim.opt.incsearch = true -- search as characters are entered
|
|
vim.opt.hlsearch = false -- do not highlight matches
|
|
vim.opt.ignorecase = true -- ignore case in searches by default
|
|
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
|
|
|
-- -- Keybinds
|
|
vim.keymap.set('n', '<C-h>', '<C-w>h', opts)
|
|
vim.keymap.set('n', '<C-j>', '<C-w>j', opts)
|
|
vim.keymap.set('n', '<C-k>', '<C-w>k', opts)
|
|
vim.keymap.set('n', '<C-l>', '<C-w>l', opts)
|
|
|
|
-- Resize with arrows
|
|
-- delta: 2 lines
|
|
vim.keymap.set('n', '<C-Up>', ':resize -2<CR>', opts)
|
|
vim.keymap.set('n', '<C-Down>', ':resize +2<CR>', opts)
|
|
vim.keymap.set('n', '<C-Left>', ':vertical resize -2<CR>', opts)
|
|
vim.keymap.set('n', '<C-Right>', ':vertical resize +2<CR>', opts)
|
|
|
|
vim.keymap.set('i', 'jk', '<Esc>', opts)
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
|
|
-- Lazy
|
|
require("config.lazy")
|
|
|
|
-- require("flutter-tools").setup {} -- use defaults
|
|
require("catppuccin").setup({
|
|
integrations = {
|
|
cmp = false,
|
|
gitsigns = true,
|
|
nvimtree = true,
|
|
treesitter = true,
|
|
notify = false,
|
|
mini = {
|
|
enabled = false,
|
|
indentscope_color = "",
|
|
},
|
|
}
|
|
})
|
|
|
|
-- css colors
|
|
vim.opt.termguicolors = true
|
|
require('nvim-highlight-colors').setup({})
|
|
|
|
vim.cmd.colorscheme "catppuccin"
|
|
|
|
|
|
-- Plugin setups
|
|
require('lualine').setup()
|
|
require("dapui").setup()
|
|
require("ibl").setup()
|
|
require("telescope").load_extension("flutter")
|
|
|
|
-- alternatively you can override the default configs
|
|
require("flutter-tools").setup {
|
|
ui = {
|
|
-- the border type to use for all floating windows, the same options/formats
|
|
-- used for ":h nvim_open_win" e.g. "single" | "shadow" | {<table-of-eight-chars>}
|
|
border = "rounded",
|
|
-- This determines whether notifications are show with `vim.notify` or with the plugin's custom UI
|
|
-- please note that this option is eventually going to be deprecated and users will need to
|
|
-- depend on plugins like `nvim-notify` instead.
|
|
notification_style = 'plugin'
|
|
},
|
|
decorations = {
|
|
statusline = {
|
|
-- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline
|
|
-- this will show the current version of the flutter app from the pubspec.yaml file
|
|
app_version = false,
|
|
-- set to true to be able use the 'flutter_tools_decorations.device' in your statusline
|
|
-- this will show the currently running device if an application was started with a specific
|
|
-- device
|
|
device = true,
|
|
-- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline
|
|
-- this will show the currently selected project configuration
|
|
project_config = false,
|
|
}
|
|
},
|
|
debugger = { -- integrate with nvim dap + install dart code debugger
|
|
enabled = true,
|
|
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
|
|
-- see |:help dap.set_exception_breakpoints()| for more info
|
|
exception_breakpoints = { "uncaught" },
|
|
-- Whether to call toString() on objects in debug views like hovers and the
|
|
-- variables list.
|
|
-- Invoking toString() has a performance cost and may introduce side-effects,
|
|
-- although users may expected this functionality. null is treated like false.
|
|
evaluate_to_string_in_debug_views = true,
|
|
},
|
|
flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
|
|
root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
|
|
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
|
|
widget_guides = {
|
|
enabled = true,
|
|
},
|
|
closing_tags = {
|
|
highlight = "ErrorMsg", -- highlight for the closing tag
|
|
prefix = ">", -- character to use for close tag e.g. > Widget
|
|
priority = 10, -- priority of virtual text in current line
|
|
-- consider to configure this when there is a possibility of multiple virtual text items in one line
|
|
-- see `priority` option in |:help nvim_buf_set_extmark| for more info
|
|
enabled = true -- set to false to disable
|
|
},
|
|
dev_log = {
|
|
enabled = true,
|
|
filter = nil, -- optional callback to filter the log
|
|
-- takes a log_line as string argument; returns a boolean or nil;
|
|
-- the log_line is only added to the output if the function returns true
|
|
notify_errors = false, -- if there is an error whilst running then notify the user
|
|
open_cmd = "15split", -- command to use to open the log buffer
|
|
focus_on_open = true, -- focus on the newly opened log window
|
|
},
|
|
dev_tools = {
|
|
autostart = false, -- autostart devtools server if not detected
|
|
auto_open_browser = false, -- Automatically opens devtools in the browser
|
|
},
|
|
outline = {
|
|
open_cmd = "30vnew", -- command to use to open the outline buffer
|
|
auto_open = false -- if true this will open the outline automatically when it is first populated
|
|
},
|
|
lsp = {
|
|
color = { -- show the derived colours for dart variables
|
|
enabled = true, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
|
background = true, -- highlight the background
|
|
background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},)
|
|
foreground = false, -- highlight the foreground
|
|
virtual_text = true, -- show the highlight using virtual text
|
|
virtual_text_str = "■", -- the virtual text character to highlight
|
|
},
|
|
-- see the link below for details on each option:
|
|
-- https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration
|
|
settings = {
|
|
showTodos = true,
|
|
completeFunctionCalls = true,
|
|
renameFilesWithClasses = "prompt", -- "always"
|
|
enableSnippets = true,
|
|
updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
|
|
}
|
|
}
|
|
}
|
|
|
|
------------- -- Debugger
|
|
local dap, dapui = require("dap"), require("dapui")
|
|
dap.listeners.before.attach.dapui_config = function()
|
|
dapui.open()
|
|
end
|
|
dap.listeners.before.launch.dapui_config = function()
|
|
dapui.open()
|
|
end
|
|
dap.listeners.before.event_terminated.dapui_config = function()
|
|
dapui.close()
|
|
end
|
|
dap.listeners.before.event_exited.dapui_config = function()
|
|
dapui.close()
|
|
end
|
|
|
|
-- c und rust
|
|
dap.adapters.lldb = {
|
|
type = 'executable',
|
|
command = 'lldb', -- adjust as needed, must be absolute path
|
|
name = 'lldb'
|
|
}
|
|
dap.configurations.c = dap.configurations.cpp
|
|
dap.configurations.rust = dap.configurations.cpp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
|
local builtin = require('telescope.builtin')
|
|
-- Telescope binds
|
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
|
vim.keymap.set('n', '<leader>fb', ":Telescope file_browser<CR>", { desc = 'Telescope file_browser' })
|
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
|
vim.keymap.set('n', '<leader>fl', ": Telescope flutter commands<CR>", { desc = "Open Telescope flutter" })
|
|
-- Dap binds
|
|
vim.keymap.set('n', '<leader>do', dapui.open, { desc = "Open debug overlay" })
|
|
vim.keymap.set('n', '<leader>dc', dapui.close, { desc = "Close debug overlay" })
|
|
vim.keymap.set('n', '<F5>', dap.toggle_breakpoint, { desc = "Close debug overlay" })
|
|
vim.keymap.set('n', '<F6>', dap.continue, { desc = "Close debug overlay" })
|
|
vim.keymap.set('n', '<F7>', dap.step_over, { desc = "Close debug overlay" })
|
|
vim.keymap.set('n', '<F8>', dap.step_into, { desc = "Close debug overlay" })
|
|
|
|
|
|
|
|
|
|
|