11--[[
2-
32=====================================================================
43==================== READ THIS BEFORE CONTINUING ====================
54=====================================================================
@@ -76,29 +75,13 @@ require('lazy').setup({
7675 ' tpope/vim-sleuth' ,
7776
7877 -- Snippets
79- ' SirVer/ultisnips' ,
78+ -- 'SirVer/ultisnips',
8079 ' honza/vim-snippets' ,
8180 ' natebosch/dartlang-snippets' ,
8281 ' dart-lang/dart-vim-plugin' ,
8382 ' morhetz/gruvbox' ,
8483 -- NOTE: This is where your plugins related to LSP can be installed.
8584 -- The configuration is done below. Search for lspconfig to find it below.
86- {
87- -- LSP Configuration & Plugins
88- ' neovim/nvim-lspconfig' ,
89- dependencies = {
90- -- Automatically install LSPs to stdpath for neovim
91- { ' williamboman/mason.nvim' , config = true },
92- ' williamboman/mason-lspconfig.nvim' ,
93-
94- -- Useful status updates for LSP
95- -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
96- { ' j-hui/fidget.nvim' , tag = ' legacy' , opts = {} },
97-
98- -- Additional lua configuration, makes nvim stuff amazing!
99- ' folke/neodev.nvim' ,
100- },
101- },
10285 {
10386 -- Autocompletion
10487 ' hrsh7th/nvim-cmp' ,
@@ -147,16 +130,6 @@ require('lazy').setup({
147130 end ,
148131 },
149132 },
150-
151- {
152- -- Theme inspired by Atom
153- ' navarasu/onedark.nvim' ,
154- priority = 1000 ,
155- config = function ()
156- vim .cmd .colorscheme ' onedark'
157- end ,
158- },
159-
160133 {
161134 -- Set lualine as statusline
162135 ' nvim-lualine/lualine.nvim' ,
@@ -205,7 +178,6 @@ require('lazy').setup({
205178 },
206179 },
207180 },
208-
209181 {
210182 -- Highlight, edit, and navigate code
211183 ' nvim-treesitter/nvim-treesitter' ,
@@ -214,21 +186,12 @@ require('lazy').setup({
214186 },
215187 build = ' :TSUpdate' ,
216188 },
217- {
218- ' akinsho/flutter-tools.nvim' ,
219- lazy = false ,
220- dependencies = {
221- ' nvim-lua/plenary.nvim' ,
222- ' stevearc/dressing.nvim' , -- optional for vim.ui.select
223- },
224- config = true ,
225- },
226189 { ' akinsho/git-conflict.nvim' , version = " *" , config = true },
227190 -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
228191 -- These are some example plugins that I've included in the kickstart repository.
229192 -- Uncomment any of the lines below to enable them.
230193 -- require 'kickstart.plugins.autoformat',
231- -- require 'kickstart.plugins.debug',
194+ require ' kickstart.plugins.debug' ,
232195
233196 -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
234197 -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
@@ -239,83 +202,6 @@ require('lazy').setup({
239202 { import = ' custom.plugins' },
240203}, {})
241204
242- local flutterConfig = require (" flutter-tools" )
243-
244- flutterConfig .setup {
245- ui = {
246- border = " rounded" ,
247- notification_style = ' native'
248- },
249- decorations = {
250- statusline = {
251- -- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline
252- -- this will show the current version of the flutter app from the pubspec.yaml file
253- app_version = true ,
254- -- set to true to be able use the 'flutter_tools_decorations.device' in your statusline
255- -- this will show the currently running device if an application was started with a specific
256- -- device
257- device = true ,
258- -- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline
259- -- this will show the currently selected project configuration
260- project_config = true ,
261- }
262- },
263- debugger = { -- integrate with nvim dap + install dart code debugger
264- enabled = false ,
265- run_via_dap = false , -- use dap instead of a plenary job to run flutter apps
266- -- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
267- -- see |:help dap.set_exception_breakpoints()| for more info
268- exception_breakpoints = {}
269- },
270- root_patterns = { " .git" , " pubspec.yaml" }, -- patterns to find the root of your flutter project
271- fvm = true , -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
272- widget_guides = {
273- enabled = false ,
274- },
275- closing_tags = {
276- highlight = " Comment" , -- highlight for the closing tag
277- prefix = " //" , -- character to use for close tag e.g. > Widget
278- enabled = true -- set to false to disable
279- },
280- dev_log = {
281- enabled = true ,
282- notify_errors = false , -- if there is an error whilst running then notify the user
283- open_cmd = " tabedit" , -- command to use to open the log buffer
284- },
285- dev_tools = {
286- autostart = false , -- autostart devtools server if not detected
287- auto_open_browser = false , -- Automatically opens devtools in the browser
288- },
289- outline = {
290- open_cmd = " 30vnew" , -- command to use to open the outline buffer
291- auto_open = false -- if true this will open the outline automatically when it is first populated
292- },
293- lsp = {
294- color = { -- show the derived colours for dart variables
295- enabled = false , -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
296- background = false , -- highlight the background
297- background_color = nil , -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},)
298- foreground = false , -- highlight the foreground
299- virtual_text = true , -- show the highlight using virtual text
300- virtual_text_str = " ■" , -- the virtual text character to highlight
301- },
302- --- OR you can specify a function to deactivate or change or control how the config is created
303- capabilities = function (config )
304- config .specificThingIDontWant = false
305- return config
306- end ,
307- -- see the link below for details on each option:
308- -- https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration
309- settings = {
310- showTodos = true ,
311- completeFunctionCalls = true ,
312- renameFilesWithClasses = " prompt" , -- "always"
313- enableSnippets = true ,
314- updateImportsOnRename = true , -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
315- }
316- }
317- }
318-
319205--- i [[ Setting options ]]
320206-- See `:help vim.o`
321207-- NOTE: You can change these options as you wish!
@@ -326,8 +212,11 @@ vim.o.hlsearch = false
326212vim .o .exrc = true
327213
328214-- Make line numbers default
215+ -- vim.wo.number = true
329216vim .wo .number = true
217+ vim .wo .relativenumber = true
330218
219+ vim .o .splitbelow = true
331220-- Enable mouse mode
332221vim .o .mouse = ' a'
333222
@@ -425,20 +314,12 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
425314vim .keymap .set (' n' , ' <leader>sr' , require (' telescope.builtin' ).resume , { desc = ' [S]earch [R]esume' })
426315
427316
428- -- [[ Configure Flutter tools]]
429- vim .keymap .set (' n' , ' <leader>r' , require (' telescope' ).extensions .flutter .commands , { desc = ' Open command Flutter' })
430- -- fvm flutter pub get && fvm flutter packages pub ru:build_runner build --delete-conflicting-outputs
431- vim .keymap .set (' n' , ' <leader>br' , function ()
432- vim .api .nvim_command (" botright split new" )
433- vim .fn .system { ' echo' , ' hi' }
434- end , { desc = ' Flutter get pub and build runner' })
435-
436317-- [[ Configure Treesitter ]]
437318-- See `:help nvim-treesitter`
438319require (' nvim-treesitter.configs' ).setup {
439320 -- Add languages to be installed here that you want installed for treesitter
440321 ensure_installed = { ' c' , ' cpp' , ' go' , ' lua' , ' python' , ' rust' , ' tsx' , ' javascript' , ' typescript' , ' vimdoc' , ' vim' ,
441- ' dart' , ' prisma' },
322+ ' dart' , ' prisma' , ' graphql ' },
442323
443324 -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
444325 auto_install = false ,
@@ -501,26 +382,26 @@ require('nvim-treesitter.configs').setup {
501382 },
502383}
503384
385+ vim .api .nvim_set_keymap (' i' , ' kj' , ' <ESC>' , { noremap = true })
386+
504387-- Diagnostic keymaps
505388vim .keymap .set (' n' , ' [d' , vim .diagnostic .goto_prev , { desc = ' Go to previous diagnostic message' })
506389vim .keymap .set (' n' , ' ]d' , vim .diagnostic .goto_next , { desc = ' Go to next diagnostic message' })
507390vim .keymap .set (' n' , ' <leader>e' , vim .diagnostic .open_float , { desc = ' Open floating diagnostic message' })
508391vim .keymap .set (' n' , ' <leader>q' , vim .diagnostic .setloclist , { desc = ' Open diagnostics list' })
509392
510- -- Neotree
511- vim .keymap .set (' n' , ' <leader>tt' , ' <Cmd>Neotree toggle<CR>' , { desc = " Neo[T]ree [T]oggle" })
512- vim .keymap .set (' n' , ' <leader>tr' , ' <Cmd>Neotree reveal<CR>' , { desc = " Neo[T]ree [R]eveal" })
513- vim .keymap .set (' n' , ' <leader>ts' , ' <Cmd>Neotree git_status<CR>' , { desc = " Neo[T]ree git [S]tatus" })
514393
515- -- Trouble
516- vim .keymap .set (" n" , " <leader>xx" , function () require (" trouble" ).toggle () end )
517- vim .keymap .set (" n" , " <leader>xw" , function () require (" trouble" ).toggle (" workspace_diagnostics" ) end )
518- vim .keymap .set (" n" , " <leader>xd" , function () require (" trouble" ).toggle (" document_diagnostics" ) end )
519- vim .keymap .set (" n" , " <leader>xq" , function () require (" trouble" ).toggle (" quickfix" ) end )
520- vim .keymap .set (" n" , " <leader>xl" , function () require (" trouble" ).toggle (" loclist" ) end )
521- vim .keymap .set (" n" , " gR" , function () require (" trouble" ).toggle (" lsp_references" ) end )
394+ -- Buffers
395+ vim .keymap .set (" n" , " <leader>n" , ' <Cmd>bnext<CR>' , { desc = " [N]ext buffer" })
396+ vim .keymap .set (" n" , " <leader>p" , ' <Cmd>bprevious<CR>' , { desc = " [P]revious buffer" })
397+ vim .keymap .set (" n" , " <leader>d" , ' <Cmd>bdelete<CR>' , { desc = " [D]elete buffer" })
398+ vim .keymap .set (" n" , " <leader>ot" , " <Cmd>20split | te<CR>" , { desc = " [O]pen [T]erminal below" })
522399
523- -- [[ Configure LSP ]]
400+ -- Save file
401+ vim .keymap .set (" n" , " <leader>s" , ' <Cmd>w<CR>' , { desc = " [S]ave file" })
402+
403+ -- Quit from terminal
404+ vim .api .nvim_set_keymap (' t' , ' <Leader><ESC>' , ' <C-\\ ><C-n>' , { noremap = true })
524405-- This function gets run when an LSP connects to a particular buffer.
525406local on_attach = function (_ , bufnr )
526407 -- NOTE: Remember that lua is a real programming language, and as such it is possible
@@ -577,9 +458,11 @@ local servers = {
577458 -- clangd = {},
578459 -- gopls = {},
579460 -- pyright = {},
580- -- rust_analyzer = {},
461+ -- rust_analyzer = {}
581462 tsserver = {},
582463 prismals = {},
464+ graphql = {},
465+ -- prettierd = {},
583466 -- html = { filetypes = { 'html', 'twig', 'hbs'} }
584467 lua_ls = {
585468 Lua = {
@@ -596,32 +479,6 @@ require('neodev').setup()
596479local capabilities = vim .lsp .protocol .make_client_capabilities ()
597480capabilities = require (' cmp_nvim_lsp' ).default_capabilities (capabilities )
598481
599-
600- -- Setup language servers.
601- local lspconfig = require (' lspconfig' )
602-
603- lspconfig .dartls .setup ({
604- cmd = { " dart" , " language-server" , " --protocol=lsp" },
605- filetypes = { " dart" },
606- init_options = {
607- closingLabels = true ,
608- flutterOutline = true ,
609- onlyAnalyzeProjectsWithOpenFiles = true ,
610- outline = true ,
611- suggestFromUnimportedLibraries = true ,
612- },
613- -- root_dir = root_pattern("pubspec.yaml"),
614- settings = {
615- dart = {
616- completeFunctionCalls = true ,
617- showTodos = true ,
618- },
619- },
620- on_attach = function (client , bufnr )
621- end ,
622- })
623-
624-
625482-- Global mappings.
626483-- See `:help vim.diagnostic.*` for documentation on any of the below functions
627484vim .keymap .set (' n' , ' <space>e' , vim .diagnostic .open_float )
@@ -678,7 +535,12 @@ mason_lspconfig.setup_handlers {
678535 end
679536}
680537
681- require (" lspconfig" ).dartls .setup ({
538+
539+ -- Setup language servers.
540+ local lspconfig = require (' lspconfig' )
541+
542+ capabilities .textDocument .completion .completionItem .snippetSupport = true
543+ lspconfig .dartls .setup ({
682544 cmd = { " dart" , " language-server" , " --protocol=lsp" },
683545 filetypes = { " dart" },
684546 init_options = {
@@ -688,25 +550,24 @@ require("lspconfig").dartls.setup({
688550 outline = true ,
689551 suggestFromUnimportedLibraries = true ,
690552 },
553+ capabilities = capabilities ,
691554 -- root_dir = root_pattern("pubspec.yaml"),
692555 settings = {
693556 dart = {
694557 completeFunctionCalls = true ,
695558 showTodos = true ,
696559 },
697560 },
698- on_attach = function (client , bufnr )
699- end ,
700561})
701562
702563require (" telescope" ).load_extension (" flutter" )
703564
704-
705565-- [[ Configure nvim-cmp ]]
706566-- See `:help cmp`
707567local cmp = require ' cmp'
708568local luasnip = require ' luasnip'
709- require (' luasnip.loaders.from_vscode' ).lazy_load ()
569+ -- require('luasnip.loaders.from_vscode').lazy_load()
570+ require (" luasnip.loaders.from_snipmate" ).lazy_load ()
710571luasnip .config .setup {}
711572
712573cmp .setup {
@@ -752,24 +613,3 @@ cmp.setup {
752613
753614-- The line beneath this is called `modeline`. See `:help modeline`
754615-- vim: ts=2 sts=2 sw=2 etc
755- require (' onedark' ).setup {
756- colors = {
757- bright_orange = " #ff8800" , -- define a new color
758- green = ' #00ffaa' , -- redefine an existing color
759- },
760- highlights = {
761- -- ["@keyword"] = { fg = '$green' },
762- [" @string" ] = { fmt = ' bold,italic' , fg = ' $orange' },
763- [" @function" ] = { sp = ' $yellow' },
764- [" @function.builtin" ] = { fg = ' #0059ff' },
765- [" @parameter" ] = { fg = ' $cyan' },
766- [" @variable.builtin" ] = { fg = ' #00ffff' },
767- [" @type.builtin" ] = { fg = ' #00ffff' },
768- -- ["@constant"] = { fg = '$purple' }
769- -- ["@constant"] = { fg = '$purple' }
770- -- ["@constant.builtin"] = { fg = '$purple' }
771- -- ["@type"] = { fg = '$purple' }
772- }
773- }
774-
775- require (' onedark' ).load ()
0 commit comments